Re: dd and mbr

From: Roderick <hruodr_at_gmail.com>
Date: Tue, 11 Jan 2022 19:23:34 UTC
After zeroing with FreeBSD, FreeBSD shows a BSD slice, but OpenBSD
an unused slice.

The problem seems to be what fdisk shows. Not dd.

R.


On Tue, 11 Jan 2022, Roderick wrote:

>
> Zeroing makes a BSD slice?! Another experiment:
>
> -----
>
> % fdisk da0
> ******* Working on device /dev/da0 *******
> parameters extracted from in-core disklabel are:
> cylinders=810 heads=64 sectors/track=32 (2048 blks/cyl)
>
> parameters to be used for BIOS calculations are:
> cylinders=810 heads=64 sectors/track=32 (2048 blks/cyl)
>
> Media sector size is 512
> Warning: BIOS sector numbering starts with sector 1
> Information from DOS bootblock is:
> The data for partition 1 is:
> sysid 11 (0x0b),(DOS or Windows 95 with 32 bit FAT)
>    start 32, size 1658848 (809 Meg), flag 80 (active)
>        beg: cyl 0/ head 1/ sector 1;
>        end: cyl 809/ head 63/ sector 32
> The data for partition 2 is:
> <UNUSED>
> The data for partition 3 is:
> <UNUSED>
> The data for partition 4 is:
> <UNUSED>
>
> % dd if=/dev/zero of=/dev/da0 count=1
> 1+0 records in
> 1+0 records out
> 512 bytes transferred in 0.333139 secs (1537 bytes/sec)
>
> % fdisk da0
> ******* Working on device /dev/da0 *******
> parameters extracted from in-core disklabel are:
> cylinders=810 heads=64 sectors/track=32 (2048 blks/cyl)
>
> parameters to be used for BIOS calculations are:
> cylinders=810 heads=64 sectors/track=32 (2048 blks/cyl)
>
> fdisk: invalid fdisk partition table found
> Media sector size is 512
> Warning: BIOS sector numbering starts with sector 1
> Information from DOS bootblock is:
> The data for partition 1 is:
> sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
>    start 32, size 1658848 (809 Meg), flag 80 (active)
>        beg: cyl 0/ head 1/ sector 1;
>        end: cyl 809/ head 63/ sector 32
> The data for partition 2 is:
> <UNUSED>
> The data for partition 3 is:
> <UNUSED>
> The data for partition 4 is:
> <UNUSED>
> ------
>
>
>
>
>
>
>
> On Tue, 11 Jan 2022, Roderick wrote:
>
>> 
>> I did the folowing experiment.
>> 
>> (1) dd if=/dev/zero of=/dev/da0 bs=1m
>> 
>> (2) reboot the system in order to eliminate everything cached.
>> 
>> (3) following comandos:
>> 
>> % dd if=/dev/da0 count=1 | hd
>> 1+0 records in
>> 1+0 records out
>> 512 bytes transferred in 0.001911 secs (267913 bytes/sec)
>> 00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 
>> |................|
>> *
>> 00000200
>> %
>> % fdisk da0
>> ******* Working on device /dev/da0 *******
>> parameters extracted from in-core disklabel are:
>> cylinders=810 heads=64 sectors/track=32 (2048 blks/cyl)
>> 
>> parameters to be used for BIOS calculations are:
>> cylinders=810 heads=64 sectors/track=32 (2048 blks/cyl)
>> 
>> fdisk: invalid fdisk partition table found
>> Media sector size is 512
>> Warning: BIOS sector numbering starts with sector 1
>> Information from DOS bootblock is:
>> The data for partition 1 is:
>> sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
>>    start 32, size 1658848 (809 Meg), flag 80 (active)
>>        beg: cyl 0/ head 1/ sector 1;
>>        end: cyl 809/ head 63/ sector 32
>> The data for partition 2 is:
>> <UNUSED>
>> The data for partition 3 is:
>> <UNUSED>
>> The data for partition 4 is:
>> <UNUSED>
>> %
>> 
>> 
>> 
>> 
>> 
>> On Tue, 11 Jan 2022, Steve O'Hara-Smith wrote:
>> 
>>> On Tue, 11 Jan 2022 10:02:26 +0000 (UTC)
>>> Roderick <hruodr@gmail.com> wrote:
>>> 
>>>> 
>>>> The command:
>>>> 
>>>> dd if=/dev/zero of=/dev/da0
>>>> 
>>>> does not delete the mbr, I still see the partition table with
>>>> fdisk. My questions:
>>>
>>> 	It does delete the partition table, but fdisk is showing you cached
>>> data - the clue is in this bit of the output:
>>>
>>>             ******* Working on device /dev/ada0 *******
>>>             parameters extracted from in-core disklabel are:
>>>
>>> 	I thought there was a way to get fdisk to read directly but I
>>> can't find it in the man page now.
>>> 
>>> -- 
>>> Steve O'Hara-Smith <steve@sohara.org>
>>> 
>>> 
>> 
>