Dies ist eine alte Version des Dokuments!
Paket: btrfs-progs
ext? nach btrfs konvertieren:
man btrfs-convert
Dateisystem anlegen und mounten:
mkfs.btrfs /dev/sda2 mkdir /mnt/btrfs mount /dev/sda2 /mnt/btrfs time cp -a /usr/share/ /mnt/btrfs cd /mnt/btrfs
Informationen über das Dateisystem anzeigen:
btrfs subvolume show .
→ Subvolume ID: 5
btrfs subvolume list .
→ noch keine Subvolumes
Subvolume anlegen und Daten hinein verschieben:
btrfs subvolume create subvol1 btrfs subvolume list . btrfs subvolume show subvol1
→ Subvolume ID: 256 → Parent ID: 5
time mv ./share/ ./subvol1/
Subvolume umbenennen:
mv subvol1/ subvol2
Snapshot erstellen:
time btrfs subvolume snapshot subvol2 snap1 btrfs subvolume list . btrfs subvolume show snap1
→ Subvolume ID: 257 → Parent ID: 5
Read-only Snapshot erstellen:
btrfs subvolume snapshot -r subvol2 snap_ro1
btrfs filesystem df -h . btrfs filesystem du -s --human-readable . du -sh . du -shx . btrfs filesystem du -s --human-readable subvol2 du -sh subvol2 btrfs filesystem du -s --human-readable snap1
SuSE default:
mkfs.btrfs ${BOOT_DEVICE}2 uuid=$(lsblk -n -o uuid ${BOOT_DEVICE}2)
mkdir $target mount UUID="$uuid" $target || exit
btrfs subvolume create ${target%/}/@ btrfs subvolume create ${target%/}/@/.snapshots mkdir -p ${target%/}/@/.snapshots/1 btrfs subvolume create ${target%/}/@/.snapshots/1/snapshot mkdir -p ${target%/}/@/boot/grub2 btrfs subvolume create ${target%/}/@/boot/grub2/i386-pc btrfs subvolume create ${target%/}/@/boot/grub2/x86_64-efi btrfs subvolume create ${target%/}/@/opt btrfs subvolume create ${target%/}/@/srv btrfs subvolume create ${target%/}/@/tmp mkdir -p ${target%/}/@/usr btrfs subvolume create ${target%/}/@/usr/local mkdir -p ${target%/}/@/var btrfs subvolume create ${target%/}/@/var/crash mkdir -p ${target%/}/@/var/lib/libvirt btrfs subvolume create ${target%/}/@/var/lib/libvirt/images btrfs subvolume create ${target%/}/@/var/lib/mailman btrfs subvolume create ${target%/}/@/var/lib/mariadb btrfs subvolume create ${target%/}/@/var/lib/mysql btrfs subvolume create ${target%/}/@/var/lib/named btrfs subvolume create ${target%/}/@/var/lib/pgsql btrfs subvolume create ${target%/}/@/var/log btrfs subvolume create ${target%/}/@/var/opt btrfs subvolume create ${target%/}/@/var/spool btrfs subvolume create ${target%/}/@/var/tmp
subvolid=$(btrfs subvolume show $target/@/.snapshots/1/snapshot | sed -rn 's/.*Object ID:\s+//p') btrfs subvolume set-default "$subvolid" "$target"