Files
cmp-docs/docs/linux/fs-btrfs.md
2025-04-30 15:35:52 +03:00

868 B

Btrfs

Snapshot

Create shapshot

btrfs subvolume snapshot xyz xyz-snapshot-path-name
btrfs subvolume snapshot main "main-`date +%Y-%m-%d`"

Delete shapshot

btrfs subvolume delete xyz-snapshot-path-name
btrfs subvolume delete "`echo main-* | tr ' ' \\\\n | sort | head -n 1`"

Set RO / RW

btrfs property set -f . ro false
btrfs property set -f . ro true

Common

Resize

btrfs filesystem resize max /mnt/dmp/

View device ID

btrfs device usage /mnt/dmp/
btrfs filesystem resize ID:max /mnt/dmp/

Defragment / compress

mount -o compress=zstd:15 -t /dev/sdx /mnt
btrfs filesystem defragment -v -clzo /boot/*
chattr +c dir

Create subvol

btrfs subvolume create /mnt/btrfs/subvol