Quote:
Originally Posted by chris319
Maybe this: copy one partition at a time to account for the different drive geometries?
Code:
# dd if=/dev/sda1 of=/dev/sdb1 bs=512 conv=noerror,sync
|
Well, if the disk partitioning is different on the backup drive then you are not going to easily be able to create a directly bootable clone of the first drive. A clone is a clone, whereas file backups to a different filesystem is something else again.
I think that you are somewhat trapped between wanting to do things as you have in the past...
Quote:
Originally Posted by chris319
For years I've been cloning one disk to another. It takes about 20 minutes, just one program to run, no scripts to write, no thought required. The backups made this way have served me well in the event of HD crashes or in case I need to retrieve a file I messed up. The backups boot right up, no problem. It gets the job done. Nothing could be simpler.
|
...i.e. what I will call the window$ way (maybe not an entirely accurate analogy), a bootable bit image clone, and the more Unix-ish incremental file backups using rsync recommended by myself and many others here.
So perhaps you should pause and consider first whether your goal really is to have a bootable clone, or if efficient data backups is in the picture.
If you want a bootable clone then you should explicitly adopt the clone terminology. A clone can be used as a backup, but in the Unix/GNU/Linux sphere the term
backup generally has a much different meaning. For a clone
dd is definitely the way to go, but you need to forget about having different disk partitioning schemes - that would make it not-a-clone.
So for bootable clone, boot to a USB or DVD drive (i.e. not the drive you are cloning from or to), then...
Code:
dd if=/dev/sda of=/dev/sdb [options...]
Then if sda fails you just plug in sdb and boot...
If you want a clone AND a different partition scheme then forget about making it bootable. Instead, create a single partition on the backup drive big enough to hold the full source drive and use dd to clone to a file. Then if the source fails you can restore from the file to a replacement drive, then boot. You can also use compression to reduce the required storage on the backup as well. Something like this (/dev/sdb1 is formatted target partition)...
Code:
mount /dev/sdb1 destination
dd if=/dev/sda | gzip -1 - | dd of=destination/sda.img.gz
Then, if you have to restore...
connect new drive as /dev/sda and verify!
mount /dev/sdb1 source
dd if=source/sda.img.gz | gunzip -1 - | dd of=/dev/sda
This has the extra step of restoring from disk image first, but that image is stored as a file allowing the second disk to have other partition schemes.
Finally, and to restate my original post in this thread, if you want easy, incremental filesystem backups, as opposed to a disk clone, learn and use rsync.
That is really a fundamental difference between window$ thinking and Unix/GNU/Linux thinking, the difference between clone and backup. Which is not to say you should not clone the disk under Linux, no flames intended, but it is a difference in thinking that results from the fundamental difference in methods and approach.