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

Copying a system (Was Re: Directory permissions.)

On Tue, 29 Apr 1997 Nathan E Norman <nnorman@cfni.com> wrote:

> Using the correct tools is important.  David gives you one such tool - I
> personally type the following command in the directory I wish to copy:
> "find . -print | cpio -p /target".  This is of course a simplification;
> find and cpio have a lot of powerful options, and people will argue the 
> merits of tar vs. cpio all day.  It works for me.  At any rate, mc is not
> up to the task.

     I use a modification of this command that was once recommended on
one of the comp.os.linux.* newsgroups:
      find <old_path> -depth -print0|cpio -pdm0 <new_path>

     The '-m' option preserves file modification times, which is nice.
I don't know how important the other options are, but they work for me.
Similarly, I don't think the -depth option for find is needed, but I
still use it because that is what was recommended.

     If you copying an entire file system you would cd to root before
giving 'find .'.  If the file system is mounted du /proc returns zero,
since /proc is a pseudo file system that (I believe) references
various segments of the kernel image, but find/cpio copies at least
30 MB of the kernel image into /proc on the new system, which isn't

     Another problem with issuing this command from a mounted
filesystem is that it will recursively copy /mnt (or whatever node the
system is being copied to), which will soon fill your disk.  If your
old system is on one partition, this can be prevented using the -mount
or -xdev options to find.

     To avoid copying some directories, such as /proc or /mnt, there
is a -prune option to find (you can't use -depth with -prune), but I
haven't been able to make it work.  Instead of using '.' for 'old
path', you can include each directory under / manually.  This is a
little tedious to type in, but works well.

     If you have a rescue partition the simplest system is to boot the
rescue partition, mount the old filesystem on one mount point and the
new file system on another mount point, and give the command:
      find <old-mount-point> -depth -print0|cpio -pdm0 <new-mount-point>
If the old file system is on several partitions, some creative
modifications are necessary.


TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .

Reply to: