Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Sep 1998 02:39:38 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-fs@FreeBSD.ORG, mystify@friley-186-113.res.iastate.edu
Subject:   Re: Alleged "read-only" partition preventing ccd
Message-ID:  <199809171639.CAA20799@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>Unfortunately, when I try to dd the existing partition to the mirroring
>location (raw device to raw device) in single-user mode, dd(1) only writes
>512 bytes and then claims that the destination partition is read-only.

This is because the disk label at offset 512 is write protected.

>However, I can write a new file system to that partition, mount it, create
>files, etc.  I can even dd the character devices, but it takes about half an
>hour and then the CCD won't mount.  If it would help, I can do that to get
>the exact error message, but I do not have time right now.

Correct error handling is not possible for writes to block devices.
The i/o gets reblocked to a too-small block size of 2K (that's why block
devices are so slow).  Write errors are essentially ignored.  There is
a write error for the first 2K block and none of this block is copied.
This probably breaks mounting later.  Block devices should only be used
for mounting unless you know about problems like this and either want
them or don't care.

>Is there something that can be done to remove the read-only restriction on
>this partition?  And for that matter, how did it get there in the first
>place?

The DIOCWLABEL ioctl controls the write protection flag.

dd'ing to an unlabeled disk should work.  There is no easy way to clear a
label.  I usually use a binary editor on the whole disk device.  This
exploits brokenness of label write protection on the whole disk device.

Bruce

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-fs" in the body of the message



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