14

I'm new to Linux and am having problems automounting an exFat-formatted partition on a Lacie-disk in Ubuntu 16.04.

I installed exfat-fuse and exfat-utils and could then mount manually using:

sudo mount -t exfat /dev/sdb2 /media/maria/Lexfat

The exfat disk would not automount, however, so I edited /etc/fstab (not sure what the options mean, though, so perhaps the problem is there...?):

sudo nano /etc/fstab
/dev/sdb2 /media/maria/Lexfat exfat defaults,auto,umask=000,users,rw 0 0

(I tried to get an UUID using blkid, but this does not list my exfat disk)

Now, the disk is automounted when I startup Ubuntu, but owned by root user.

So I need to give password to unmount it and am not allowed to remount with GUI. I am not allowed to change ownership using chown, either.

I have transferred files from a remote server to the disk using rsync, which works fine except that I get

failed to set times-error

I'm guessing that both the mounting and rsync issues are ownership/permission problems, but I don't understand how to fix it. Any ideas, please?

d a i s y
  • 5,411
  • 9
  • 41
  • 59
swedishchef
  • 143
  • 1
  • 1
  • 4

1 Answers1

25

Automount exfat with user permissions

When specifying the auto option, the devices gets automatically mounted at boot time with root-permissions. The proper options for exfat are described in the mount.exfat manpage. Change the /etc/fstab entry to:

/dev/sdb1 /media/maria/Lexfat exfat defaults,uid=1000,gid=1000 0 0

The defaults options (rw, suid, dev, exec, auto, nouser, and async) are good enough in most cases. The proper uid and gid can be obtained by

$ id yourusername
uid=1000(yourusername) gid=1000(yourusername) groups=1000(yourusername),4(adm),24(cdrom),...

Validate the /etc/fstab entry before rebooting the system by testing the entry:

$ sudo mount /media/maria/Lexfat

If the entry is wrong of faulty in any way, the system boot will stop working and you might need to fix it with the Ubuntu live system.

chown in exfat

Regarding the chown problems and errors: exfat does not support user permissions. So using chown on a file inside exfat will always fail:

$ sudo chown root:root /media/maria/Lexfat/test.txt
chown: changing ownership of ‘test.txt’: Function not implemented

rsync into exfat

The problem with time-stamps and permissions are the same as the ownership issue: exfat does not support it. But rsync will still work, just don't use the -a option.

$ rsync -r /from/here /media/maria/Lexfat
Simon Sudler
  • 3,771
  • 3
  • 20
  • 33
  • That suggested fstab totally Bjorked my system. Thanks. – Shawn McDonald Jan 27 '23 at 00:20
  • @ShawnMcDonald I don't believe, a mount point in `/etc/fstab` is able to do that... But adding a not existing mount point to fstab will break the system boot. Adding the [`noauto`](https://askubuntu.com/questions/421585/how-can-i-prevent-auto-mounting-of-a-partition-in-fstab) option will e.g. work for usb sticks – Simon Sudler Jan 27 '23 at 08:11
  • @ShawnMcDonald The same thing happened to me when I had an drive failure. I learned the hard way that any additional drives I mount all need the "nofail" attribute added to the entry so there is "no failure due to error on boot" - https://man.archlinux.org/man/fstab.5#DESCRIPTION. I do this for all USB external drives. – Ron K. Jan 28 '23 at 19:00
  • @SimonSudler I used to have issues with rsync to EXFAT drives, so used different switches to overcome the Linux to EXFAT permissions and groups issue: rsync -vrltD --progress --stats /source/a/ /dest/a https://www.scivision.dev/rsync-to-exfat-drive/ Couple that with the UID and GID entries for accessing the drive and it's win win. "UUID=EAEB-D1B6 /mnt/mybook exfat defaults,uid=1000,gid=1000,umask=002,nofail 0 2" 6TB running on a raspberry pi 4 – Ron K. Jan 28 '23 at 19:07