I need to make a copy of a working linux system, which (being contained in /, and the new place is prepared in /mnt/sdb5) seems to contain considerable amount of hard-, soft-links and special files in /dev; would cpio
handle this job without applying additional magic?
Currently known safeguards:
- not going to remove/modify running system until the moment the copy is considered bootable and working with
root=/dev/sdb5
; before removing, take a full partition backup. - will use cpio for archiving each root directory separately, thus will unpack it from LiveCD environment so donor partition will not be harmed
But still, not going to lose time just because cpio missed some flag and crippled the permissions/node type/soft or hardlink.
Which tool to use / which underwater rocks to avoid?
Best Answer
To answer the actual question regarding
cpio
: These are the flags I would use forcpio
:Of course, since you're not copying over the network, I would just use
cp
:And if you want to be able to do the copying several times,
rsync
is a better choice for its resuming capabilities. (It also, likecp
, handles ACLs and extended attributes and can optionally work over the network likecpio
. So it's the most useful option, except for doing the first copy locally, which I prefer to do usingcp
.)Don't Forget to copy
/boot
and/dev
!/boot
is easy, just copy it. But/dev
is much trickier nowadays since it's hidden byudev
. I recommend the following procedure:mkdir /tmp/dev
mount --move /dev /tmp/dev
/dev
to/mnt/sdb5
using one of the above commandsmount --move /tmp/dev /dev
rmdir /tmp/dev