[geeks] Copy a linux disk

Caleb Shay caleb at webninja.com
Sat May 20 12:14:01 CDT 2006


On 5/20/06, Joshua Boyd <jdboyd at jdboyd.net> wrote:
>
> So, that raises a few questions:
> 1) Is there a better way to copy disks?  On Solaris I would
> ufsdump/ufsrestory, and likewise on Irix I would use xfsdump/xfsrestore

Depends on the filesystem.  I use XFS on Linux, so xfsdump/xfsrestore
work just fine.  Otherwise cpio/tar should work.

> 2) Is there a good way to copy /dev entries, other than by hand.

Let tar grab them for you.

> 3) How does udev effect all of this?  I thought it was automatically
> supposed to kick in the /dev entries for me.

udev doesn't start immediately since it runs in user-space (hence, the
name), so a few entries need to be there to get to that point such as
console, null, and probably a few others I'm not remembering right
now.

> 4) Is there a way to use cpio (or whatever I should be using instead)
> over a ssh tunnel?  I'm pretty sure it is possible, but I've been
> banging my head on it.  I want an image of the disk in a more powerful
> machine to use as a build system (in a chroot environment).

I don't remember the flags for cpio, but for tar you could do:

tar zcpv / | ssh user at host "cat > backup.tar.gz"

or, my preferred (since I generally work with disk images mounted via /dev/loop)

cat /dev/sda1 | gzip -1 | ssh user at host2 "gzcat > /u/disks/host1/sda1.img"

Cheers,

Caleb



More information about the geeks mailing list