meta data for this page
BTRFS subvolumes
btrfs subvolume create /BTRFS/sub1 btrfs subvolume create /BTRFS/sub2 btrfs subvolume create /BTRFS/sub3
btrfs subvolume list /BTRFS ID 256 gen 234 top level 5 path sub1 ID 257 gen 227 top level 5 path sub2 ID 258 gen 228 top level 5 path sub3
Mount subvolume
mount -o subvol=sv1/sv12 /dev/sdb /mnt
Getting data size on each subcvolume:
- Enable quota on btrfs
btrfs quota enable /
- Install script https://github.com/agronick/btrfs-size
Mixed mount options
NOT SUPPORTED YET:
In general, btrfs doesn't _yet_ have the runtime infrastructure to handle per-subvolume mount options. The on-device format and general approach in the kernel was designed to allow it, and it's on the roadmap, it just hasn't been done... yet.
To make workaround it is possible to use attributes on files or directories:
- C disable COW feature (for newly created directories or zero sized files). New files in directores with C attributes will be created with C attrib. But not subdirectories.
- c enable compression
Move data between subvolumes
See cp
command arg:
When --reflink[=always] is specified, perform a lightweight copy, where the data blocks are copied only when modified. If this is not possible the copy fails, or if --reflink=auto is specified, fall back to a standard copy.
cp -pr --reflink=always srcDirectory dstDirectory/ rm -r srcDirectory