Subject: Re: Copying root fs ?
To: Mike Cheponis <mac@Wireless.Com>
From: Matthias Buelow <mkb@mukappabeta.de>
List: netbsd-help
Date: 05/23/2001 14:42:57
Mike Cheponis writes:

>I'd like to copy /dev/wd0a to /dev/wd1a.  In this way, if my root fs gets clobbered
>I can always boot off the other disk.
>
>But when I try something like "dd if=/dev/rwd0a of=/dev/rwd1a" as root, it says:
>dd: /dev/rwd1a: Read-only file system

If the disks are the same, unmount /r and then write to the device.
You should not write to a mounted device, and usually cannot.

Otherwise, label, newfs (you already did these as it seems) and use
something like (cd /; pax -rwv -pe . /r) (using pax in copy-through
mode, analogous to the same functionality in cpio).  This will rebuild
an identical (not atomically of course) copy of the / filesystem on /r.
Do NOT use cp or tar.  They may have problems with device nodes,
permissions, ownership, access times, flags, setuid/gid bits, links and
all other kind of non-"regular" stuff.
Don't forget to also installboot(8) boot code for the "other" root fs.

--mkb