I made an entry in fstab for my USB HDD

PARTUUID=xxxyyyzzz-01 /mnt/usbstorage vfat   defaults,nofail   0   0

I made the owner of the /mnt/usbstorage to be pi (so that when i run apps as pi, there are no issues loading data to it)

pi@raspberrypi:/mnt $ ls -l
total 4
drwxrwxr-x 2 pi pi 4096 Jul 15 15:37 usbstorage

however, as soon as i mount the USB, root becomes the owner. How do i avoid this?

pi@raspberrypi:/mnt $ sudo mount -a
pi@raspberrypi:/mnt $ ls -l
total 32
drwxr-xr-x 4 root root 32768 Dec 31  1969 usbstorage

Cross posted here


1 Answer 1


For mounting a vfat file system there are particular options. You can set uid=<value> (user id) and gid=<value> (group id) in fstab so it looks like for example:

PARTUUID=xxxyyyzzz-01 /mnt/usbstorage vfat   defaults,nofail,uid=1000,gid=1000   0   0

Of course you have to use the uid and gid from your user. 1000 is that one from user pi. You can get it with id <username>.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.