[CentOS] Transferring system to new drive

Tue Sep 14 17:24:23 UTC 2010
m.roth at 5-cent.us <m.roth at 5-cent.us>

Bill Campbell wrote:
> On Tue, Sep 14, 2010, Timothy Murphy wrote:
>>
>>Is there a document with instructions for this?
>>I've had smartd warnings that a hard disk in my server is sick,
>>so I am installing a new drive (in addition to the old).
>>
>>I was thinking of copying the old root partition with
>>	sudo cp -a -P /* /mnt/hd
>>(after mounting the prospective new root partition).
>>Then I'd have to modify the new /etc/fstab .
>>
>>Is that a sensible approach?
>
> IHMO, the most sensible approach is to do a fresh install on a
> new HD.  After the install is complete, install and mount the old
> HD read-only to allow you to copy things over.

Well, yes.
>
> I just went through this process about 10 days ago when a fan
> went Tango Uniform on our mail e-mail/file server which had been
> up 1,390 days before the crash.  The old system had two

Urk! What, no kernel updates?

> partitions, one for ``/'', the other on ``/home'' making it easy
> to copy the old ``/home'' to the new one using any of a number of
> tools.  I prefer ``cd /oldhome; find . | cpio -pdum /home'' as it
> takes care of everything (of course it's important to add the
> appropriate users and groups before doing this).
>
> Using ``rsync'' would also work, but given that the initial copy
> is not likely to have anything to update, I prefer ``cpio''.
>
Does cpio do links, hard and soft? Rsync also gives nice warm fuzzies for
progress.
<snip>
      mark