How to mount a hard drive with BTRFS filesystem with user permissions?

How to mount a hard drive with BTRFS filesystem with user permissions? i tried:

UUID=2fd97598-095f-4470-b966-2c3b8324ce0b /mnt/2fd97598-095f-4470-b966-2c3b8324ce0b btrfs nofail,noatime,rw,user,uid=1000,gid=1000,dmask=0,fmask=0,auto 0 2

That worked fine when the hard drive was NTFS but after converting it to BTRFS the error log says
"Unrecognized mount option "uid=1000"
the same with gid, dmask, fmask and auto. After removing these it mounts normaly, but as root. I want it to mount it with user read/write permissions

*fstab

ntfs/exfat/fat32 partitions don't support POSIX permissions so you use the mount options to "hardcode" the permissions.

btrfs does support POSIX permissions so you don't need to pass it an explicit UID/GID. You can set the permissions on the files/directories themselves.

5 Likes

And how do i do that? im using Garuda Xfce version if that matters. And what are "POSIX permissions"

You can use the command chown. For example:

sudo chown -R username:username /path/to/directory

Replace username with your actual username and /path/to/directory with wherever the drive is mounted. That will change ownership of everything on that drive to your user. You should only have to do that once as any new files you create will be owned by your user normally.

Also, make sure you only do that to a directory containing your user data and not some other part of the filesystem. If you run that command on the whole filesystem it will break your system.

3 Likes

no need to hardcode permissions on ntfs-3g, one can use ntfsusermap. ntfsusermap(8) — Arch manual pages

sorry for offtopic ... just to make a hint if anyone wants to do it!

1 Like

I am aware, but since using that it both uncommon and non-trivial it didn't seem worth confusing the issue with it. :wink:

3 Likes

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