Linux

Mounting USB exfat drive on Ubuntu


If you run ubuntu in command line, you can’t just plug in a usb stick and have a folder magically pop up like when you are running the GUI. Here is how I handle removable drives that transition between different OSes.

What is exFAT?

https://en.wikipedia.org/wiki/ExFAT

Created by Microsoft in 2006 as an improvement to FAT32 limitations (mostly 4gb file limit) for use on flash drives. It was adopted as a standard format by SD Association for SDXC cards over 32GB. For example, if you use a digital camera and select format card, it is probably using exFAT.

I like this format because it has the best windows, mac, linux cross support. If you need a drive that can easily transition data between all three, exfat is your best bet. Mac and Windows have out of box support and Linux is dependent on your distro but an easy install if it doesn’t have it.


Some Linux systems do not include it by default but a simple command to your package manager can fix that.

sudo apt-get install exfat-fuse

Or if you are on Fedora, Centos, Amazon Linux, etc

sudo yum install epel-release #if you don't already have it enabled
sudo yum install exfat-utils fuse-exfat 

Mounting

To mount the removable drive on linux command line, first create a folder for the drive (often people use /mnt folder but you can use anywhere).

mkdir /mnt/usb-backup-drive

Next we need to find where the removable drive is with list block command.

lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0         7:0    0  54.9M  1 loop /snap/lxd/12631

sda           8:0    0   2.7T  0 disk
├─sda1        8:1    0   2.7T  0 part
└─sda9        8:9    0     8M  0 part

sdd           8:48   0   3.7T  0 disk
├─sdd1        8:49   0   200M  0 part
└─sdd2        8:50   0   3.7T  0 part

nvme0n1     259:0    0 232.9G  0 disk
├─nvme0n1p1 259:1    0   512M  0 part /boot/efi
└─nvme0n1p2 259:2    0 232.4G  0 part /

From the list above, the usb drive attached is a 4TB drive, so it is the /dev/sdd device. It has two partitions on it, and we want the larger 3.7Tb one, so we will want to access /dev/sdd2 in the mount command

sudo mount /dev/sdd2 /mnt/usb-backup-drive

Unmounting

To disconnect the drive safely, call the unmount command pointing to the directory it is mounted.

sudo unmount /mnt/usb-backup-drive

Bonus: Veracrypt

Now, what if you want to encrypt that drive? I think veracrypt is one of your best cross platform options for mac, windows and linux.

To mount a veracrypt volume, just type veracrypt with the filename you want to mount, it will guide you through the rest of the mounting process. Make sure to create the folder that the mounted volume will bind to before you run this command or it will fail.

veracrypt <filename>
 Enter mount directory [default]: /mnt/encrypted-backup-drive
 Enter password for /mnt/usb-backup-drive/veracrypt-file:
 Enter PIM for /mnt/usb-backup-drive/veracrypt-file:
 Enter keyfile [none]:
 Protect hidden volume (if any)? (y=Yes/n=No) [No]:
 Enter your user password or administrator password: 
openanalytics 1607 views

I'm a 35 year old UIUC Computer Engineer building mobile apps, websites and hardware integrations with an interest in 3D printing, biotechnology and Arduinos.


View Comments
There are currently no comments.

This site uses Akismet to reduce spam. Learn how your comment data is processed.