pendrive clone impossible ?

Gary Jennejohn gljennjohn at gmail.com
Sun Dec 1 10:28:08 UTC 2019


On Sun, 1 Dec 2019 13:14:16 +0300
Anatoly <anatoly at kazanfieldhockey.ru> wrote:

> On Sun, 1 Dec 2019 08:28:01 +0100
> Gary Jennejohn <gljennjohn at 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


More information about the freebsd-usb mailing list