Re: disk cloning with dd
On Fri, May 06, 2005 at 04:07:17PM +0300, Alphonse Ogulla wrote:
> Hi all,
> Can I simply use dd to clone my failing hard disk (hda) onto another
> (hdb) of the same size as follows:
>
> # dd if=/dev/hda of=/dev/hdb bs=512
I'd prefer to go another route, any of which would require first
creating your partitions on the new HD, but I think any of these might
produce a more satisfactory result.
1. I believe I've seen it recommended on this list that you can use "cp"
with appropriate options.
2. You could probably do this with "rsync"
3. Personally, I've used tar to recreate the partitions. I'm doing
this off the top of my head, so it may not be perfect, but the way to
do this would be to first create the partition on the new HD. mount
this partition on, say, "/mnt". To duplicate /home, for instance,
I'd "cd /home", then issue the command
tar --one-file-system -cf - . | tar -C /mnt -xf -
(I think this is correct).
note that with the --one-file-system option, any partitions mounted
under the current structure won't be copied in this pass. You will
have to repeat this process for each partition you need to copy
unless you wanted to get crafty and perhaps set up a mount system
within the "/mnt" structure which duplicates your current system.
After a quick "cp --help", I see that it, too has a --one-file-system
option, so no doubt you could use an identical strategy using "cp" as
with "tar".
4. One other option comes to mind. If time is not of ultimate essence,
you might want to consider backing up all personal (non-system) files
you wish to keep and then do a re-install. I know this sounds
Windows-ish, but this way, you could insure that you do, indeed have
a fresh install and none of the system files would be corrupted in
the event that you had bad blocks containing any of these files on
your old HD.
Reply to: