Solved Trouble formatting 128Gb USB Memory as multiple partitions.

I've inserted a 128Gb USB Memory Stick and destroyed the previous formatting with
gpart destroy -F /dev/da0

I want to create 4 off 30Gb FAT32 partitions, so I then rebuilt the structure:

gpart create -s mbr /dev/da0 gpart add -s 30G -t fat32 /dev/da0 gpart add -s 30G -t fat32 /dev/da1 gpart add -s 30G -t fat32 /dev/da2 gpart add -s 30G -t fat32 /dev/da3

it now appears thus in gpart show:

root@freenas:/mnt/FreeNAS_1/home/andrew # gpart show => 40 5860533088 ada0 GPT (2.7T) 40 88 - free - (44K) 128 4194304 1 freebsd-swap (2.0G) 4194432 5856338688 2 freebsd-zfs (2.7T) 5860533120 8 - free - (4.0K) => 40 5860533088 ada1 GPT (2.7T) 40 88 - free - (44K) 128 4194304 1 freebsd-swap (2.0G) 4194432 5856338688 2 freebsd-zfs (2.7T) 5860533120 8 - free - (4.0K) => 40 5860533088 ada2 GPT (2.7T) 40 88 - free - (44K) 128 4194304 1 freebsd-swap (2.0G) 4194432 5856338688 2 freebsd-zfs (2.7T) 5860533120 8 - free - (4.0K) => 40 3907029088 ada3 GPT (1.8T) 40 1024 1 freebsd-boot (512K) 1064 3907028056 2 freebsd-zfs (1.8T) 3907029120 8 - free - (4.0K) => 63 245759937 da0 MBR (117G) 63 62914560 1 fat32 (30G) 62914623 62914560 2 fat32 (30G) 125829183 62914560 3 fat32 (30G) 188743743 56623104 4 fat32 (27G) 245366847 393153 - free - (192M)

My problem comes when I try to format as FAT32:

newfs_msdos -L FILES -F 32 /dev/da0s2

and I get:

/dev/da0s2: 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 newfs_msdos: /dev/da0s2: Input/output error

and the USB disappears from "gpart show". I have to unplug it and re-insert it. This happens with all four of the partitions, da0s1 through 4.

I suspect I'm asking the format to use parameters that are incorrect for the FAT32 and partition sizes available, but I can't see the wood for the trees. Could someone please point me in the right direction?
 
newfs_msdos -L FILES -F 32 /dev/da0s2
Please check if it is really da0s2. It might be da0p2 instead. What is called a partition in other OS can be a slice in FreeBSD. This slice can hold some partitions as da0s2a and so on. It is about the old partition scheme and the modern one.
 
Is /dev/da1 available? It should be all da0 to create the next partition at the first available offset. I may be wrong.

gpart create -s mbr /dev/da0
da0 created
gpart add -s 30G -t fat32 /dev/da0
da0s1 added
gpart add -s 30G -t fat32 /dev/da0
da0s2 added
gpart add -s 30G -t fat32 /dev/da0
da0s3 added
gpart add -s 30G -t fat32 /dev/da0
da0s4 added
 
Is /dev/da1 available?
I was just about to post the same observation, however the gpart show suggests the partitions were made on da0:
Code:
=>       63  245759937  da0  MBR  (117G)
         63   62914560    1  fat32  (30G)
   62914623   62914560    2  fat32  (30G)
  125829183   62914560    3  fat32  (30G)
  188743743   56623104    4  fat32  (27G)
  245366847     393153       - free -  (192M)
Edit: CuatroTorres has picked the fault above. Our posts (and edits) crossed.
 
Reference the da0s2 vs da0p2: the display, (shown above) doesn't indicate either? However my session log shows that the system responded to
gpart showadd -s 30G -t fat32 /dev/da0
with
da0s2 added.

But it is confusing the way the system shows the response to
gpart show
with the lack of detail.

Also when I go to delete the last partition to try using the suggested
gpart delete -i 4 /dev/da0
responds with
da0s4 deleted

so it looks like they are definitley ..s." type.

The "fat32lba" option doesn't appear to work:

Code:
root@freenas:/mnt/FreeNAS_1/home/andrew # gpart show
.
.
.

=>       63  245759937  da0  MBR  (117G)
         63   62914560    1  fat32  (30G)
   62914623   62914560    2  fat32  (30G)
  125829183   62914560    3  fat32  (30G)
  188743743   56623104    4  fat32lba  (27G)
  245366847     393153       - free -  (192M)

root@freenas:/mnt/FreeNAS_1/home/andrew # newfs_msdos -L FILES -F 32 /dev/da0s4
/dev/da0s4: 56609216 sectors in 884519 FAT32 clusters (32768 bytes/cluster)
BytesPerSec=512 SecPerClust=64 ResSectors=32 FATs=2 Media=0xf0 SecPerTrack=63 Heads=255 HiddenSecs=0 HugeSectors=56623104 FATsecs=6911 RootCluster=2 FSInfo=1 Backup=2
newfs_msdos: /dev/da0s4: Input/output error
 
I would try to delete the partition table with fdisk and create them again with this. Don't assign type, then format with newfs_msdos.
 
It's my understanding that MBR is still necessary for compatibility with older systems. All the examples I've looked at use this too. As I'm having trouble using this USB Memory in an older system, and it's the maximum disk size that seems to be one limitation, I thought MBR would be the correct route to go.

Running file -s /dev/da0s1 produces a different output for /dev/da0s3 than the others. It simple responded /dev/da0s3: data whereas the others responded /dev/da0s2: DOS/MBR boot sector, code offset 0x58+2, OEM-ID "BSD4.4 ", sectors/cluster 64, sectors/track 63, heads 255, sectors 62914560 (volumes > 32 MB), FAT (32 bit), sectors/FAT 7679, serial number 0x489412ed, label: "FILES "
Is this correct please?

Do I need to run the newfs_msdos -L FILES -F 32 /dev/da0s1 command after?
 
I can run mount -t msdosfs /dev/da0s1 /mnt apparently but there is no response from the system. What command do I use to show that it has worked please?

What I am trying to achieve is the use of a large, modern USB Memory (128GB) in a CCTV system, for offline backups. I formatted the USB in my PC (which only gave me the options of ex-FAT and NTFS), but the CCTV system didn't recognise the USB. It will recognise a 1GB USB formatted to FAT32 or NTFS. I am trying to determine the boundaries of Size and format type acceptable to the CCTV system, and hence format the 128Gb to those parameters. I suspect they'll be 32GB max and FAT32 and NTFS. At the moment I'm having difficulties just creating 32GB volumes formatted to FAT32.
 
I can run mount -t msdosfs /dev/da0s1 /mnt apparently but there is no response from the system. What command do I use to show that it has worked please?

What I am trying to achieve is the use of a large, modern USB Memory (128GB) in a CCTV system, for offline backups. I formatted the USB in my PC (which only gave me the options of ex-FAT and NTFS), but the CCTV system didn't recognise the USB. It will recognise a 1GB USB formatted to FAT32 or NTFS. I am trying to determine the boundaries of Size and format type acceptable to the CCTV system, and hence format the 128Gb to those parameters. I suspect they'll be 32GB max and FAT32 and NTFS. At the moment I'm having difficulties just creating 32GB volumes formatted to FAT32.
That probably means it has worked. Do a cd /mnt && touch testfile and then unmount the drive with umount /mnt

Then ls /mnt and see if testfile disappears.

Probably a crude way of testing, but that's how I would do it.
 
Please have a look at http://www.wonkity.com/~wblock/docs/html/disksetup.html section "The Old Standard: MBR". It
explains how to make a slice as da0s1 and how to create partition within the slice as da0s1a and so on.

But may be you want to change to GPT instead of using MBR.
This process has one major difference! It has a command which creates a partition which the previous process didn't:
Code:
root@freenas:/ # gpart show
.
.
=>       63  245759937  da0  MBR  (117G)
         63  245759937    1  fat32  (117G)

=>        0  245759937  da0s1  BSD  (117G)
          0  245759937         - free -  (117G)
I'm still working on the MBR adaption as it's all for FREEBSD......
 
Dear fixit9660,
I have tried the commands as in your first post with a 256MB USB stick. The gpart commands have been
Code:
root@thinkpad:~ # gpart add -t fat32 -s 100M /dev/da0
da0s1 added
root@thinkpad:~ # gpart add -t fat32 -s 128M /dev/da0
da0s2 added
root@thinkpad:~ # gpart show /dev/da0
=>    32  503776  da0  MBR  (246M)
      32  204800    1  fat32  (100M)
  204832  262144    2  fat32  (128M)
  466976   36832       - free -  (18M)
Formatting with FAT32 failed because of the small file system.
Code:
root@thinkpad:~ # newfs_msdos -L data -F 32 /dev/da0s1
newfs_msdos: 12785 clusters too few clusters for FAT32, need 65525
Format with FAT16 has been successful- here it shows da0s2:
Code:
root@thinkpad:~ # newfs_msdos -L data -F 16 /dev/da0s2
/dev/da0s2: 261968 sectors in 16373 FAT16 clusters (8192 bytes/cluster)
BytesPerSec=512 SecPerClust=16 ResSectors=1 FATs=2 RootDirEnts=512 Media=0xf0 FATsecs=64 SecPerTrack=32 Heads=64 HiddenSecs=0 HugeSectors=262144
Unfortunately I have no modern USB stick with bigger size as a spare part. But this short test should show that the commands in your initial post should work - if there is no difference in FAT16 on a small stick vs FAT32 on a big stick and if the stick itself is healthy.
 
Some Observations:

If you always use
gpart show -p [device]
then you always see partitions shown as (eg) da0s1 or da0p1 rather than just numbers, avoiding that confusion.

'gpart add -t fat32' creates type "!11" partitions/slices.

'gpart add -t fat32lba' creates type "!12" partitions/slices.

I've had much better 'luck' with fat32lba. It's how preformatted sticks <= 32GiB come. I think it makes a difference to how newfs_msdos works re using or not using the fat32 CHS layout.

Maximum partition size of msdosfs is 32GiB, maximum filesize is 4GiB. Less is safer.

I've had bad USB2 sticks from usually reputable outfits like Verbatim and Lexar, that just failed at odd places randomly, when used with multiple fat32 slices. fat32lba might help.

cheers, Ian
 
I can run mount -t msdosfs /dev/da0s1 /mnt apparently but there is no response from the system. What command do I use to show that it has worked please?

What I am trying to achieve is the use of a large, modern USB Memory (128GB) in a CCTV system, for offline backups. I formatted the USB in my PC (which only gave me the options of ex-FAT and NTFS), but the CCTV system didn't recognise the USB. It will recognise a 1GB USB formatted to FAT32 or NTFS. I am trying to determine the boundaries of Size and format type acceptable to the CCTV system, and hence format the 128Gb to those parameters. I suspect they'll be 32GB max and FAT32 and NTFS. At the moment I'm having difficulties just creating 32GB volumes formatted to FAT32.
Windows recognizes only first partition of removable disk. I.e. you can create one FAT32 partition (1-32GB) and one exFAT for the remaining space.
 
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.
 
Windows recognizes only first partition of removable disk. I.e. you can create one FAT32 partition (1-32GB) and one exFAT for the remaining space.

I was going to say "but the CCTV gadget probably wouldn't deal with exFAT either" - but if the CCTV filled the 32G DOS slice, its content could be copied to the larger exFAT slice and the 32G cleared ready for more?
 
Back
Top