Mount a USB drive persistently for all users
Table of Contents
I need to persistently permit all users read/write access to a USB drive
Create a mount point
mkdir /mnt/usb500List devices
lsblk -o NAME,FSTYPE,LABELNAME FSTYPE LABEL
sda
└─sda1 ext4 usb500gb
mmcblk0
├─mmcblk0p1 vfat boot
└─mmcblk0p2 ext4 rootfsBackup & print current fstab
cp /etc/fstab ~/fstab.bak
cat /etc/fstabproc /proc proc defaults 0 0
PARTUUID=45eaad39-01 /boot vfat defaults 0 2
PARTUUID=45eaad39-02 / ext4 defaults,noatime 0 1Add the device to fstab
Hint: nofail do not report errors for this device if it does not exist. You
may boot without the drive.
echo "\n/dev/sda1 /mnt/usb500 ext4 user,rw,nofail" >> /etc/fstabChange device’s permission
mount -a
sudo chmod 777 /mnt/usb500/Test
Reboot
sudo rebootWrite into a temporary file
cd /mnt/usb500/
echo 'foo' > bar.txt
cat bar.txt
rm bar.txtfooCleanup
After you thoroughly tested everything remove leftovers
rm ~/fstab.bakTroubleshooting
You attached the drive after booting
sudo mount -a