Configure Fixed Mount Devices on Raspberry Pi OS
This page explains how to mount devices permanently on the system so they don’t have to be mounted again after each reboot.
First you need to list all disk partitions with this:
$ sudo lsblk -o UUID,NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL,MODEL
Examine the result of the command to find the drives that you wish to be mounted permanently and take note of their UUID:
UUID NAME FSTYPE SIZE MOUNTPOINT LABEL MODEL
sda 1.8T ST2000DM001-1CH164
AC78C2F378C2BAFA └─sda1 ntfs 1.8T HD2TB
sdb 4.6T ST5000DM000-1FK178
1CC4916DC4914A42 └─sdb1 ntfs 4.6T HD5TB
mmcblk0 7.5G
5DE4-665C ├─mmcblk0p1 vfat 256M /boot boot
7295bbc3-bbc2-4267-9fa0-099e10ef5bf0 └─mmcblk0p2 ext4 7.3G / rootfs
For this purpose you can also use this other command:
$ sudo blkid
Which displays similar data in a different format:
/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="5DE4-665C" TYPE="vfat" PARTUUID="ca46c13a-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="7295bbc3-bbc2-4267-9fa0-099e10ef5bf0" TYPE="ext4" PARTUUID="ca46c13a-02"
/dev/sda1: LABEL="HD2TB" UUID="AC78C2F378C2BAFA" TYPE="ntfs" PTTYPE="atari" PARTUUID="33f0f558-01"
/dev/mmcblk0: PTUUID="ca46c13a" PTTYPE="dos"
/dev/sdb1: LABEL="HD5TB" UUID="1CC4916DC4914A42" TYPE="ntfs"
In this case I’m looking for the 1.8 Terabyte NTFS drive labelled “HD2TB” so I note down its UUID, “AC78C2F378C2BAFA”.
Next, edit the /etc/fstab file:
$ sudo nano /etc/fstab
Add a line to this file for each device that needs permanent mounting, replacing ‘ntfs’ for the file system type. I am going to mount it on directory /media/USBHDD1:
UUID=AC78C2F378C2BAFA /media/USBHDD1 ntfs defaults,auto,users,rw,nofail,umask=000 0 0
Reboot the system and check if the devices have been mounted:
$ sudo reboot
Once the Pi has rebooted, check the mounted devices:
$ sudo mount
The results should display the newly added permanent mounts:
/dev/mmcblk0p2 on / type ext4 (rw,noatime)
devtmpfs on /dev type devtmpfs (rw,relatime,size=187228k,nr_inodes=46807,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,relatime)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
sunrpc on /run/rpc_pipefs type rpc_pipefs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=37,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/sda1 on /media/USBHDD1 type fuseblk (rw,nosuid,nodev,noexec,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
/dev/sdb1 on /media/USBHDD2 type fuseblk (rw,nosuid,nodev,noexec,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=44040k,mode=700,uid=1000,gid=1000)