[CentOS] Transferring system to new drive

Tue Sep 14 13:08:13 UTC 2010
Les Mikesell <lesmikesell at gmail.com>

On 9/14/10 7: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

If you want an exact copy and are going to the same sized drive or larger, one 
of the handiest ways is to boot a clonezilla-live cd and let it do a disk-disk 
copy.  It knows enough about most file systems to only copy the used disk blocks 
but otherwise it is an exact image copy.

Otherwise, 'rsync --one-file-system -aH  source target' will work and will pick 
up where it left off it you stop and restart.  I usually cd into the source 
directory and use '.' as the source to avoid having to remember whether the 
directory name will be created on the target or not.   /dev and /proc are mount 
points best skipped with the --one-file-system option.

-- 
   Les Mikesell
    lesmikesell at gmail.com