Date: Sat, 9 Dec 2000 03:15:07 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: Matthew Thyer <Matthew.Thyer@dsto.defence.gov.au> Cc: Mike Smith <msmith@FreeBSD.ORG>, "John W. De Boskey" <jwd@bsdwins.com>, freebsd-current@FreeBSD.ORG Subject: Re: write(2) returns error saying read only filesystem when trying to write to a partition Message-ID: <Pine.BSF.4.21.0012090244260.9572-100000@besplex.bde.org> In-Reply-To: <3A3034D2.B57C2692@dsto.defence.gov.au>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 8 Dec 2000, Matthew Thyer wrote: > Mike Smith wrote: > > > The program works on Compaq True64 UNIX v 4.0d > > > It also works on Solaris 7 (only tested sparc). > > > > > > So it seems FreeBSD is broken here. > > > > FreeBSD just behaves differently. If you want to write to the whole > > disk, open the whole-disk device, not the 'c' partition. > > Thanks Mike, /dev/da18 works fine for me although I notice that > /dev/da18s1 does not. There seems to be some inconcistencies > in this area. > > Please tell me (and for the benefit of the list) as to why > I cant use /dev/da18s1c ? Because metadata (i.e,. label) write protection actually works on /dev/da18s1c. It is supposed to be possible to turn off write protection using the DIOCWLABEL ioctl, but IIRC this only works if the data written over the label area is a valid label (if there is already a label there, as there must be for /dev/da18s1c to exist), so labels can't be cleared by writing zeros to them (zeros don't give a valid label). Labels can be cleared by zeroing them using the whole-disk device. All subdevices of the device should be closed before starting, and none except the whole-disk device should be opened before finishing, to ensure that the old in-core copy of the label isn't used. Someone broke dd(1) to always turn off write protection of labels, to hack around a bug in the alpha disklabel code (someone broke the label for the whole-disk device by making it a real label to hack around a non-understood bug that is said to break sysinstall; real labels are write protected, so the whole-disk device can't be used to bypass the write protection). Since overwriting labels doesn't work quite right even when write protection is turned off, I'm not sure how the breakage helps. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0012090244260.9572-100000>