Make sure to run 'sync' before checking fs usage with df. Unit always XiB, not 10^3. No diff in case between "G" and "g", etc. Can shortcut btrfs command sub-commands as needed for distinctiveness. (2-letter for su and fi). There is no good reason to make a separate /boot partition. Can set boot flag to root partition, but even that seems unnecessary. Need to make 1MiB partition (I use type ext2, doesn't matter) w/ bios_grub flag. OpenSUSE says to use the graphical partitioner instead of mkfs. Fuck that. Determine label: btrfs filesystem label /dev/PART Relabel: btrfs filesystem label /dev/PART the_label # while mounted or not Resize the fs to available space of the device: btrfsctl-r max /mntpoint # Defaults to full size allocated to the partition btrfs filesystem resize ID:500m|+|-500m|max /mount/pt # Works online http://kerneltrap.org/Linux/Btrfs_Online_Resizing_Ext3_Conversion_and_More Set partition UID to a random one: btrfstune -u /dev/sda1 Set partition UID to a specified one: btrfstune -U /dev/sda1 btrfs device/volume naming. Seems that the volume identifier is just the underlying physical device path. For a mult-device volume, you can identify with any of the device paths. Main commands mkfs -t btrfs -L the_label /dev/PART (at least 1 GiB recommended!!) Creates a btrfs "volume" (== btrfs "filesystem"?) Definitely read mkfs section below. btrfs device scan [/dev/sdX] btrfs subv create|delete /new/mount/pt btrfs subv list Any/subdir/within/entire/btrfs/fs (though mnt pt must be mounted, lists ALL subvolumes within the btrfs) btrfs subv snapshot /exist/mtpt /exist/mtpt/new/ss/dir (needs to under /exist/mtpt only for mount-by-name). btrfs check [-p] [--repair|--check-data-csum] /dev/sdX # deprecated alias 'fsck' if run without --repair or --check-data-csum, the summary may report "error(s) found" with the "found X bytes" report. And "Counts for qgroup... are different" right after last step. For my run with disk proble, "--check-data-csum" added no problem details. If get "Cache and super generation don't match", run: btrfs rescue clear-space-cache v1|v2 /mnt/pt * see notes re. space caching btrfs filesystem show [/dev/sdX] [specify any component device] **GOTCHA! Be aware that after resizing anything, this may not show the real available size. Check the physical partition holding it. I guess this just shows how much of btrfs-allocated fs is used, with nothing about how much is available-- can only see that by parted, etc.? btrfs filesystem balance --full-balance /mount/pt # Before stats reflect data usage btrfs filesystem balance start -dusage=5 /mount/pt # Incr # until reallocates mount /any/component/device /mount/point mount -o subvolid=261 /any/component/device /mount/point # subvol no. mount -o subvol=/rel/path /any/component/device /mount/point # subvol no. btrfs filesystem df /mount/pt btrfs filesystem resize ID:500m|+|-500m|max /mount/pt # Works online This command does work after enlarging the underlying disk partition. The resize size here is what "df" reports. BE CAREFUL. I find that sometimes - fails, but takes target size. Avoid using - because need to re-balance to get honest Available. (and maybe sync) After this 1M-block size seems useless. This usually makes 'balance' inoperable. Even when use absolute size and attend to Available, it is still very rough. I request 300m and I get 378m (don't bal-dusage or 340m!) btrfs inspect-internal min-dev-size --id X /mount/pt Limitations Mount options applied to only first subvolume. Can't move read-only subvolumes. (But justfication covers only snapshot ro's?) Space caching. For some commands you nee to specify v1 or v2 for space caching. Easist way to determine is to grep dmesg or 'journalctl -b' for "-E 'BTRFS info.+space" v1: "disk space caching is enabbled" v2: "using free space tree" Impl. details Allocated in (typically) 1 GiB chunks. Subvolumes FLAT (parent and children) or NESTED schemas They are NOT block devices like lvm LVs. Perhaps like detachable subdirectory branches? Top-level subvolume ID5 but "number 0" NO name (all others have a name) Can be mounted directly and normally. Non-toplevel subvolumes can be mounted with subvol=x option. When mounting, all nested subvolumes automatically mount. Only for NESTED type! TODO: Test because "Other question 3.4 says they all automount! Flat children must be manually mounted. A btrfs fs has a 'default subvolume', i.e. what mounts when you you do a non-option mount. By default the top-level. (Can one btrfs fs have more than one top-level?) FLAT subvols ONLY included in snapshots. For NESTED, suggestion is that top-level not be mounted. For NESTED, things not under mounted subvols is visible. What in hell would that be?????! Nomenclature volume ~ lvm VG Root fs NON-top-level subvolume! mkfs... mount /btrfs/dev /tmp/mp # mount the top-level btrfs quota enable /tmp/mp # BEFORE ANY subvolume ADDED! subvolume create /tmp/mp /tmp/mp/new_rt_subvol_name ?? Why not umount all and remount /tmp/mp/new_rt_subvol_name at this point? # chroot to /tmp/mp/new_rt_subvol_name, not to /tmp/mp! btrfs subv set-default /a/mt/pt Has no effect if not mounted at the time! QUOTA LIMITS: https://btrfs.wiki.kernel.org/index.php/UseCases#Usage GOTCHA: btrfs identified disk usage is massively different from actual disk usage reported by 'du -s...'. Limits will be constrained according to what 'btrfs qgroup show -re' says, not du (and remember to sync for 'btrfs qgroup show' unless use --sync switch!). All /mnt/pt paths just specify the whole mounted btrfs branch. Quotas are independent of nesting and is for the specified subvolume excluding any descendant or ancestor subvolumes. Setup: btrfs quota enable /tmp/mp # BEFORE ANY subvolume ADDED! Remainder of setup in docs is useless. qgroups get created and synced automatically. Usage: (mount points here are ANY dir inside of the top-level btrfs device) btrfs subv list /mp # to show btrfs numbers btrfs qgroup show --sync -re the/path # Limits reported in the 2 "Max" columns. btrfs qgroup limit 100G|none the/path # none to clear Referenced vs. Exclusive limits. I don't understand the distinction, but since I am not applying limits to both ancestors and descendants it probably makes no difference to me, so use the default of 'Referenced'. If change the subvolume to mount without changing the "set-default" (probably not on purpose), then need to add/change "linux..." boot commands in Grub config: rootflags=subvol=new_rt_subvol_name OR rootflags=subvolid=256 (subvol no.) PLAYING Use dd to zero a new disk file lossetup /dev/loopX /file/to/file.bin Kernel automagically creates /dev/loop0 up to X. mkfs RAID0 profile is (accurately) striping. single profile is not for single device but is concatenation. Defaults Defaults great for -m. SINGLE DEVICE defaults: -d single -m DUP|single (non-SSD vs. SSD) MULTIPLE DEVICES defaults: -d RAID0 -m RAID1 If member physical paritions are of varying sizes then use: -d single because large losses striping across partitions of different sizes. RAID0 of .5G+2G+1G = 2.0G avail vs. 1G+1G+1G = 2.6G avail vs. single of .5G+2G+1G = 3.2G avail vs. 1G+1G+1G = 2.7G avail OVERHEAD For an empty -d RAID0 -m RAID1 1GiB+1GiB: ~11%, 222 MiB = df-blocks - df-avail ~0.9% of this is shown as df-used (17 Mib) Used 17 MiB Believe the "Available" size reported by df, but AFTER syncing. See mkfs section above for RAID0 vs. single profile overhead. Snapshots They are just like r/w copies with all hard links, similar to rsync copies. As soon as a file in the snapshot is changed, a new independent copy is made. btrfs subv snapshot /exist/mtpt /exist/mtpt/new/ss/dir CONTRARY TO DOCS, I see that there is NO recursion. Only specified subvolume is copied. For btrfs to show additional space after changing underlying partition (like with VMWare) If a partition (not whole disk) then echo to the rescan file (see "vmware.txt") [Regardless partition or whole-disk:] "btrfs fi resize max /m/p", then size back down to what you really want. This may defeat thin partitioning. To make new disk devices visible without rebooting (Unnecessary for archLinux which sees them immediately) echo "- - -" >/sys/class/scsi_host/host/scan SOMETIMES archLinux doesn't see additional size after VMware disk enlargement. Can check by 'btrfs fi resize max m/p' then checking df. If new size isn't reflected then reboot and redo the resize. (Remember to resize back down if you don't really want max). To see real "fs" (not necessarily used) space to btrfs, just run: df -m /m/p # To determine original fs size btrfs fi resize max /m/p df -m /m/p # To determine allocated btrfs size btrfs fi resize /m/p # size must be M|m|g|G etc.