Linux
Linux

Mounting USB exfat drive on Ubuntu


If you run ubuntu in command line, it doesn’t auto mount usb devices like when you have the GUI up. 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.


Lots of 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

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

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

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

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: 

I'm a 32 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.