Gpart does not see USB stick

Yes, it may be NTFS or whatever, but the filesystem on a dynamic volume, you'll need to let the OS know how to deal with it.
I don't have experience with dynamic volumes though.
It could be useful to have the output of:
Code:
# hexdump -n 2048 -C /dev/da1
 
It looks that the flash drive was created by Rufus https://rufus.akeo.ie/ (do you see akeo in the domain name?).
That guy uses his own customized MBR, here he describes it.
As per your, balanga , hexdump output, the partition table's first entry has 0xFF type (assuming that's a regular MBR with a partition table starting from 0x1BE (446)).

[EDIT] I was wrong, see below.
 
I was wrong, it does show the NTFS partiton type 0x07 (looked at a wrong address):
Code:
000001b0 20 55 53 42 2e 00 00 00 23 7b 6a 54 00 00 81 20 | USB....#{jT... |
000001c0 21 00 [b]07[/b] fe ff ff 00 08 00 00 ae 3f e1 0e 00 00 |!..........?....|
That means your NTFS partition is located at the address encoded by 0x202100 CHS address:
H=32, S=33, C=0.
 
OK, everything is clear now.
As per the partition table data:
Code:
000001c0 21 00 07 fe ff ff [b]00 08 00 00 ae 3f e1 0e[/b] 00 00
The start sector is 0x00000800=2048 and the number of sectors in the partition is 0x0EE13fAE=249642926, which gives 249642926 x 512 = 127817178112 ≈ 128GB (correct!).
Thus it's a regular NTFS partition starting from sector 2048. It is not recognized since the MBR is not standard. I don't know how to mount such a partition (using offset?). At the moment the only way I envision is to backup the original MBR and write a standard MBR to that flash drive, mount the NTFS partition, do whatever you want, then umount it and restore the original MBR:
Code:
# dd if=/dev/da1 of=org.mbr bs=446 count=1
# dd of=/dev/da1 if=standard.mbr bs=446 count=1
Most probably somebody will come up with a smarter idea how to deal with it.
 
I wish I knew the geography of hard disk that well.... :)

I'll give this a try after I copy the USB stick using dd. Where should I look for
standard.mbr
?
 
Code:
# dd if=/dev/da1 of=org.mbr bs=446 count=1
# dd of=/dev/da1 if=standard.mbr bs=446 count=1


I get
Code:
dd: /dev/da1: Invalid argument

When I first tried it on another system, it completely hung and I had to do a hard reset.
 
dd: /dev/da1: Invalid argument
That's very strange!
Regarding the MBR: I got another idea, I can provide an MBR from a bootable USB flash with Windows 7 installer, but created by a Microsoft tool. Thus yours may remain botable and become visible to FreeBSD. But if you cannot dd...
 
dd: /dev/da1: Invalid argument
OK, dd doesn't like bs=446, since the actual block size of the device is 512 (however, that's not a problem in Linux).

I've compared your MBR with one from the MS Windows 7 installer, the only difference is the following 4 bytes:
Code:
000001B0   20 55 53 42  2E 00 00 00  [b]FF 04 35 00[/b]   // your flash drive
000001B0   20 55 53 42  2E 00 00 00  [b]23 7B 6A 54[/b]   // MS installer
You can do the following:
Code:
# dd if=/dev/da1 of=org.mbr bs=512 count=1
$ cp org.mbr org.mbr.backup
$ hexedit mbr.org     # change those 4 bytes
# dd of=/dev/da1 if=org.mbr bs=512 count=1
and re-insert your flash drive.
You'll need editors/hexedit or any hex editor to replace those 4 bytes.

By the way, even with the current MBR file(1) shows the correct info, you can try:
Code:
$ file -s /dev/da1
/dev/da1: DOS/MBR boot sector; partition 1 : ID=0x7, active 0x81, start-CHS (0x0,32,33), end-CHS (0x3ff,254,63), startsector 2048, 249642926 sectors
 
OK, dd doesn't like bs=446, since the actual block size of the device is 512 (however, that's not a problem in Linux).

I've compared your MBR with one from the MS Windows 7 installer, the only difference is the following 4 bytes:
Code:
000001B0   20 55 53 42  2E 00 00 00  FF 04 35 00   // your flash drive
000001B0   20 55 53 42  2E 00 00 00  23 7B 6A 54   // MS installer
You can do the following:
Code:
# dd if=/dev/da1 of=org.mbr bs=512 count=1
$ cp org.mbr org.mbr.backup
$ hexedit mbr.org     # change those 4 bytes
# dd of=/dev/da1 if=org.mbr bs=512 count=1
and re-insert your flash drive.
You'll need editors/hexedit or any hex editor to replace those 4 bytes.

By the way, even with the current MBR file(1) shows the correct info, you can try:
Code:
$ file -s /dev/da1
/dev/da1: DOS/MBR boot sector; partition 1 : ID=0x7, active 0x81, start-CHS (0x0,32,33), end-CHS (0x3ff,254,63), startsector 2048, 249642926 sectors

Apologies for not getting back. I went on vacation before being able to try your suggestion
 
I've just found the source from which I created my 128GB Windows XP SP3 USB stick... I did a search for the label which was written when the stick was created using Rufus the label being GRTMPVOL_EN which led me here. Now I've been able to recreate the disks contents on a 1GB disk enabling me to free up the 128GB disk.

I still get the same response from gpart show ie. no sign of da0, but it does show up under camcontrol devlist as well as dmesg.

file -s /dev/da1 shows:-
Code:
/dev/da1: DOS/MBR boot sector; partition 1 : ID=0x7, active 0x81, start-CHS (0x0,32,33), end-CHS (0x7e,254,63), startsector 2048, 2044928 sectors

The MBR retrieved using dd is slightly different, but I'll change the four bytes you mentioned and see what happens... Should I then expect the drive to show up under part show?
 
Back
Top