Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Feb 1997 16:44:44 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        hackers@FreeBSD.ORG, rhh@ct.picker.com
Subject:   Re: dd of=/dev/rwd1s2 -- How?
Message-ID:  <199702240544.QAA24231@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>     # dd if=img of=/dev/rwd1s2
>
>gives me:
>
>     dd: /dev/rwd1s2: Read-only file system
>     2+0 records in
>     1+0 records out
>     512 bytes transferred in 0.063062 secs (8119 bytes/sec)
>
>
>How do I write a saved slice image directly on top of a slice?  Is there a
>way get a writable raw slice device?

Remove the BSD label from the slice.  This isn't easy.  IIRC, the easiest
way is to corrupt the label by writing to it via /dev/rwd1.  This exploits
a bug in the write protection.

It should be possible to use disklabel -N to disable the write protection,
but this has been broken for a long time.  First, the write protection bit
is forgotten when all devices on the disk are closed.  Second, there is
effectively another layer of write protection that isn't controlled by
disklabel -N (writes to the label are trapped and ones that would corrupt
the label are rejected.  Ones that invalidate the magic number probably
should be allowed if the label isn't write protected).

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702240544.QAA24231>