Ancestors

Toot

Written by Mongostein@lemmy.ca on 2024-12-20 at 16:35

[Help] with mounting a FAT32 formatted drive in Ubuntu

https://lemmy.ca/post/35346631

=> More informations about this toot | More toots from Mongostein@lemmy.ca

Descendants

Written by lorentz@feddit.it on 2024-12-20 at 16:56

There is no need to add a udev rule to make the device writeble by your user. If you have a full Ubuntu setup the external drive should appear in Nautilus as soon as you attach it and it can be mounted and umounted from UI.

if it doesn’t work you can add a line te /etc/fstab like

/dev/sdb1 /mnt/mydisk noauto,user,uid=yourname 0 0

duble check the man page for the right sintax (I’m going by memory), but what you are saying here is that any user can mount this device which shouldn’t be mount automatically on boot, and files there are owned by the user “yourname”

The issue with this approach is that the device name changes depending on what you have connected, Udev should also add some symlink which contains the device ID so it is more stable.

=> More informations about this toot | More toots from lorentz@feddit.it

Written by BearOfaTime@lemm.ee on 2024-12-20 at 17:46

(Just an FYI, I’m guessing autoincorrect got you).

Great notes too, good point about the device name vs device ID.

=> More informations about this toot | More toots from BearOfaTime@lemm.ee

Written by Mongostein@lemmy.ca on 2024-12-20 at 18:34

From what I understand this is a problem with FAT32 formatted drives specifically since it doesn’t use the Linux file system. Reformatting is not an option at the moment.

What this does is give my user ownership when you plug in a usb device, which allows rw.

I have it set up to mount on startup, but it mounts to root ownership. Now, I remount it and the owner becomes my user.

I honestly can’t remember what I did to make it happen, but it always mounts to /mnt/drivename

I’m using this for a Jellyfin server. Before I added this rule, I couldn’t add folders past the drive itself as a library, so I see this as progress. I just want to edit meta data now.

=> More informations about this toot | More toots from Mongostein@lemmy.ca

Written by AbidanYre@lemmy.world on 2024-12-20 at 18:43

Line the other guy said, this doesn’t seem like it should be necessary. But I haven’t had to deal with fat formatted disks in a while so who knows.

The issue you’re having is in the mode. I think you would want 0012 instead of 0022 to let your group read and write, but still not execute from that drive.

=> More informations about this toot | More toots from AbidanYre@lemmy.world

Written by lorentz@feddit.it on 2024-12-20 at 22:09

FAT32 doesn’t support unix file permission, so when you mount the disk linux has to assign a default ownership which usually is to root. And this is the issue you are facing.

You confused the disk permission with the filesystem permission. The udev rule you wrote gives you permission to write the disk (in other words, you can format it or rewrite the whole content) but doesn’t give you permission on the files stored inside because they are on a higher abstraction level.

If you use this computer in interactive mode (in other words if you usually sit in front of it and plug the disk on demand) my suggestion is to remove that line in /etc/fstab and let the ubuntu desktop environment mounting the external hard drive for the current logged in user.

If you use this computer as a server with the USB disk always connected (likely since you mention Jellyfin) you need to modify the fstab line to specify which user should get permission on the files written on the disk.

You can see the full list of options at www.kernel.org/doc/Documentation/…/vfat.txt

You either want uid=Mongostein (assuming that’s your username on your computer too) to assign to yourself the ownership of all the files, or umask=000 to give everyone all the permissions to the files and directories while ownership will remain to root. You should prefer the second option if jellifin runs as a different user, while the first one is better if there are other users on your computer which shouldn’t access your external disk.

To summarize, the line in /etc/fstab should be one of these two.

LABEL=drivename /mnt/drivename/ auto rw,user,exec,nofail,x-gvfs-show,dev,auto,uid=Mongostein 0 0

=> More informations about this toot | More toots from lorentz@feddit.it

Written by shiny_idea@aussie.zone on 2024-12-21 at 00:49

MODE=0022 sounds like user perms are different from group and other.

0022 in octal perms corresponds to u=rwx, g=rx, o=rx`.

I don’t know if udev “MODE” is the relevant thing here but you could try 0002 so the user part and group part are the same.

=> More informations about this toot | More toots from shiny_idea@aussie.zone

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113686119351936016
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
269.89816 milliseconds
Gemini-to-HTML Time
3.099008 milliseconds

This content has been proxied by September (3851b).