Date: Wed, 12 Jan 2022 02:44:23 +0100 From: Tomasz CEDRO <tomek@cedro.info> To: "Greg 'groggy' Lehey" <grog@freebsd.org> Cc: Roderick <hruodr@gmail.com>, FreeBSD Questions List <questions@freebsd.org> Subject: Re: dd and mbr Message-ID: <CAM8r67A9C1DLGRS22=T8QdqV3S-05oyzR3Su%2BoPe-wsr=_2=qg@mail.gmail.com> In-Reply-To: <20220112010402.GG61872@eureka.lemis.com> References: <4af920fc-eff1-a92e-d36e-1ba97079864c@gmail.com> <CAM8r67By518wp_1p9%2BJ5p7CE6Zj1M97Rm%2BaA-CSA-qtSVgyidw@mail.gmail.com> <20220112010402.GG61872@eureka.lemis.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 12, 2022 at 2:04 AM Greg 'groggy' Lehey wrote: > > On Tuesday, 11 January 2022 at 15:04:33 +0100, Tomasz CEDRO wrote: > > On Tue, Jan 11, 2022 at 11:05 AM Roderick 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: > > I'll address these issues at the bottom of this reply. > > >> (1) What does this command do? > >> (2) How to delete the mbr with dd? How to address the whole disk with dd? > >> In OpenBSD is simply > >> dd if=/dev/zero of=/dev/rsd0c > >> with perhaps a count argument. > >> Rod. > > > > There seems to be a tricky sysctl introduced some time ago that > > prevents some operations on mbr.. I got into that issuse some time ago > > but don't remember details sorry.. > > Thanks. Yes, this is what I recall too. > (..) > The background: FreeBSD has been through many iterations of disk > labeling. Once there was a program called disklabel(8) which laid out > the partition table. It was a real pain, and since then it has > morphed into bsdlabel(8), still a pain. And since then we have GPT > partition tables, which are the most modern iteration. But on the way > there have been many mechanisms to protect the first sector on the > disk from accidental overwriting, and the current one is to set > kern.geom.debugflags. It's not really intended for end users, which > is no excuse for not being documented more prominently. > > > I also do not like that FreeBSD system hides something from me like > > Linux then requires searching for a magic solution.. I would prefer > > to stay OpenBSD way you presented :-( > > I don't think that any of these are good solutions. > > Back to Rod: > > Where did you get the dd approach? As others have said, at the very > least you should have limited the length, otherwise you would > overwrite the entire disk, one sector at a time. Thanks Greg :-) That was exactly my case, "I just wanted to dd one disk to another byte-to-byte"^TM no partitions play no data play just raw copy from slower bootable (both mbr+uefi) pendrive to faster bootable pendrive.. and then surprise surprise it turned out that new disk did not have the first sector copied.. this is why I do not like that approach to hide anything in the background or set some defaults that was not there before.. I asked to dd whole disk but the disk was not copied byte-to-byte.. I could not even later copy the first 512 bytes until some magic sysctl was changed :-) -- CeDeROM, SQ7MHZ, http://www.tomek.cedro.info
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAM8r67A9C1DLGRS22=T8QdqV3S-05oyzR3Su%2BoPe-wsr=_2=qg>