-
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
-
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.
-
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.
-
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.
-
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|