[lug] Moving / partition to a new disk
D. Stimits
stimits at comcast.net
Fri Dec 10 15:30:46 MST 2004
Michael Kahn wrote:
> I did this wrong once and it cost me hours to untangle the mess.
> I am hoping that by posting first, I'll avoid a repeat.
>
> I wish to transfer an entire / directory structure from
> a partition on an old disk drive to a new partition on
> a new disk drive.
>
> The first time around, I did a cp -R * and then promptly
> erased the old partition. **BIG MISTAKE** as cp -R is
> not faithful about owners/groups/symbolic links and all
> the other "small stuff" that made the new root partition
> useless.
>
> So, what is the magical collection of command switches
> that would ensure that the copy into the new partition
> creates a faithful copy of the old partition's file
> structure? Since the new partition size will be larger than
> the old partition, I am not seeking a sector-by-sector image
> type of copy.
Using cpio means proper copy of everything, even device special files.
Never use cp for a backup. Imagine the chaos of trying to cp -a /dev/*,
and reading and copying /dev/random :P
Like this:
find /SomeSource -print -xdev | cpio -pdm SomeDestination
Doing this keeps permissions, special properties like sym links, and
device special files or other unusual setups (given to me by someone on
BLUG a long time ago I don't remember who told me about that).
D. Stimits, stimits AT comcast DOT net
More information about the LUG
mailing list