RSS Amplifier

Rida Ayed · Mar 28, 2020

Mount a USB drive persistently for all users

0
Sign in to vote or save

This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.

Table of Contents Create a mount point List devices Backup & print current fstab Add the device to fstab Change device’s permission Test Cleanup Troubleshooting I need to persistently permit all users read/write access to a USB drive Create a mount point mkdir /mnt/usb500 List devices lsblk -o NAME,FSTYPE,LABEL NAME FSTYPE LABEL sda └─sda1 ext4 usb500gb mmcblk0 ├─mmcblk0p1 vfat boot…

Table of Contents

I need to persistently permit all users read/write access to a USB drive

Create a mount point

mkdir /mnt/usb500

List devices

lsblk -o NAME,FSTYPE,LABEL
NAME        FSTYPE LABEL
sda
└─sda1      ext4   usb500gb
mmcblk0
├─mmcblk0p1 vfat   boot
└─mmcblk0p2 ext4   rootfs

Backup & print current fstab

cp /etc/fstab ~/fstab.bak
cat /etc/fstab
proc            /proc           proc    defaults          0       0
PARTUUID=45eaad39-01  /boot           vfat    defaults          0       2
PARTUUID=45eaad39-02  /               ext4    defaults,noatime  0       1

Add 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/fstab

Change device’s permission

mount -a
sudo chmod 777 /mnt/usb500/

Test

Reboot

sudo reboot

Write into a temporary file

cd /mnt/usb500/
echo 'foo' > bar.txt
cat bar.txt
rm bar.txt
foo

Cleanup

After you thoroughly tested everything remove leftovers

rm ~/fstab.bak

Troubleshooting

You attached the drive after booting

sudo mount -a

Read on /posts/mount_a_usb_drive_persistently_for_all_users/

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.