I was perplexed by your issues. So I plugged in a 128GB thumb drive:
Code:
Sep 22 07:42:09 sherman kernel: da8 at umass-sim0 bus 0 scbus13 target 0 lun 0
Sep 22 07:42:09 sherman kernel: da8: <PNY USB 3.1 FD PMAP> Removable Direct Access SPC-4 SCSI device
Sep 22 07:42:09 sherman kernel: da8: Serial Number 070009CD1DAE6B02
Sep 22 07:42:09 sherman kernel: da8: 400.000MB/s transfers
Sep 22 07:42:09 sherman kernel: da8: 118409MB (242501888 512 byte sectors)
Sep 22 07:42:09 sherman kernel: da8: quirks=0x2<NO_6_BYTE>
Then I followed your process:
Code:
[sherman.143] # gpart destroy -F /dev/da8
da8 destroyed
[sherman.144] # gpart create -s mbr /dev/da8
da8 created
[sherman.145] # gpart show /dev/da8
=> 63 242501825 da8 MBR (116G)
63 242501825 - free - (116G)
[sherman.146] # gpart add -s 30G -t fat32 /dev/da8
da8s1 added
[sherman.147] # gpart add -s 30G -t fat32 /dev/da8
da8s2 added
[sherman.148] # gpart add -s 30G -t fat32 /dev/da8
da8s3 added
[sherman.149] # gpart add -s 30G -t fat32 /dev/da8
gpart: autofill: No space left on device
[sherman.150] # gpart show /dev/da8
=> 63 242501825 da8 MBR (116G)
63 62914560 1 fat32 (30G)
62914623 62914560 2 fat32 (30G)
125829183 62914560 3 fat32 (30G)
188743743 53758145 - free - (26G)
[sherman.151] # newfs_msdos -L FILES -F 32 /dev/da8s2
/dev/da8s2: 62899136 sectors in 982799 FAT32 clusters (32768 bytes/cluster)
BytesPerSec=512 SecPerClust=64 ResSectors=32 FATs=2 Media=0xf0 SecPerTrack=63 Heads=255 HiddenSecs=0 HugeSectors=62914560 FATsecs=7679 RootCluster=2 FSInfo=1 Backup=2
Note that I added all the partitions to the same device (da8).
Apart from insufficient space to allocate 30G to the last partition (you clearly had a similar problem), everything worked.
As others have suggested, the logic of what you are doing needs to be reviewed, but technically, I think that your thumb drive is not working properly. Please show us the entries from
/var/log/messages between when you plug it in and when you create the fat32 file system.
This is what I did:
gpart destroy -F /dev/da0
dd if=/dev/zero of=/dev/da0 bs=512 count=34
dd if=/dev/zero of=/dev/da0 bs=512 seek=245759966
remove USB at 12:02:23
re-insert USB 12:03:18
gpart create -s mbr /dev/da0
gpart add -s 30G -t fat32 /dev/da0
gpart add -s 30G -t fat32 /dev/da0
gpart add -s 30G -t fat32 /dev/da0
gpart add -s 27G -t fat32 /dev/da0
newfs_msdos -L FILES -F 32 /dev/da0s1
Output of
cat /var/log/messages | grep -A 900 "12:02:23"
:
Sep 22 12:02:23 freenas ugen1.2: <vendor 0x058f USB DISK 3.2> at usbus1 (disconnected)
Sep 22 12:02:23 freenas umass0: at uhub2, port 3, addr 2 (disconnected)
Sep 22 12:02:23 freenas da0 at umass-sim0 bus 0 scbus7 target 0 lun 0
Sep 22 12:02:23 freenas da0: < USB DISK 3.2 8.01> s/n 041A0DCD detached
Sep 22 12:02:23 freenas (da0:umass-sim0:0:0:0): Periph destroyed
Sep 22 12:02:23 freenas umass0: detached
Sep 22 12:03:18 freenas ugen1.2: <vendor 0x058f USB DISK 3.2> at usbus1
Sep 22 12:03:18 freenas umass0 on uhub2
Sep 22 12:03:18 freenas umass0: <vendor 0x058f USB DISK 3.2, class 0/0, rev 2.10/0.02, addr 2> on usbus1
Sep 22 12:03:18 freenas umass0: SCSI over Bulk-Only; quirks = 0x4101
Sep 22 12:03:18 freenas umass0:7:0: Attached to scbus7
Sep 22 12:03:19 freenas (probe0:umass-sim0:0:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 10 00 00
Sep 22 12:03:19 freenas (probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error
Sep 22 12:03:19 freenas (probe0:umass-sim0:0:0:0): SCSI status: Check Condition
Sep 22 12:03:19 freenas (probe0:umass-sim0:0:0:0): SCSI sense: ILLEGAL REQUEST asc:20,0 (Invalid command operation code)
Sep 22 12:03:19 freenas (probe0:umass-sim0:0:0:0): Info: 0
Sep 22 12:03:19 freenas (probe0:umass-sim0:0:0:0): Error 22, Unretryable error
Sep 22 12:03:19 freenas da0 at umass-sim0 bus 0 scbus7 target 0 lun 0
Sep 22 12:03:19 freenas da0: < USB DISK 3.2 8.01> Removable Direct Access SPC-4 SCSI device
Sep 22 12:03:19 freenas da0: Serial Number 041A0DCD
Sep 22 12:03:19 freenas da0: 40.000MB/s transfers
Sep 22 12:03:19 freenas da0: 120000MB (245760000 512 byte sectors)
Sep 22 12:03:19 freenas da0: quirks=0x3<NO_SYNC_CACHE,NO_6_BYTE>
Sep 22 12:10:51 freenas (da0:umass-sim0:0:0:0): WRITE(10). CDB: 2a 00 00 00 11 00 00 00 01 00
Sep 22 12:10:51 freenas (da0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
Sep 22 12:10:51 freenas (da0:umass-sim0:0:0:0): Retrying command
Sep 22 12:10:56 freenas (da0:umass-sim0:0:0:0): WRITE(10). CDB: 2a 00 00 00 11 00 00 00 01 00
Sep 22 12:10:56 freenas (da0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
Sep 22 12:10:56 freenas (da0:umass-sim0:0:0:0): Retrying command
Sep 22 12:11:01 freenas (da0:umass-sim0:0:0:0): WRITE(10). CDB: 2a 00 00 00 11 00 00 00 01 00
Sep 22 12:11:01 freenas (da0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
Sep 22 12:11:01 freenas (da0:umass-sim0:0:0:0): Retrying command
Sep 22 12:11:07 freenas (da0:umass-sim0:0:0:0): WRITE(10). CDB: 2a 00 00 00 11 00 00 00 01 00
Sep 22 12:11:07 freenas (da0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
Sep 22 12:11:07 freenas (da0:umass-sim0:0:0:0): Retrying command
Sep 22 12:11:12 freenas (da0:umass-sim0:0:0:0): WRITE(10). CDB: 2a 00 00 00 11 00 00 00 01 00
Sep 22 12:11:12 freenas (da0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
Sep 22 12:11:12 freenas (da0:umass-sim0:0:0:0): Error 5, Retries exhausted
Sep 22 12:12:06 freenas (da0:umass-sim0:0:0:0): got CAM status 0x44
Sep 22 12:12:06 freenas (da0:umass-sim0:0:0:0): fatal error, failed to attach to device
Sep 22 12:12:06 freenas da0 at umass-sim0 bus 0 scbus7 target 0 lun 0
Sep 22 12:12:06 freenas da0: < USB DISK 3.2 8.01> s/n 041A0DCD detached
Sep 22 12:12:06 freenas g_access(952): provider da0 has error 6 set
Sep 22 12:12:06 freenas g_access(952): provider da0 has error 6 set
Sep 22 12:12:06 freenas g_access(952): provider da0 has error 6 set
Sep 22 12:12:06 freenas g_access(952): provider da0 has error 6 set
Sep 22 12:12:06 freenas g_access(952): provider da0 has error 6 set
Sep 22 12:12:12 freenas (da0:umass-sim0:0:0:0): Periph destroyed
The USB Memory was bought new in original packaging from a reputable online dealer a few days ago. It's a PNY Brand 128GB 3.1 Flash Drive, FD128ATT431KK-EF.
Just for info:
diskinfo -v da0
da0
512 # sectorsize
125829120000 # mediasize in bytes (117G)
245760000 # mediasize in sectors
0 # stripesize
0 # stripeoffset
15297 # Cylinders according to firmware.
255 # Heads according to firmware.
63 # Sectors according to firmware.
USB DISK 3.2 # Disk descr.
041A0DCD # Disk ident.
No # TRIM/UNMAP support
Unknown # Rotation rate in RPM
Not_Zoned # Zone Mode