[CentOS] Transferring system to new drive

Tue Sep 14 13:11:44 UTC 2010
John R Pierce <pierce at hogranch.com>

  On 09/14/10 5:54 AM, Timothy Murphy wrote:
> John R Pierce 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 generally use dump ... | restore ...     to clone a complete e2fs/e3fs
>> volume.  it copies everything exactly on an inode by inode basis.
> Thanks for the suggestion.
> Could you give a concrete command for copying /
> to say a new filesystem on /mnt/hd ?
>
> (I'm wondering how this approach deals with symbolic links,
> /dev , /proc , etc
>

it handles symlinks, hardlinks, etc all perfectly, as the copy is inode 
by inode rather than file by file..
do note, /dev and /proc are special file systems, and not normal disk 
storage, so they aren't even in your root fs.

k, lets see.  dump is best run on unmounted file systems, or in single 
user mode to dump /
restore wants to write to a fresh file system thats been mkfs and mounted.

so, to copy one filesystem from /dev/sda1 to the new volume in /mnt/hd, 
try...

     dump 0uf - /dev/sda1 | (cd /mnt/hd; restore rvf - )

if you have more file systems, for instance, /dev/sda3 is /var, 
something like...

     mkfs -j /dev/sdb3 && mount /dev/sdb3 /mnt/hd/var
     dump 0uf - /dev/sda3 | (cd /mnt/hd/var; restore rvf -)