I had external USB harddrive that attached to raspberry-pi, linux desktop, windows, macOS and the only one FS that supported by these three system is exFAT. exFAT introduces by microsoft at 2006, to optimize storage by flash drive memories, but now adays exfat already become default when formating any kind USB drive either spining backed or flash backed.

Now let's begin:

  1. Install exfat-progs package
    $ sudo apt install exfat-progs
  2. Run blkid
    $ sudo blkid

    blkid will show all your devices, becarefull to identify the disk you want to format

  3. Format the identified disk to exfat
    $ sudo mkfs.exfat -L "some-label-name" /dev/sdX

    /dev/sdX is your identified disk, assuming the disk is /dev/sda, then use /dev/sda for a whole disk, /dev/sda1 for the partition.

  4. Identify the disk again by using blkid
    $ sudo blkid

    Write up the UUID

    We may notice that UUID on exFAT formatted disk is pretty short only 8 characters, compared to another UUID disk that usually got 32 characters. But its fine, no broken.

  5. Create directory that we want to mount the disk
    $ sudo mkdir /mnt/storage

    You can use any name you want for the directory name

  6. Add a line to fstab for mount the external storage automatically
    $ sudo nano /etc/fstab
    UUID=####-####      /mnt/storage       exfat   defaults,uid=1000,gid=1000    0       0

    Change the uid and gid to your desired one, dependss on the application or the user need to use the disk, uid and gid number may different. UUID set to UUID number we idenfitied at step 4

  7. Now we mount the disk
    $ sudo mount -a;

    mount -a; will read the /etc/fstab looking info for the disk that need to be mounted.

Then how about the automount? The line we added to /etc/fstab will read everytime system starting up, and it will mounted without user interaction, like steps 7.

Previous Post Next Post

Add a comment