Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 01 Dec 2019 01:28:26 -0600
From:      Scott Bennett <bennett@sdf.org>
To:        tomek@cedro.info
Cc:        FreeBSD Questions Mailing List <freebsd-questions@freebsd.org>
Subject:   Re:  pendrive clone impossible ?
Message-ID:  <201912010728.xB17SQkC019214@sdf.org>

next in thread | raw e-mail | index | archive | help
     On Sat, 30 Nov 2019 22:08:21 +0100 Tomasz CEDRO <tomek@cedro.info>
wrote:

     I will skip past all the irrelevant blather that was posted in response
by those who, like you, ignored the error message.  I am also trimming this
response to just freebsd-questions because it is not a freebsd-usb issue and
because you should be discouraged from posting to multiple lists without a
good reason for doing so.

>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:

   [much irrelevant stuff deleted  --SB]

>
>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.

>Tomek
>
># gpart backup da0 | gpart restore -F da1
>gpart: size '17575936': Invalid argument
>
>ugen0.7: <Kingston DataTraveler 3.0> at usbus0
>umass0 on uhub0
>umass0: <Kingston DataTraveler 3.0, class 0/0, rev 3.20/1.10, addr 6> on usbus0
>umass0:  SCSI over Bulk-Only; quirks = 0x8100
>umass0:2:0: Attached to scbus2
>da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
>da0: <Kingston DataTraveler 3.0 PMAP> Removable Direct Access SPC-4 SCSI device
>da0: Serial Number BLAHBLAH
>da0: 400.000MB/s transfers
>da0: 118368MB (242417664 512 byte sectors)
>da0: quirks=0x2<NO_6_BYTE>
>
>ugen0.8: <Kingston DataTraveler 3.0> at usbus0
>umass1 on uhub0
>umass1: <Kingston DataTraveler 3.0, class 0/0, rev 3.20/1.10, addr 7> on usbus0
>umass1:  SCSI over Bulk-Only; quirks = 0x8100
>umass1:3:1: Attached to scbus3
>da1 at umass-sim1 bus 1 scbus3 target 0 lun 0
>da1: <Kingston DataTraveler 3.0 PMAP> Removable Direct Access SPC-4 SCSI device
>da1: Serial Number BLAHBLAH
>da1: 400.000MB/s transfers
>da1: 118272MB (242221056 512 byte sectors)
>da1: quirks=0x2<NO_6_BYTE>
>GEOM_PART: integrity check failed (da1, MBR)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  There is your hint, courtesy of
 |||||||||  ||||||||||||||||||||||             FreeBSD's GEOM_PART kernel class.

>
>FreeBSD 0xCFMX4 12.1-RELEASE-p1 FreeBSD 12.1-RELEASE-p1 GENERIC  amd64
>
     I'm on 11.3-STABLE, so I don't have a 12.1 man page in front of me, but
the information is most likely identical.  See the "SYSCTL VARIABLES" section
of "man 8 gpart", specifically, kern.geom.part.check_integrity and
kern.geom.part.mbr.enforce_chs.  In my /boot/loader.conf I have

kern.geom.part.check_integrity="0"
kern.geom.part.mbr.enforce_chs=0

to avoid such problems.  Apparently, by default the GEOM PART class often
dislikes the MBR alignment used by fdisk(8) and however Windows does it.
You *might* only need the second line of the above; I don't remember why
I needed both, although the volume size mismatch may require the
"check_integrity" line.  I faintly recall only needing the latter for quite
a while, but eventually had to add the other line, possibly because of some
change when moving from one major release to the next.  In any case, those
should keep your flash drive from being rejected.


                                  Scott Bennett, Comm. ASMELG, CFIAG
**********************************************************************
* Internet:   bennett at sdf.org   *xor*   bennett at freeshell.org  *
*--------------------------------------------------------------------*
* "A well regulated and disciplined militia, is at all times a good  *
* objection to the introduction of that bane of all free governments *
* -- a standing army."                                               *
*    -- Gov. John Hancock, New York Journal, 28 January 1790         *
**********************************************************************



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