Other How to format external SSD with GPT and exFAT?

I have a 2TB external SSD which I want to use for backup. I settled on exFAT because I want to have some compatibility between operating systems.

This is the output of gpart show:

Bash:
=>        34  3907029101  da0  GPT  (1.8T)
          34      262144    1  ms-reserved  (128M)
      262178        2014       - free -  (1.0M)
      264192  3906764800    2  ms-basic-data  (1.8T)
  3907028992         143       - free -  (72K)

I'm stuck halfway through the gpart commands:
- destroy the partition table: gpart destroy -F /dev/da0
- create the gpt partition table: gpart create -s gpt /dev/da0
- add the partition type, likely not the correct syntax: gpart add -t exfat /dev/da0
- fill the drive with the filesystem blocks: newfs_exfat ?? /dev/da0s2 since da0s1 is a reserved partition?

Cheers
 
I settled on exFAT because I want to have some compatibility between operating systems.
I've read that exFAT can be problematic.


[EDIT]
I just remembered, I had also recurrent data corruption on a exFAT partition (16GB) on a hard disk, created with sysutils/exfat-utils , shared between FreeBSD and Linux. Despite running exfatfsck the file system was corrupted that badly I had to recreate it several times. Ultimately I abandoned that partition. I can't tell if this was a file system problem or a hardware problem. The disk is quiet old (still using it). But after this experience I hesitate to entrust important data on exFAT.
[/EDIT]

This is the output of gpart show:

Bash:
=> 34 3907029101 da0 GPT (1.8T)
34 262144 1 ms-reserved (128M)
262178 2014 - free - (1.0M)
264192 3906764800 2 ms-basic-data (1.8T)
3907028992 143 - free - (72K)
- destroy the partition table: gpart destroy -F /dev/da0
Why are you destroying the existing partition table? Just plug in the drive and mount.exfat-fuse(8) (sysutils/fusefs-exfat).

I case the ms-basic-data partition is NTFS use sysutils/fusefs-ntfs.
 
I just remembered, I had also recurrent data corruption on a exFAT partition
Thanks for replying. I've read several threads in which people mention exFAT data corruption. Since posting this, I've read about UFS and managed to mount it read only on an older Linux machine. Will probably switch all my external USB drives to UFS.

Why are you destroying the existing partition table?
I wanted to get used to all the steps needed to format a drive. I'm not doing it that often, and wanted the complete list of steps.
 
If you're working with Windows, you can also use NTFS if you want.
This is how I prepare a USB device for NTFS directly on FreeBSD :

1) First, install :
pkg ins -y fusefs-ntfs fuse

2) Load fusefs
kldload fusefs

3) Then...
(above you have a complete example with a USB dongle I've just done)
Plug your USB device and wait a few seconds. (Mine is automatically mounting, that's why I'll need to unmount it).

Code:
root@MYHOSTNAME:~ # camcontrol devlist
<CT2000P3SSD8 P9CR30A>             at scbus0 target 0 lun 1 (pass0,nda0)
< USB DISK 2.0 PMAP>               at scbus1 target 0 lun 0 (da0,pass1)

root@MYHOSTNAME:~ # gpart destroy -F da0
gpart: Device busy

root@MYHOSTNAME:~ # umount -F /media/da*
root@MYHOSTNAME:~ # gpart destroy -F da0
da0 destroyed

root@MYHOSTNAME:~ # gpart create -s GPT da0
da0 created

root@MYHOSTNAME:~ # gpart add -t ms-basic-data da0
da0p1 added

root@MYHOSTNAME:~ # chmod 760 /dev/da0p1

root@MYHOSTNAME:~ # exit

USER@MYHOSTNAME:~/Desktop $ export NTFS_USE_UBLIO=0

USER@MYHOSTNAME:~/Desktop $ mkntfs -vFQ /dev/da0p1
The partition start sector was not specified for /dev/da0p1 and it could not be obtained automatically.  It has been set to 0.
The number of sectors per track was not specified for /dev/da0p1 and it could not be obtained automatically.  It has been set to 0.
The number of heads was not specified for /dev/da0p1 and it could not be obtained automatically.  It has been set to 0.
Cluster size has been automatically set to 4096 bytes.
To boot from a device, Windows needs the 'partition start sector', the 'sectors per track' and the 'number of heads' to be set.
Windows will not be able to boot from this device.
Creating NTFS volume structures.
Creating root directory (mft record 5)
Creating $MFT (mft record 0)
Creating $MFTMirr (mft record 1)
Creating $LogFile (mft record 2)
Creating $AttrDef (mft record 4)
Creating $Bitmap (mft record 6)
Creating $Boot (mft record 7)
Creating backup boot sector.
Creating $Volume (mft record 3)
Creating $BadClus (mft record 8)
Creating $Secure (mft record 9)
Creating $UpCase (mft record 0xa)
Creating $Extend (mft record 11)
Creating system file (mft record 0xc)
Creating system file (mft record 0xd)
Creating system file (mft record 0xe)
Creating system file (mft record 0xf)
Creating $Quota (mft record 24)
Creating $ObjId (mft record 25)
Creating $Reparse (mft record 26)
Syncing root directory index record.
Syncing $Bitmap.
Syncing $MFT.
Updating $MFTMirr.
Syncing device.
mkntfs completed successfully. Have a nice day.

USER@MYHOSTNAME:~/Desktop $

You will notice that I switched back to my USER for the 2 last commands.. You need to do the same.

Then just mount... and copy what you want.
 
Last edited:
I've read that exFAT can be problematic.
...
I had also recurrent data corruption on a exFAT partition (16GB) on a hard disk, created with sysutils/exfat-utils , shared between FreeBSD and Linux.

New York Public Library Digital Preservation Program at
https://nypl.github.io/digpres/posts/file-systems#exfat-is-an-industry-standard says
exFAT is an Industry Standard
The default file system for all SD cards larger than 32 GB is exFAT.
exFAT has proved to be the most reliable solution in our work.

So I was hoping exFAT would be a simple reliable cross-platform format
for USB flash drives and other portable disks (for casual use, not backups).

But it's been in the Linux kernel since 5.4 (5 years ago),
and here's a recent discussion that says nothing good about it:

It looks like a reliable fully-cross-platform disk format does not exist yet.

For backups I use a ZFS mirror, as only Linux or FreeBSD need to access it.

My Windows is in a VM, and directly uses shared folders
which are on ZFS on the *nix host.
VirtualBox translates reliably between host and guest,
and the OP's need never exists with this setup.
 
Back
Top