Re: "dd if=/dev/srandom of=/dev/wd0e bs=1024 count=1" WIPES my wd0 disklabel. Is this intended, bug, how come, how workaround ??? Incl reproduction script+console output+dmesg

2015-10-08 Thread Raimo Niskanen
On Thu, Oct 08, 2015 at 12:50:59AM +0800, Mikael wrote: : > *Impression:* > Based on what Benny and I think someone else said, I got an approximative > impression something like that the whole disklabelling system is actually > designed with the intention that every disklabel is required to > >

Re: "dd if=/dev/srandom of=/dev/wd0e bs=1024 count=1" WIPES my wd0 disklabel. Is this intended, bug, how come, how workaround ??? Incl reproduction script+console output+dmesg

2015-10-07 Thread Mikael
Thanks everyone for clarifying that the sectors 0 to 79 should be considered reserved on OpenBSD MBR partitions (and thus within the context of the "disklabel" tool). There is just one thing I don't understand now, and that is what dysfunction-potential there is in inappropriate handling of

Re: "dd if=/dev/srandom of=/dev/wd0e bs=1024 count=1" WIPES my wd0 disklabel. Is this intended, bug, how come, how workaround ??? Incl reproduction script+console output+dmesg

2015-10-06 Thread Mikael
2015-10-07 1:38 GMT+08:00 Ted Unangst : > Mikael wrote: > > 2015-10-07 0:58 GMT+08:00 Ted Unangst : > > > > > > the disklabel is the second sector of the openbsd part of the disk. > > > > > > *3: A6 0 1 2 - 243200 254 63 [ 64:

Re: "dd if=/dev/srandom of=/dev/wd0e bs=1024 count=1" WIPES my wd0 disklabel. Is this intended, bug, how come, how workaround ??? Incl reproduction script+console output+dmesg

2015-10-06 Thread Mikael
Aha got it. So then I'll just learn that sector 80 and up are "safe" for "user data", and it's up to all users to take care that any non-UFS/swap/RAID partitions never go below 80. But how does the behavior of the first added partition by default overlapping the disklabel "save butts" - Does

Re: "dd if=/dev/srandom of=/dev/wd0e bs=1024 count=1" WIPES my wd0 disklabel. Is this intended, bug, how come, how workaround ??? Incl reproduction script+console output+dmesg

2015-10-06 Thread Benny Lofgren
On 2015-10-06 19:25, Mikael wrote: > So then I'll just learn that sector 80 and up are "safe" for "user data", > and it's up to all users to take care that any non-UFS/swap/RAID partitions > never go below 80. I don't think you can expect swap partitions to honour those first sectors...

Re: "dd if=/dev/srandom of=/dev/wd0e bs=1024 count=1" WIPES my wd0 disklabel. Is this intended, bug, how come, how workaround ??? Incl reproduction script+console output+dmesg

2015-10-06 Thread Brian Conway
There were also some excellent diagrams generated the last time this came up for discussion: https://marc.info/?l=openbsd-misc=141520160709490=2 FWIW. Brian

Re: "dd if=/dev/srandom of=/dev/wd0e bs=1024 count=1" WIPES my wd0 disklabel. Is this intended, bug, how come, how workaround ??? Incl reproduction script+console output+dmesg

2015-10-06 Thread Mikael
2015-10-07 1:44 GMT+08:00 Mikael : > > Ah sure. > > Perhaps I misunderstood the level of "foolproofness" that the disklabel > tool's autogenerated default value was intended to give - > > Just curious, now that structural things like this are at stake (i.e. some > user

Re: "dd if=/dev/srandom of=/dev/wd0e bs=1024 count=1" WIPES my wd0 disklabel. Is this intended, bug, how come, how workaround ??? Incl reproduction script+console output+dmesg

2015-10-06 Thread Stuart Henderson
On 2015-10-06, Theo de Raadt wrote: >> Wait, sorry - so the disklabel tool says that the c partition starts at >> offset 0 , that's logical indeed as data always starts at offset 0. >> >> By some reason, the disklabel tool however doesn't want partitions on the >> first

Re: "dd if=/dev/srandom of=/dev/wd0e bs=1024 count=1" WIPES my wd0 disklabel. Is this intended, bug, how come, how workaround ??? Incl reproduction script+console output+dmesg

2015-10-06 Thread Raul Miller
On Tue, Oct 6, 2015 at 2:48 PM, Benny Lofgren wrote: > It is well known and understood since decades what's on these first > sectors of a) a disk, b) of the BSD usable area and c) of each partition > (type). Why are you having trouble accepting that things are the way > they

Re: "dd if=/dev/srandom of=/dev/wd0e bs=1024 count=1" WIPES my wd0 disklabel. Is this intended, bug, how come, how workaround ??? Incl reproduction script+console output+dmesg

2015-10-06 Thread Theo de Raadt
>On Tue, Oct 6, 2015 at 2:48 PM, Benny Lofgren wrote: >> It is well known and understood since decades what's on these first >> sectors of a) a disk, b) of the BSD usable area and c) of each partition >> (type). I don't think (c) is something commonly known.

Re: "dd if=/dev/srandom of=/dev/wd0e bs=1024 count=1" WIPES my wd0 disklabel. Is this intended, bug, how come, how workaround ??? Incl reproduction script+console output+dmesg

2015-10-06 Thread Ted Unangst
Mikael wrote: > The script below includes extra considerations to see through any kernel > caching of the disklabel, by rebooting between every relevant step. > > "dd if=/dev/srandom of=/dev/rwd0e bs=1024 count=1" does also wipe the > disklabel. > > "dd if=/dev/srandom of=/dev/wd0a bs=1024

Re: "dd if=/dev/srandom of=/dev/wd0e bs=1024 count=1" WIPES my wd0 disklabel. Is this intended, bug, how come, how workaround ??? Incl reproduction script+console output+dmesg

2015-10-06 Thread Theo de Raadt
> > Have I (and some others) misunderstood anything about how BSD disklabelling > > works? > > the disklabel is the second sector of the openbsd part of the disk. > > *3: A6 0 1 2 - 243200 254 63 [ 64: 3907024001 ] OpenBSD > > so, if you overwrite sector 65, you will

Re: "dd if=/dev/srandom of=/dev/wd0e bs=1024 count=1" WIPES my wd0 disklabel. Is this intended, bug, how come, how workaround ??? Incl reproduction script+console output+dmesg

2015-10-06 Thread Mikael
2015-10-07 0:58 GMT+08:00 Ted Unangst : > > the disklabel is the second sector of the openbsd part of the disk. > > *3: A6 0 1 2 - 243200 254 63 [ 64: 3907024001 ] OpenBSD > > so, if you overwrite sector 65, you will overwrite disklabel. normally the > 'a'

Re: "dd if=/dev/srandom of=/dev/wd0e bs=1024 count=1" WIPES my wd0 disklabel. Is this intended, bug, how come, how workaround ??? Incl reproduction script+console output+dmesg

2015-10-06 Thread Mikael
2015-10-07 1:07 GMT+08:00 Theo de Raadt : > > > Have I (and some others) misunderstood anything about how BSD > disklabelling > > > works? > > > > the disklabel is the second sector of the openbsd part of the disk. > > > > *3: A6 0 1 2 - 243200 254 63 [

Re: "dd if=/dev/srandom of=/dev/wd0e bs=1024 count=1" WIPES my wd0 disklabel. Is this intended, bug, how come, how workaround ??? Incl reproduction script+console output+dmesg

2015-10-06 Thread Ted Unangst
Mikael wrote: > 2015-10-07 0:58 GMT+08:00 Ted Unangst : > > > > the disklabel is the second sector of the openbsd part of the disk. > > > > *3: A6 0 1 2 - 243200 254 63 [ 64: 3907024001 ] OpenBSD > > > > so, if you overwrite sector 65, you will overwrite

Re: "dd if=/dev/srandom of=/dev/wd0e bs=1024 count=1" WIPES my wd0 disklabel. Is this intended, bug, how come, how workaround ??? Incl reproduction script+console output+dmesg

2015-10-06 Thread Ted Unangst
Mikael wrote: > 2015-10-07 0:45 GMT+08:00 Ted Unangst : > > > Mikael wrote: > > > The script below includes extra considerations to see through any kernel > > > caching of the disklabel, by rebooting between every relevant step. > > > > > > "dd if=/dev/srandom of=/dev/rwd0e

Re: "dd if=/dev/srandom of=/dev/wd0e bs=1024 count=1" WIPES my wd0 disklabel. Is this intended, bug, how come, how workaround ??? Incl reproduction script+console output+dmesg

2015-10-06 Thread Theo de Raadt
> > But your fingers don't know it. > > > > > Right, time for fingers to learn. > > Will look forward to learn how it "saved many a butt" and what's the lowest > "safe" offset (..64 + 8*2 = 81+?..) (if that will actually make sense when > understanding the whole thing) through the Q:s in my last

Re: "dd if=/dev/srandom of=/dev/wd0e bs=1024 count=1" WIPES my wd0 disklabel. Is this intended, bug, how come, how workaround ??? Incl reproduction script+console output+dmesg

2015-10-06 Thread Theo de Raadt
> Wait, sorry - so the disklabel tool says that the c partition starts at > offset 0 , that's logical indeed as data always starts at offset 0. > > By some reason, the disklabel tool however doesn't want partitions on the > first 64 sectors (console dump below), i.e. on the first 32KB (why?).

Re: "dd if=/dev/srandom of=/dev/wd0e bs=1024 count=1" WIPES my wd0 disklabel. Is this intended, bug, how come, how workaround ??? Incl reproduction script+console output+dmesg

2015-10-06 Thread Mikael
2015-10-07 0:45 GMT+08:00 Ted Unangst : > Mikael wrote: > > The script below includes extra considerations to see through any kernel > > caching of the disklabel, by rebooting between every relevant step. > > > > "dd if=/dev/srandom of=/dev/rwd0e bs=1024 count=1" does also

Re: "dd if=/dev/srandom of=/dev/wd0e bs=1024 count=1" WIPES my wd0 disklabel. Is this intended, bug, how come, how workaround ??? Incl reproduction script+console output+dmesg

2015-10-06 Thread Mikael
2015-10-07 1:14 GMT+08:00 Theo de Raadt : > > > But your fingers don't know it. > > > > > > > > Right, time for fingers to learn. > > > > Will look forward to learn how it "saved many a butt" and what's the > lowest > > "safe" offset (..64 + 8*2 = 81+?..) (if that will