On Wed, 29 Jan 2003, Jamie Risk wrote: > How do I copy an entire file system, symlinks and all, to a temporarily > mounted partition? (what are the pertinent 'cp' switches?) > > I've got an extra harddrive (&PC) and I want to mirror my original system > with as little work as possible. > > I put the third harddrive in my system, and mounted it at "/mnt/new". Thus, > the mounts are: > > /dev/hda2 / ext2 > /dev/hda1 /boot ext2 > /dev/hda3 /usr ext3 > /dev/hda4 /home ext3 > /dev/hdb1 /usr/doc ext2 > /dev/hdb2 /usr/src ext2 > /dev/hdc1 /mnt/new ext2 > > Can I simply use the following command? > > [bash-2.05]# cp -r / /mnt/new > > - Jamie > p.s. (I'd then test the output using 'chroot') > I use this little thing I call tartar. Note that it will copy all of a partition if you ask it, but won't copy all of a multi-partition VFS.
mkdir /mnt/new/boot tartar /boot /mnt/new/boot and so on. Lawson ---oops---
#!/bin/bash ##copy a directory or partition tar -C "$1" -cOl . | tar -C "$2" -xpf -
