Skip to content

BTRFS Notes

Arch wiki: https://wiki.archlinux.org/title/btrfs

Btrfs wiki: https://btrfs.wiki.kernel.org/index.php/Main_Page https://btrfs.wiki.kernel.org/index.php/SysadminGuide

Transparent compression https://btrfs.wiki.kernel.org/index.php/Compression

# create btrfs parition
mkfs.btrfs /dev/sda

# mount default subvolume
mount /dev/sda /mnt

# mount subvolume with id 257
mount -o subvolid=257 /dev/sda /mnt

# mount subvolume with path @
mount -o subvol=@ /dev/sda /mnt

# create subvolume at path
btrfs subvolume create path

# list subvolumes recursively in the btrfs of path
btrfs subvolume list -p path

# snapshot
btrfs subvolume snapshot <source> <dest>

Mount use noatime: https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs(5)#NOTES_ON_GENERIC_MOUNT_OPTIONS

Mount option on ssd: -o ssd or -o ssd_spread on less expensive SSD devices: https://btrfs.wiki.kernel.org/index.php/FAQ#What_is_the_difference_between_mount_-o_ssd_and_mount_-o_ssd_spread.3F

Swap file: https://btrfs.wiki.kernel.org/index.php/FAQ#Does_Btrfs_support_swap_files.3F, https://wiki.archlinux.org/title/Btrfs#Swap_file

cp --reflink=auto to use COW copy

Ubuntu style layout: https://help.ubuntu.com/community/btrfs#Ubuntu-specific_subvolume_layout_in_11.04_and_later

Add btrfs snapshots to grub boot menu: https://github.com/Antynea/grub-btrfs

// TODO: free space?

how to fix a broken btrfs system: https://www.youtube.com/watch?v=qHalOdCZO9Q


Last update: August 3, 2021
Created: June 28, 2021