# Btrfs ### Snapshot #### Create shapshot ```bash btrfs subvolume snapshot xyz xyz-snapshot-path-name # or btrfs subvolume snapshot main "main-`date +%Y-%m-%d`" ``` #### Delete shapshot ```bash btrfs subvolume delete xyz-snapshot-path-name # or btrfs subvolume delete "`echo main-* | tr ' ' \\\\n | sort | head -n 1`" ``` ### Common #### Resize ```bash btrfs filesystem resize max /mnt/dmp/ # or for view ID btrfs device usage /mnt/dmp/ btrfs filesystem resize ID:max /mnt/dmp/ ``` #### Defragment / compress ```bash mount -o compress=zstd:15 -t /dev/sdx /mnt # or btrfs filesystem defragment -v -clzo /boot/* # or chattr +c dir ``` #### Set RO / RW ```bash btrfs property set -f . ro false btrfs property set -f . ro true ```