Help setting up a partition to mount on boot

I am trying to mount a drive on boot so i can keep games on it, but when i use something like gnome disks, it always mounts as root, so i am unable to use it without remounting it. Any help?

You should add a line to your /etc/fstab file.

Here is the procedure:
https://wiki.archlinux.org/title/Fstab

Is it a ntfs/fat32/exfat partition? If so, you need to specify the user/group as mount options.

1 Like

its a exfat partition

So you will have to add something like this to your /etc/fstab:

UUID=...   /path/to/mountpoint   auto   defaults,uid=1000,gid=1000,umask=022   0   0

Spaces are important. Fields are delimited by one or more spaces, and no field may contain a space within it.

You can discover the UUID of your drive by running

lsblk -f

It will be something like 653a35a1-545d-4eba-9b9b-11e4ed41a715.

Replace /path/to/mountpoint with the correct path to where you want to mount your drive. I usually make empty directories in my home directory, but it can be anywhere.

Instead of auto you should probably specify the proper fstype, you can find it with lstblk -f, too, just like UUID. It will probably be exfat or something like that.

Check that your UID is really 1000, as well as GID (it most probably is, but it doesn’t have to be). You can find your UID and GID by looking at the /etc/passwd file. It contains entries for every user, find the line that has:

your_username:x:number:number:...

It’s these two numbers you want, the first is UID, the second is GID. If both are not 1000, just replace the uid= and gid= in the fstab file with the numbers from your passwd file.

Leave umask as 022, unless you have a reason to use something different.

And leave 0 and 0 at the end. These are dump and fsck options.

EDIT: fixed the mistake where I’m suggesting 2 for fsck option. Apparently, it should be 0.

1 Like

Alternatively, you could set it up as a systemd mount:

Yes, that’s certainly an option, but I don’t like it. I like having everything in one fstab file, it’s transparent and easy. I feel like systemd mount is not as transparent…

But it’s a matter of personal preference, of course.

1 Like

is there anything wrong with this:
UUID=BC1F-1E8C /drive/shared exfat defaults,uid=1000,gid=1000,umask=022 0 2
when i put it in there it just freezes when i boot

Does that directory exist?

If it does, can we see the output of lsblk -o name,fstype,size,uuid

1 Like

Is the UUID correct?
Does the path /drive/shared exist? It should be an empty directory, prior to mounting the drive.
Is the fstype exfat?

Screenshot-20210902145304-518x100
i am trying to mount the partition sdb3
and yes, i made the directory /drive/shared

Try:

sudo chown 1000:1000 /drive/shared

Assuming your UID and GID are indeed 1000.

Also, have you changed any other line in your fstab file? If so, this could be the problem.

Could you share your /etc/fstab?

Also try to replace the last 2 with 0, like this:

UUID=BC1F-1E8C /drive/shared exfat defaults,uid=1000,gid=1000,umask=022 0 0

Also, you don’t need to reboot to test it, just umount and mount. When you get it to work, then reboot. It’s easier that way, rather than always getting stuck at boot.

umount /drive/shared
mount /drive/shared

Maybe add the nofail mount option. Will make things less of a faff while you get to the bottom of things.

Also, do you have the user-space exfat programme?

I don’t think that’s needed, exfat should be supported by the kernel.

1 Like

thank you, seems like changing that 2 to a 0 seems to make it mount correctly.

1 Like

Oops, that was my mistake. I’ll fix the post above.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.