2-Cent Tips
2-cent Tip: Copying a partition
Kapil Hari Paranjape [kapil at imsc.res.in]
Mon, 19 Mar 2007 22:19:34 -0700
Hello,
Here is a way to copy a partition which is mounted without copying all the other partitions that are under it.
Let /patha be the mountpoint of the partition from which you want to copy (it could even be the root path /).
Let /dev/new be the device to which you want to copy the data.
mkdir /var/tmp/src
# The bind mount is the crucial thing!
mount --bind /patha /var/tmp/src
mkdir /var/tmp/target
mount /dev/new /var/tmp/target
cd /var/tmp/src
# I find this a neat way to copy all files
# and permissions
find . | cpio -pdum /var/tmp/target
umount /dev/new
umount /var/tmp/src
rmdir /var/tmp/{src,target}
And you are done!
I hope the above commands are self-explanatory. If not, then I can
explain further.
Kapil. --
[ Thread continues here (5 messages/4.94kB) ]