btrfs Commands Cheat Sheet
My commonly used btrfs
commands. I enjoy using
btrfs
as it is compatible with Linux kernel GPL
licensing. It’s mainline supported, simple to manage, and it
provides me much of the same functionality I get with
zfs
.
Create a simple mirror
Both data and metadata will be mirrored across these two disks.
mkfs.btrfs --data raid1 --metadata raid1 /dev/my/device/1 /dev/my/device/2
List filesystems
btrfs filesystem show
Attach a new disk to a non-mirrored disk
The goal here is to take a single-device btrfs system and make it into a mirror (raid1). This way we go from having one disk with no redundancy to a pair/set of two disks with redundancy.
btrfs device add /dev/my/new/device /mnt/my/existing/filesystem
This may take a long time to mirror data
btrfs balance start -dconvert=raid1 -mconvert=raid1 /mnt/my/filesystem
Feel free to contact me with questions or feedback regarding this
article.