[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: copying root partition



On Fri, 5 Jun 1998, Bob Hilliard wrote:

: Rick Macdonald <Rick_Macdonald@calgary.shaw.wave.ca> writes:
: > > I like "cp -ax" for this task, because of its shortness.
: > 
: > I told a friend to use "cp -a". I forgot about "-x", but he only has one
: > filesystem.
: > 
: > However, the copy hung on the file /proc/kmsg. Would the -x have avoided
: > this? In the end, he had to use tar.
: 
:      cp -ax would have skipped /proc completely.  Actually, your
: friend has more than one file system.  proc is a virtual file system,
: mounted on the mount point /proc.
: 
:      When you copy an entire file system with cp -ax it skips any
: separate file systems, and doesn't even copy the mount points.  So
: after copying, you have to check the directories that contained the
: mount points, and create them in the new system.  I prefer to unmount
: as many separate files systems as possible before running cp -ax.

I realise this is practically a religious debate, but I'm going to
mention this anyway.

I don't know whether `cp -ax' skips the mount point or not; I never use
cp -ax.  I use two commands found on every debian system:

`find . -xdev -print | cpio -padm /target'

This command should be executed from the source directory.  So, if you
wanted to copy the root filesystem to another partition (currently
mounted on /mnt), you would:

cd /
find . -xdev -print | cpio -padm /mnt

Works every time.  Handles device files, doesn't recurse down other
devices, but DOES copy the mount points.

I'm sure this will start a flame war; it always does.  I'm not
interested in participating, thanks.

--
Nathan Norman
MidcoNet - 410 South Phillips Avenue - Sioux Falls, SD  57104
mailto://finn@midco.net   http://www.midco.net
finger finn@kepler.midco.net for PGP Key: (0xA33B86E9)



--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: