I need a container and within the container a way to set user filesystem quotas for ext4 or xfs. Only tried nspawn so far, but I'm not restricted to this particular technology. As explained here, quotas would only work by giving the container access to the device nodes (unless using btrfs, which I also want to avoid at the moment).

sda3 is not mounted anywhere. It is made available in the container via Bind=/dev/sda3. However, in the container, I get:

$ mount /dev/sda3 /mnt
mount: /mnt: permission denied.
$ ls -l /dev/sda3
brw-rw---- 1 root disk 8, 3 Sep  8 15:56 /dev/sda3
$ cat /dev/sda3
cat: /dev/sda3: Operation not permitted

Is there a switch that I can use to make this work?

General suggestions are also welcome. Would it make sense to look at btrfs? How about docker?

Addendum: Here is a very basic solution. When using PrivateUsers option, there seems to be a certain mapping between UIDs on the host and UIDs in the container. So we can set the quota on the host for the "host UID" of the relevant user. This works, and when the user exceeds her quota inside of the container, a "quota exceeded" message is indeed shown. Unfortunately, the quota command shows nothing inside the container. However, we could put the quota numbers into a text file inside of the container and then write a script that does a calculation using du; which hopefully is accurate enough for practical purposes. (All my tests were done with XFS.)

Your Answer

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

Browse other questions tagged or ask your own question.