[TAG] 2-cent Tip: Copying a partition
Neil Youngman
ny at youngman.org.uk
Tue Mar 20 11:57:17 MSK 2007
On or around Tuesday 20 March 2007 05:19, Kapil Hari Paranjape reorganised a
bunch of electrons to form the message:
> 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.
I'm not sure what this does that wouldn't be done by 'cp -ax'?
Neil Youngman
More information about the TAG
mailing list