Linux, fat32 and etc/fstab

I mounted a FAT32 drive onto my Linux computer using the following terminal command:

> sudo mount /dev/sdb1 /media/exampleFolderName -o dmask=000, fmask=111

I did this so I could share / edit the files over a network connection. Unfortunately Linux doesn’t support per file permissions in FAT32 format, so this sets the entire drive in the right permissions whilst it’s connected.

If I understand mount correctly, I’ll have to do this every time I plug the drive in, which I don’t want to do. I’ve heard about:

/etc/fstab

So my question – how do I turn the above mount command into an fstab entry? If anyone could also explain what dmask and fmask mean, that would be appreciated.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You probably want to add a line like

/dev/sdb1 /media/drive1 vfat dmask=000,fmask=0111,user 0 0

to /etc/fstab. The additional ,user in the options field allows any user to mount this filesystem, not just root.

Method 2

dmask and fmask is the permissions for directories and files respectively. It is an octal number. And denotes read, write and execute permissions for Owner, Group and Other users.

fstab:

/dev/sdb1 /media/exampleFolderName vfat dmask=000,fmask=111 0 0

When you say plug the drive in, an external drive e.g USB should automount.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x