4

My backup user should be able to create a btrfs snapshot of the system subvolume (mounted at /). But this doesent work.

Setup: subvol=/rootfs is mounted on / and subvol=/ is mounted on /btrfs

First:

root# mkdir /btrfs/backup && chown backup:backup /btrfs/backup

then as backup user:

backup$ btrfs subvol snapshot / /btrfs/backup/rootfs
Create a snapshot of '/' in '/btrfs/backup/rootfs'
ERROR: cannot snapshot '/': Operation not permitted

If I change the owner of / to be the backup user, it works, but is this the right way?

Ubuntu 16.04 / Linux 4.4.0-59-generic / btrfs-progs v4.4

1
  • Have you tried this on a current version (put a 6.1 kernel in a VM to test)? Commented Jun 7, 2023 at 23:09

1 Answer 1

0

Firstly, I see that you make a directory, not a subvolume.

btrfs subvolume create /path/to/the/location/…/subvolume-name

Secondly, the owner of a directory is different from a simple dir than a mount pont directory. In the second case, it's owned by root. So you must mount it and then, chown the directory mountpoint.

1
  • Thanks, but this does not really help me. I try to make a snapshot as user (not as root), which is not permitted even if the destination directory is owned by said user.
    – jonas
    Commented Mar 21, 2017 at 9:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .