btrfs
btrfs
- see also: parted
check and scrub btrfs filesystem
scrub
this just checks checksums of the data, it does not repair a filesystem
start the process:
sudo btrfs scrub start /check the status:
sudo btrfs scrub status /check
should be done on a readonly or not mounted filesystem, however it can be run on a mounted filesystem as well, with the --readonly and --force flag you can make sure that nothing will be modified:
btrfs check --readonly --force /dev/md0create btrfs filesystem and partition
parted -s /dev/nvme1n1 mklabel gpt
parted -s /dev/nvme1n1 mkpart primary 4MiB 100%
partprobe /dev/nvme1n1
sgdisk --typecode=1:8300 /dev/nvme1n1
mkfs.btrfs -L data /dev/nvme1n1p1resizing btrfs filesystems
to max:
btrfs filesystem resize max /by gb:
btrfs filesystem resize +10g /managing btrfs snapshots
you should use them more often, perhaps in combination with a a backup tool
snapshot utilities
- snapper - automatically create snapshots based on a configuration
- snap-sync - send snapshots to a target destination, another disk locally, ssh etc.
list snapshots
sudo btrfs subvolume list /get more information about a snapshot
btrfs subvol show /.snapshots/1236/snapshot/create a read only snapshot
sudo btrfs subvolume snapshot / /my_snapshot # root partition
sudo btrfs subvolume snapshot /mnt /mnt/my_snapshot # partition mounted at /mntdelete btrfs snapshot
sudo btrfs subvolume delete /my_snapshot
sudo btrfs subvolume delete /mnt/my_snapshotbtrfs raid configuration
convert raid levels, from raid0 to raid1
btrfs balance start -dconvert=raid1 -mconvert=raid1 /mntraid1
with kernel version 5.5+ raid1c3 can be used for the metadata (-m)
mkfs.btrfs -m raid1 -d raid1 /dev/sdb /dev/sdc