Subject: Re: Copying root fs ?
To: Mike Cheponis <mac@Wireless.Com>
From: Nigel Reed <nigel@nelgin.nu>
List: netbsd-help
Date: 05/22/2001 17:44:46
What's wrong with cp -R ?

FWIW, I did a very similar dd to this the other day and something blew
away my root filesystem (and I didn't get the dd command mixed up). The
machine was running X so I couldn't check for a panic. Just make sure
you have a set of bootable floppies and then you can install your boot
blocks and recopy your FS.

The other option may be to use the raid tools to make a mirror copy
but that's beyond my knowledge.

Regards
Nigel

On Tue, May 22, 2001 at 03:06:57PM -0700, Mike Cheponis wrote:
> Filesystem  1024-blocks     Used    Avail Capacity  Mounted on
> 
> /dev/wd0a       1035333    64600   918966     6%    /
> /dev/wd0e      27405601 16165999  9869321    62%    /usr
> 
> /dev/wd1a       1035333        1   983565     0%    /r
> /dev/wd1e      41490356 15880611 23535227    40%    /mac
> 
> 
> 
> 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
> 
> But it's not.  Here's /etc/fstab:
> 
> #wd0a 30 MB disk IBM 7200 RPM
> /dev/wd0a / ffs rw 1 1
> /dev/wd0b none swap sw 0 0
> /dev/wd0e /usr ffs rw,softdep 1 2
> #wd1a 45 MB disk added 16 Apr 01; 5400 RPM
> /dev/wd1a /r ffs rw 1 1
> /dev/wd1e /mac ffs rw,softdep 1 2
> /kern /kern kernfs rw
> proc /proc procfs  rw 0 0
> 
> 
> 
> # cd /r
> # echo > foo
> # ls -l
> total 1
> 3 -rw-r--r--  1 root  wheel  1 May 22 14:36 foo
> 
> So clearly the filesystem -is- writeable.
> 
> 
> If I umount /r then try the "dd" again, I get the same error:
> 
> # dd if=/dev/rwd0a of=/dev/rwd1a                                                      /
> dd: /dev/rwd1a: Read-only file system
> 2+0 records in
> 1+0 records out
> 512 bytes transferred in 1 secs (512 bytes/sec)
> 
> Trying the destination as /dev/wd1a yields:
> 
> # dd if=/dev/rwd0a of=/dev/wd1a
> dd: /dev/wd1a: Read-only file system
> 16+0 records in
> 15+0 records out
> 7680 bytes transferred in 1 secs (7680 bytes/sec)
> 
> 
> This is probably simple to do, but unix has managed to confuse me once again!
> (When the Principle of Least Astonishment fails, what can you do?)
> 
> Thanks for any help, -Mike
> 

--