How to automount drives with correct permissions?

I have got internal drives and I want to automatically mount when I boot into EndeavourOS.

This is what I have inside my /etc/fstab

/dev/sdb2       /mnt/Windows/   ntfs nls-utf8,umask-0000,uid-1000,gid-1000,ro 0 0
/dev/sdc2       /mnt/Large/     ntfs nls-utf8,umask-0000,uid-1000,gid-1000,ro 0 0

I can mount them fine but they are read only. not too sure why this is happening, I set umask to 0000 and I thought 0 means can do read, write and execute?

I believe ntfs is a read-only driver.

You need to to use ntfs-3g or if you are on the latest kernel you can use ntfs3

Further, you are explicitly mounting it read-only with the option ro

Lastly since you set your user account as the owner, you don’t need such a permissive umask. 022 might be a better choice

3 Likes

https://wiki.archlinux.org/title/NTFS

1 Like

I had a second drive which wasn’t mounting after a boot automatically and I followed the video below and was able to get it to work. Someone in the chat actually posted a comment with an easier solution I found much simpler.

Link: How to Auto Mount Drives in Linux on Boot - YouTube

Simpler method:

You need to install gnome disk app.

  1. After opening the application called “Disks”, select your desired drive on the left…

  2. After selecting the drive; On the right, select the correct partition on the drive you want to auto-mount.

  3. Click the check-mark to open the “Additional partition options” menu. In the menu select “Edit Mount Options”. WARNING: The options listed in this window directly edit the fstab file and should be modified with care the same as you would using the terminal.

  4. In that window, after switching off “User Session Defaults”, the only two options I changed were…

4a) Make sure “Mount at system Startup” and “Show in user Interface” are both checked. (these should be checked by default)

4b) Change the “Mount Point” to something you wish to identify the drive as… e.g /mnt/Backup

  1. It is important that you DO NOT change the drop-down option that says “Identify As”; because, whats already in the box is the partition UUID matching the drive you selected in step 1 and 2, so there should be no need to change this option.

  2. After checking the checkboxes and changing your mount point name, click “OK” and input your root pass to save the changes to fstab.

  3. Restart the system and you’re done.

3 Likes

Oh ok, thanks mate, :slight_smile:

What does it even mean, I just looked it on the Internet that is all?

If I am understanding this correctly, 022 means that other users are not allowed to write to disk?

Thanks for the link mate.

Interesting mate I could give this a try mate, but what is the application called though so I can download it from archlinux repo or AUR?

Search gnome-disk-utility, its available in repo.

1 Like

ro stands for read-only.

Yes, others users and other groups.

1 Like

https://archlinux.org/packages/extra/x86_64/gnome-disk-utility/

1 Like

If I use this method, and one day I decided to take out a non-system drive (which doesn’t have Linux installed on it) and it is set to mount from /etc/fstab then would the OS still boot up normally?

The way it currently is written in fstab, no, it would not boot normally.

However, if you add the nofail option or convert it to a systemd-automount then it would continue to boot.

1 Like

Oh

Do I litereally type nofail in the /etc/fstab in the same row as for the /dev/sdb2?

For example:

/dev/sdc2       /mnt/Large/     ntfs nls-utf8,umask-0000,uid-1000,gid-1000,ro 0 0, nofail

Also like If I converted it to a systemd-automount, is systemD easier to work with (when mounting partitions) compared to /etc/fstab?

Like this:

/dev/sdc2       /mnt/Large/     ntfs-3g nls-utf8,umask=0000,uid=1000,gid=1000,nofail 0 0

That should make it writable and not fail.

Also, when I was editing that, I noticed you used - instead of = in several places which I fixed.

1 Like

oh lol, thanks mate :slight_smile:

After the nofail, what is the 0 0 thing mean?

The first 0 tells it not to dump the filesystem. The second 0 means don’t run fsck on the filesystem at system start.

1 Like

sorry mate, I have don’t know what does dump the filesystem or don’t run fsck on filesystem at system start means? I assume that fsck checks if there are issues with the filesystem?

Yes, that is correct. In this case, I don’t think ntfs supports fsck so setting it to 0 makes sense.

I believe dump literally calls the dump command to write a copy of the entire filesystem on those that is supports. For the record, I haven’t seen this set to anything other than 0 in a very long time.

1 Like