[CentOS] Replacing a hard drive

John Summerfield debian at herakles.homelinux.org
Wed Mar 14 21:36:04 UTC 2007

Bowie Bailey wrote:
> I have a CentOS 4.4 system where all of the main filesystems are on a
> single hard drive.  This drive is starting to give some errors, so I got
> a new (larger) drive to replace it with.  What is the easiest way to
> copy my filesystems over to the new drive?
> I considered using dd, but I lose the extra capacity of the new drive
> that way.

Not necessarily.

> I tried using SystemImager, but it is giving me some errors.
> I think the easiest way may be to boot from the LiveCD, recreate the
> partitions, copy the info with rsync and then fix the boot partition and
> grub.  Any tips or pointers to a good how-to?

I don't see a particular advantage to rsync for a once-off copy. My 
perennial favourite is
tar clC / ... | tar xpC ....

Insert ssh if you need to copy system to system. insert buffer into the 
chain if you have it. Use compression if you're copying over a slow network.

btw I recently did this, and I discovered the failing drive didn't work 
at all in a USB enclosure.

I used the tar trick, it's more robust than dd when some stuff can't be 

You might want to enclose the commands:
(tar ... | tar ...) 2>&1 | tee /tmp/reportfile
because if there are lots of errors, you probably want to know there are 
lots of errors and be able to inspect them later.

We lost stuff - stuff like the squid cache, some mirrored Linux - stuff 
that was fairly easy to ignore/recreate.

> --
> Bowie
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos



-- spambait
1aaaaaaa at coco.merseine.nu  Z1aaaaaaa at coco.merseine.nu

Please do not reply off-list

More information about the CentOS mailing list