0

In my /etc/fstab:

UUID=... / btrfs   subvol=@,defaults,relatime,space_cache,autodefrag 0 1
UUID=... /media/fs.cave btrfs subvolid=5,defaults,relatime,space_cache,autodefrag 0 0
UUID=... /var/lib/libvirt/images btrfs nodefaults,subvol=vm.images,relatime,space_cache,nodatacow 0 0

The output of "mount" is:

/dev/sda5 on /var/lib/libvirt/images type btrfs (rw,relatime,space_cache,autodefrag,subvolid=268,subvol=/vm.images)

I do not expect the option "autodefrag" and I am missing the option "nodatacow".

Is there another possability to find out the active options?

OS: debian buster with kernel 4.19.0-6-amd64 and 5.2.0-0.bpo.3-amd64

Hamatoma
  • 1
  • 1
  • 3
  • After installing the kernel 5.2.0-0.bpo.3-amd64: same behaviour – Hamatoma Oct 16 '19 at 09:09
  • Possible duplicate of [Different options on btrfs subvolumes](https://serverfault.com/questions/328188/different-options-on-btrfs-subvolumes) – poige Oct 16 '19 at 09:18
  • The post is related to kernel 3. I am using kernel 5. – Hamatoma Oct 16 '19 at 09:52
  • see https://btrfs.wiki.kernel.org/index.php/SysadminGuide "Each of these subvolumes/mountpoints can be mounted with some options being different." – Hamatoma Oct 16 '19 at 10:00
  • I had it read before I wrote. What's your q-n. Subvolumes do share some mount options and there's some Work-in-Progress in regards, so things my change in recent kernels. Anyways and again — what's your q-n? – poige Oct 16 '19 at 10:05
  • I want to know, whether the option "nodatadow" is active for /var/lib/libvirt/images. It is not listed in the mount command (without options) – Hamatoma Oct 16 '19 at 10:46
  • I had a similar issue, I'm thinking that the BTRFS option directly on my swap file is how this author might have got around this option, as swapfiles should have `compress=no` https://mutschler.eu/linux/install-guides/pop-os-btrfs/#commento-login-box-container – rupert160 May 09 '20 at 03:44

1 Answers1

0

Better than mounting with attributes: use the attributes of a subdirectory:

chattr -RV C /var/lib/libvirt/images

see: http://man7.org/linux/man-pages/man1/chattr.1.html

If the 'C' flag is set on a directory, it will have no effect on the directory, but new files created in that directory will have the No_COW attribute set.

This attribute can be retrieved:

lsattr -R /var/lib/libvirt/images
  • only non directory files will have the attribute
  • only files created/changed after the "chattr" command have the attribute
Hamatoma
  • 1
  • 1
  • 3