A/UX: Copy File System From One Partition to Another (9/94)


How can I copy a complete file system from one disk partition to another?

You have three options: dd, dump.bsd and cpio (pax MAY work but tar won't since it won't handle special-type files). If the two partitions are the same size, you can use 'dd' (to copy c0d0s0 to c5d0s3, e.g.):

$ dd < /dev/rdsk/c0d0s0 > /dev/rdsk/c5d0s3

To use dump.bsd, you can use the following command (this assumes that the destination disk in mounted on /mnt and you want to copy the root file system which is on SCSI 0... of course, you must be root and it would be MUCH better to do this in single-user mode):

$ dump.bsd 0f - /dev/rdsk/c0d0s0 | (cd /mnt; restore xf -)

To use cpio, you must use it in a pipe with find. For example, to copy /usr (let's assume it's on it's own file system) to another disk|partition (assume it's mounted on /mnt) then you can use (you can add the "-depth" flag to 'find' if you want):

$ cd /usr
$ find . -print | cpio -pdmuva /mnt

The problem with this is that if the mount point of the destination disk falls under the file system's directory you're trying to copy, you'll load up your destination disk. For example, the following would NOT work:

$ cd /
$ find . -print | cpio -pdmuva /mnt

because 'find' would see the stuff in /mnt (which you just put in there) and try to copy in back to /mnt! To way to avoid this is by adding a little filter:

$ cd /
$ find . -print | grep -v '^./mnt*' | cpio -pdmuva /mnt

If you have GNU find, then you can use it with it's '-xdev' option, which prevents find from walking through other file systems:

$ cd /
$ find . -xdev -print | cpio -pdmuva /mnt

dump.bsd creates a "truer" copy of your file system (the access and modification dates aren't mucked with... with the find/cpio pipe, at the least the directory dates are touched) but pre-3.1 versions of restore couldn't restore named pipes. These are easy to creat though using 'mknod'. The only named pipes included in the default A/UX distribution are:

/usr/lib/cron/FIFO
prw------- 1 root sys 0 Oct 18 16:08

/usr/spool/lpd/AppleTalk/pipe
prw-rw---- 1 daemon daemon 0 Oct 19 06:11


Support Information Services

Published Date: Feb 19, 2012