Skip to contentSkip to conversation

copying file systems ...

DISCUSSION Jamie Risk 2 participants 2 messages Jan 29, 2003 – Jan 30, 2003

lore
Share & tools
lore

Jamie Risk

author
#0 lore raw

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')

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#1 lore raw
Quoted 17 lines · Jamie Risk

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
Quoted 7 lines

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 -