5

I have an Ubuntu 14.04 based Media Center and I store the media files on a USB HDD. I add files to drive directly on a Mac so I have it formatted as FAT32.

The problem is that after reconnecting the drive to the Ubuntu, it mounts at /media/user/drivename and only the root user is allowed access. I need several applications to have full access to this drive. I can change file permissions in the terminal but it doesn't change because of the /media/user location. I am able to manually sudo mount /dev/sdc1 /media/drivename & sudo chmod 777 /media/drivename but the mount point changes each time.

Is there a way to make this drive always mount where root and other applications have access?

2
  • 1
    Connect the USB disk, and so sudo blkid. It should give you the UUIDs of all the partitions. From there we can build a correct entry for /etc/fstab. Edit the question to add the output. – muru Aug 24 '14 at 21:39
  • Found the UUID but not exactly sure how to build the correct fstab entry – oneaustin Aug 24 '14 at 21:50
2

Since you have the UUID, you can edit /etc/fstab and add an entry like so:

UUID=<the UUID> /media/drivename vfat rw,nofail,umask=022,uid=<UID>,gid=<GID> 0 0

Replace <UID> and <GID> with the output of id -u and id -g respectively.

Explanation:

  1. We need the UUID since the drive is a removable one, and we can't rely on /dev/sdXY as an identifier.
  2. vfat is the mount type for FAT32 systems
  3. The nofail option should prevent mount from complaining, or your boot from being held up, if the disk is not present.
  4. The uid=<UID>,gid=<GID> options set the ownership of all files and folders in the mounted disk, since FAT32 doesn't have a Unix-like permission/ownership structure. This doesn't affect the files themselves, only the mounted representation. Ditto for the umask.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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