Skip to main content

btrfs

 

 

Example of creating and mounting multiple sub-volumes

 

mkfs.vfat /dev/sda1
mkfs.btrfs /dev/sda2 -f
mkswap /dev/sda3

mkdir /mnt-btrfs
mount /dev/sda2 /mnt-btrfs
btrfs subvolume create /mnt-btrfs/@
btrfs subvolume create /mnt-btrfs/@home
btrfs subvolume create /mnt-btrfs/@root
btrfs subvolume create /mnt-btrfs/@srv
btrfs subvolume create /mnt-btrfs/@varcache
btrfs subvolume create /mnt-btrfs/@varlog
btrfs subvolume create /mnt-btrfs/@vartmp

mkdir -p /mnt/boot/efi
mkdir -p /mnt/home
mkdir -p /mnt/root
mkdir -p /mnt/var/cache
mkdir -p /mnt/var/log
mkdir -p /mnt/var/tmp
mkdir -p /mnt/srv

mount -o compress=zstd -o subvol=/@          /dev/sda2 /mnt/
mount -o compress=zstd -o subvol=/@home      /dev/sda2 /mnt/home
mount -o compress=zstd -o subvol=/@root      /dev/sda2 /mnt/root
mount -o compress=zstd -o subvol=/@srv       /dev/sda2 /mnt/var/srv
mount -o compress=zstd -o subvol=/@varcache  /dev/sda2 /mnt/var/cache
mount -o compress=zstd -o subvol=/@varlog    /dev/sda2 /mnt/var/log
mount -o compress=zstd -o subvol=/@vartmp    /dev/sda2 /mnt/var/tmp