Subject: Copying root fs ?
To: None <netbsd-help@netbsd.org>
From: Mike Cheponis <mac@Wireless.Com>
List: netbsd-help
Date: 05/22/2001 15:06:57
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