Date: Mon, 24 Feb 1997 06:58:18 -0500 From: Randall Hopper <rhh@ct.picker.com> To: Bruce Evans <bde@zeta.org.au> Cc: hackers@FreeBSD.ORG Subject: Re: dd of=/dev/rwd1s2 -- How? Message-ID: <19970224065818.58089@ct.picker.com> In-Reply-To: <199702240544.QAA24231@godzilla.zeta.org.au>; from Bruce Evans on Feb 02, 1997 at 04:44:44PM References: <199702240544.QAA24231@godzilla.zeta.org.au>
next in thread | previous in thread | raw e-mail | index | archive | help
Bruce Evans: |Randall Hopper: |> # dd if=img of=/dev/rwd1s2 |>gives me: |> dd: /dev/rwd1s2: Read-only file system |> |>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). I would have thought this would have been easier. I lost my root partition with 2.2-ALPHA Saturday due to it overwriting the boot record and the FreeBSD boot blocks on my root partition (wd1s3), so some piece of code got permission to do this, and given that my other partitions are fine, I wouldn't guess it was via /dev/rwd1. Trying to make it easy to recover from this bug in the future if it bites me again, I've dd'ed an image of my 2.2-GAMMA root slice made in single-user mode so I can dd it right back from the fixit disk. Would sure be nice if it were that easy. Will changing the slice type to something other than A5 with fdisk give me write access on rwd1s3 again? It would make sense -- FreeBSD magic shouldn't be checked for in a non-FreeBSD slice. Speaking of my 2.2-ALPHA corruption, I don't know if this bug has been fixed or not in 2.2-GAMMA, but is there a person I should mail a MIMEd copy of the 1st 16k or so of my corrupted image to. It looks like the corruption is limited to that section, and the content might gives some clues as to the bug at work. (I saved off the whole partition in hopes of being able to re-disklabel it, without success I'm afraid). Thanks for the info Bruce, Randall
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970224065818.58089>