You are not logged in.

#1 2015-06-26 14:56:09

bpont
Banned
Registered: 2010-03-24
Posts: 161

How do I mount a btrfs subvolume as user in fstab?

I'm still getting acquainted with btrfs and google wasn't much help, so I'm trying here.

I want to mount a btrfs subvolume as user with rwx attributes in fstab.  Before I edited fstab, I created the ~/mount_directory, as user and gave it 755 permissions.

Here's a look at my /etc/fstab

# root filesystem (top level subvolume)
UUID=<value>	/	btrfs	relatime,autodefrag,recovery,compress=lzo	0 0

# subvolume 'name' on root filesystem       
UUID=<value>	/home/<user>/<mount_dir>	btrfs	subvol=<name>,rw,user,exec	0 0

At boot, the mount command shows:

/dev/sdxx/<rootfs> on / type btrfs (rw,relatime,compress=lzo,space_cache,autodefrag,recovery)

/dev/sdxx/<rootfs> on /home/<user>/<subvol_dir> type btrfs (rw,nosuid,nodev,relatime,compress=lzo,space_cache,autodefrag,recovery)

As you can see, the 'user' option isn't show in the output for the subvolume entry and any attempt as user to write to that mount point produces a 'permission denied' error.

Interestingly, if I umount the subvolume, then remount, the output changes with the user option listed, but I still get the same permission denied error when attempting to write to the subvolume as user.

Offline

#2 2015-06-26 15:13:23

chaonaut
Member
From: Kyiv, Ukraine
Registered: 2014-02-05
Posts: 382

Re: How do I mount a btrfs subvolume as user in fstab?

bpont wrote:

I want to mount a btrfs subvolume as user with rwx attributes in fstab.  Before I edited fstab, I created the ~/mount_directory, as user and gave it 755 permissions.

you should set ownership and permission for your mountpoint when your target subvolume is mounted there.
setting them on empty directory is pointless.

Last edited by chaonaut (2015-06-26 15:13:46)


— love is the law, love under wheel, — said aleister crowley and typed in his terminal:
usermod -a -G wheel love

Offline

#3 2015-06-26 15:54:09

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,689
Website

Re: How do I mount a btrfs subvolume as user in fstab?

Not a sysadmin problem, moving to NC.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#4 2015-06-26 15:58:47

bpont
Banned
Registered: 2010-03-24
Posts: 161

Re: How do I mount a btrfs subvolume as user in fstab?

chaonaut wrote:
bpont wrote:

I want to mount a btrfs subvolume as user with rwx attributes in fstab.  Before I edited fstab, I created the ~/mount_directory, as user and gave it 755 permissions.

you should set ownership and permission for your mountpoint when your target subvolume is mounted there.
setting them on empty directory is pointless.

I thought that was the whole point of using the 'user' option in fstab?  To allow rwx permissions for users on any mounted directory specified for the device without having to explicitly change ownership or permissions after the fact?

I still don't understand why the user option is listed in the mount output only after a remount, but not before.

Offline

#5 2015-06-26 16:18:02

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,689
Website

Re: How do I mount a btrfs subvolume as user in fstab?

I don't know where you got that idea..

From 'man mount':

              Normally, only the superuser can mount filesystems.  However, when  fstab  contains
              the user option on a line, anybody can mount the corresponding filesystem.
[...]
              For more details, see fstab(5).  Only  the  user  that  mounted  a  filesystem  can
              unmount it again.  If any user should be able to unmount it, then use users instead
              of user in the fstab line.

No mention of permissions, just ability to mount.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB