dump and restore


Results 1 to 5 of 5

Thread: dump and restore

  1. #1
    Join Date
    Mar 2010
    Posts
    3

    dump and restore

    Dear guys

    I want to know how to take backup linux operating system with root boot and swap partition and how to restore linux operating system. please tell me the step by step point. I'll be obliged to you


    Thanking you

    Muhammad Irfan Qadeer

  2. #2
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,984
    irfanqadeer,

    Welcome to Justlinux!

    The easiest is put the back up on a second hard disk which can be hooked up as a USB device. If this second hard disk is of the same size (exactly) or just larger a data dump command is all it takes.

    Assuming the source disk is device sda and the second hard disk is device sdb then in a root terminal this command will clone everything from the source to the target.

    Code:
    dd if=/dev/sda of=/dev/sdb bs=32256
    The above has an advantage that whenever something goes wrong with the original you can "replace" it with the second hard disk and everything will work exactly as before.

    If you put the partitions, say /boot and /root are in sda1 and sda2 respectively, into two files called file1 and file2 then these commands should do it

    [code]
    Code:
    dd if=/dev/sda1 of=file1 bs=32256
    dd if=/dev/sda2 of=file2 bs=32256
    To restate you swap the destination of the input and output in the dd command.

    You don't need to back up a swap partition.

    bs=32256 can be omitted at the cost of slower speed using the default size bs=512. 32256 is one full track being copies at a time as a standard hard disk has 63 sector per track.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

  3. #3
    Join Date
    Sep 2008
    Posts
    33

    Smile

    Hi,
    Another way is to use tar as described in the first post in this how-to thread This can be used if you don't have a back up partition the same size as the original. Because of the compression your back up will take a lot less space, but it's slower than dd.
    Another possibility is rsync -avH <source> <destination>
    This does not use compression, so the destination partition should be rather bigger than your original directory.
    It may be just as easy to back up only your home directory. After all you can always download another live CD and do a fresh installation. With Linux, the price will be the same: zero . Sometimes this is easier than fixing a broken system.

  4. #4
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,984
    The other copying commands like tar, cp rsync etc are filing system-based and do not touch the boot sector which is not part of a filing system.

    The above commands will work if the original boot sector is retained can be used after the restoration. This is to say the original fining system is restored at its original location of the hard disk.

    The command dd copies the binary bits directly and hence it includes the boot sector by default.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

  5. #5
    Join Date
    Jan 2003
    Posts
    1,012
    I might add, if you are trying to back up a disk/partition with bad sectors; ddrescue would be a better choice since dd does not handle those very well.
    You can tuna piano, but you can't tune a fish.

    http://www.lunar-linux.org/
    It's worth the spin.

    http://www.pclinuxos.com/page.php?7
    Puts the rest to shame.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •