I have a new disk with one btrfs partition on it and want to mount it via fstab. The problem is, that all files are now owned by root but I want them to be owned by the user with ID 1000 (and group ID 1000).

With the ntfs partition on my old disk the entry looked like this:

UUID=AAAE86DAAE869E87 /media/disk ntfs auto,uid=1000,gid=1000,errors=remount-ro 0

My current btrfs entry looks like this:

UUID=eaadb7d0-4dba-46a7-85ac-0fbf81821840 /media/disk btrfs defaults 0 1

I can't set the uid and gid option on btrfs, because when I do it, I'll get an error while booting (the options uid and gid do not exist).

Is there an opportunity to set the ownership of all files to a specific user?

Regards, Hauke

  • btrfs, and ext support owners per-file, so change the ownership of the files. sudo chown -R 1000:1000 /media/disk – ctrl-alt-delor Apr 1 '17 at 16:47
  • This will be persistent (so after a reboot the ownership is by user id 1000)? – theo_retiker Apr 1 '17 at 16:51

It sounds like you're thinking that uid and gid options in fstab are a generic way to override ownership on a filesystem. That's not really true. The NTFS driver, specifically, supports those options because NTFS doesn't store (Linux-compatible) ownership information on disk, so the driver has to fake them.

Btrfs, on the other hand, natively supports Linux file ownership, so there's no need for the driver to fake it; the btrfs driver has no uid or gid options. If you want to change who owns something on a btrfs filesystem, just use the chown command.

If you want the "entire filesystem" to be owned by a specific user, mount it and then chown the mountpoint directory. That sets the owner of the filesystem's root directory, so the user can create files there. (And the files created by that user will, of course, be owned by that user.)

|improve this answer|||||
  • "[...] NTFS doesn't store (Linux-compatible) ownership information on disk [...]" This was the part I forgot about, thanks a lot :D – theo_retiker Apr 3 '17 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.