How to Mount an NTFS-Formatted USB Drive at Boot on Raspberry Pi

NTFS (New Technology File System) is a file system developed by Microsoft in 1993 with Windows NT.
With this simple guide, you can automatically mount an NTFS partition, for example on an external disk, when your Raspberry Pi boots.

The first step is to check for and install any updates for the operating system using the update and upgrade commands.

sudo apt-get update && sudo apt-get upgrade -y

Next, install the NTFS-3G package, which is required to read and write NTFS partitions, with the following command:

sudo apt-get install ntfs-3g

To auto-mount an NTFS partition we will edit the /etc/fstab file, but before doing so we first need to gather some information about the partition to be “mounted” at boot.
To get this information we will use the blkid command, which displays a range of information directly in the terminal window.

sudo blkid

The first value to note is the device name (for example /dev/sdb1), and the second is the disk’s UUID (for example: c2dbc0c5-a8fc-449e-aa93-51b0b61372e8).

Now we need to create a folder where the external drive will be mounted. Personally, I recommend creating it inside the /mnt folder, but you can choose a different path. In this guide I will create a folder called “ntfs” inside the /mnt folder with the following command:

sudo mkdir /mnt/ntfs/

Once all these prerequisites are in place, we can edit the /etc/fstab file, adding the details of the NTFS-formatted disk.

sudo nano /etc/fstab

Move to the end of the file and enter the following:

/dev/sdb1 /mnt/ntfs/ ntfs nls-utf8,umask-0222,uid-1000,gid-1000,rw 0 0
UUID=c2dbc0c5-a8fc-449e-aa93-51b0b61372e8 /mnt/ntfs/ ntfs-3g async,big_writes,noatime,nodiratime,nofail,uid=1000,gid=1000,umask=007 0 0

Replace the device name (shown in red), the folder where the drive will be mounted (shown in green) and the UUID (shown in blue) with the information you obtained earlier with the blkid command.
Once you have pasted and edited the text, close the file by pressing CTRL+X, then type Y (or S, depending on your system language) and finally press ENTER to confirm.

Now all that’s left is to test that it works with the following commands:

sudo mount -a
df -h
cd /mnt/ntfs/
ls -l
touch "create test file.txt"
ls -l

If, after the last command, you can see the file “create test file.txt“, everything is working correctly, so you can restart your Raspberry Pi and check that the drive is mounted automatically at boot.

If you ever need to unmount the external drive, you can run one of the following commands:

sudo umount /mnt/ntfs
## oppure ##
sudo umount /deb/sdb1

Again, replace the parts in red with those used on your system.

Enjoy!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top