Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Dec 2019 11:28:03 +0100
From:      Gary Jennejohn <gljennjohn@gmail.com>
To:        freebsd-usb@freebsd.org
Subject:   Re: pendrive clone impossible ?
Message-ID:  <20191201112803.7c7677d4@ernst.home>
In-Reply-To: <20191201131416.3a1554ec@asd2>
References:  <CAFYkXjkHobPfNwCL3ssL98TgUjE=jvojXACH%2BiR0EV-tzK-pxA@mail.gmail.com> <20191130223322.1028feab.freebsd@edvax.de> <CAFYkXjk3HOmfXkd=L2CYpbV9=YmzP_dP1RxS37D817iW_Bqftg@mail.gmail.com> <20191130234900.81464b43.freebsd@edvax.de> <CAFYkXj=8md=Lv-N9CLLZ=kU%2BaEE8VZGVu=3kQTWnvqbGi6tmQA@mail.gmail.com> <20191201050341.4a02879a@asd2> <CAFYkXj=OdpDf7hzCrYzmFMqRObdzqj=KkY863UG3nhWbnnRtKA@mail.gmail.com> <20191201082801.6a8c7639@ernst.home> <20191201131416.3a1554ec@asd2>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 1 Dec 2019 13:14:16 +0300
Anatoly <anatoly@kazanfieldhockey.ru> wrote:

> On Sun, 1 Dec 2019 08:28:01 +0100
> Gary Jennejohn <gljennjohn@gmail.com> wrote:
> 
> > The geom code protects certain parts of the data area on the
> > drive, in particular GPT/MBR areas, unless ``sysctl
> > kern.geom.debugflags=16'' is run beforehand.  One can see this in
> > many places in the geom code.
> > 
> > I always set this sysctl when I know I'm going to overwrite the
> > first sectors of a drive.
> >   
> Interesting, but I've succefully overwrited MBR many times
> on FreeBSD 5.x-11.x without setting this sysctl.
> I've learned about this sysctl when I first time failed to overwrite bsd
> label inside MBR slice under FreeBSD 7.1 with dd (but not MBR). There
> was explicit write error, not just silent succeful write to nowhere. I
> may be wrong, but as I remember, I newer got this trouble again
> starting from 10.x.
> Is there something new on 12.x?
>

This sysctl has been around for quite some time.  I added a
shellscript to my ~/bin to set it in 2015.  IIRC Julian Elischer
requested it because he had problems initializing disks.  I just
use it by default when I write to the first sectors on a disk.

There is geom code which explicitly checks whether debugflags is
set to 16.  I have not looked at the code to see what happens when
that is the case.

-- 
Gary Jennejohn



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