pendrive clone impossible ?

2019-11-30 Thread Tomasz CEDRO
Hello world :-) I have to clone a pendrive, the same one to another almost the same (number of sectors differs a bit). The problem is that DD does not seem to do the job. It always worked for me. Also I am not really able to clone the MBR: 1. dd if=/dev/da0 of=/dev/da1 bs=512 count=1 does not cop

Re: pendrive clone impossible ?

2019-11-30 Thread Polytropon
On Sat, 30 Nov 2019 22:08:21 +0100, Tomasz CEDRO wrote: > I have to clone a pendrive, the same one to another almost the same > (number of sectors differs a bit). The problem is that DD does not > seem to do the job. It always worked for me. > > Also I am not really able to clone the MBR: > 1. dd

Re: pendrive clone impossible ?

2019-11-30 Thread Tomasz CEDRO
It looks like either GEOM is hiding something from application/me, or pendrive itself is preventing MBR to be modified, or some sort of mix..? I guess the first is more probable because DD'ing from /dev/md0, /dev/zero, /dev/random devices always works, while DD'ing from da0.mbr file never works. I

Re: pendrive clone impossible ?

2019-11-30 Thread Polytropon
On Sat, 30 Nov 2019 23:28:04 +0100, Tomasz CEDRO wrote: > It looks like either GEOM is hiding something from application/me, or > pendrive itself is preventing MBR to be modified, or some sort of > mix..? That is possible (but unlikely), and there's another (equally unlikely) possibility that your

Re: pendrive clone impossible ?

2019-11-30 Thread Tomasz CEDRO
On Sat, Nov 30, 2019 at 11:49 PM Polytropon wrote: > > On Sat, 30 Nov 2019 23:28:04 +0100, Tomasz CEDRO wrote: > > It looks like either GEOM is hiding something from application/me, or > > pendrive itself is preventing MBR to be modified, or some sort of > > mix..? > > That is possible (but unlikel

Re: pendrive clone impossible ?

2019-11-30 Thread Anatoly
On Sun, 1 Dec 2019 00:29:13 +0100 Tomasz CEDRO wrote: > but I have no more time to play, so I leave a trace if > someone meets similar issues in future :-) I've had a problem in the past with one of the first 32GB pendrives. Not quite similar problem, but may it be buggy RAM cache implementation

Re: pendrive clone impossible ?

2019-11-30 Thread Tomasz CEDRO
On Sun, Dec 1, 2019 at 3:03 AM Anatoly wrote: > I've had a problem in the past with one of the first 32GB pendrives. > Not quite similar problem, but may it be buggy RAM cache > implementation too? What if: > - Write sector(s) > - usbconfig -d . power_off > - usbconfig -d . power_on > - Read and c

Re: pendrive clone impossible ?

2019-11-30 Thread Gary Jennejohn
On Sun, 1 Dec 2019 03:52:50 +0100 Tomasz CEDRO wrote: > On Sun, Dec 1, 2019 at 3:03 AM Anatoly wrote: > > I've had a problem in the past with one of the first 32GB pendrives. > > Not quite similar problem, but may it be buggy RAM cache > > implementation too? What if: > > - Write sector(s) > > -

Re: pendrive clone impossible ?

2019-12-01 Thread Anatoly
On Sun, 1 Dec 2019 08:28:01 +0100 Gary Jennejohn 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 s

Re: pendrive clone impossible ?

2019-12-01 Thread Gary Jennejohn
On Sun, 1 Dec 2019 13:14:16 +0300 Anatoly wrote: > On Sun, 1 Dec 2019 08:28:01 +0100 > Gary Jennejohn 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 t

Re: pendrive clone impossible ?

2019-12-01 Thread Tomasz CEDRO
On Sun, Dec 1, 2019 at 8:28 AM Scott Bennett wrote: > >Does GEOM in any way prevents me from using disk that has corrupt MBR? > Yes, most likely. > > >Why I cannot write a MBR from a file but I can from a md0? > >Any hints welcome :-) > See the last line of your messages below. > (..) >

Re: pendrive clone impossible ?

2019-12-01 Thread Dr. Nikolaus Klepp
Anno domini 2019 Sun, 1 Dec 17:45:17 +0100 Tomasz CEDRO scripsit: > On Sun, Dec 1, 2019 at 8:28 AM Scott Bennett wrote: > > >Does GEOM in any way prevents me from using disk that has corrupt MBR? > > Yes, most likely. > > > > >Why I cannot write a MBR from a file but I can from a md0? > > >A

Re: pendrive clone impossible ?

2019-12-01 Thread Tomasz CEDRO
As my previous message got moderated, just a quick summary - looks like a GEOM_PART silently discards writes to MBR with a DD when it considers MBR broken (writing to the rest of the disk is possible). I have reported this as error: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242341 -- CeD

Re: pendrive clone impossible ?

2019-12-01 Thread Warner Losh
On Sun, Dec 1, 2019, 10:22 AM Tomasz CEDRO wrote: > As my previous message got moderated, just a quick summary - looks > like a GEOM_PART silently discards writes to MBR with a DD when it > considers MBR broken (writing to the rest of the disk is possible). I > have reported this as error: > I'm