--- author: ArgentumCation date: "2023-04-14" summary: A talk I gave on using BTRFS to my University Linux Usergroup title: 'Lightning Talks: BTRFS' --- ## Crash Course to Filesystems - your OS needs a way to yeet files somewhere - NTFS - the windows one - HFS - the apple one ## BTRFS vs ZFS and LVM - %%TODO: talk about PV, LV, VG%% - Please don't use LVM in this day and age - ZFS is a lot more mature than BTRFS and is probably the safer option, but the main caveats are that it can use hella ram space and doesn't have support for using disks of different sizes together - On the other hand BTRFS is kinda dogshit if you want to do Raid 5/6, and doesn't let you do tiered storage (e.g. no SSD cache or ramdisk cache) ## Migrating your existing system - Lucky you, EXT4 and NTFS can be converted to BTRFS in-place - (Whether or not you should trust converting NTFS to BTRFS is another story) - ### EXT4 - Grab a live USB and boot into it if this is a partition you can't unmount while booted (eg `/`, `/home`) - make a goddamn backup cause fucking with partitions is just asking for accidental data loss - okay now time to clean your filesystem - `# e2fsck -fvy /dev/sdx` - you'll also want to clear up some space before attempting this - `# btrfs-convert -p -L --uuid copy -O compress /dev/sdx` to do the actual conversion - if you're low on space add `-n` - if you don't have an FS label on this partition, you can add a label after `-L` - if something went wrong do `# btrfs-convert -r /dev/sdx` - Now let's mount it with `# mount /dev/sdx /mnt/` - for example if this is your root partition, mount it to `/mnt` - if it worked, run `# btrfs subvolume delete /mnt//ext2_saved` to yeet reversal data and save some space - Now let's move everything into subvolumes to make backups and stuff easier - cd over to where you mounted and run - `# btrfs subvol create @` - if you have `/home` on the same partition as root make a `@home` subvolume too. - so for a root partition do `@`, - `# mv * @` - you want to do this in a bottom up way, ie move `/home/*` to `/@home` before you move `/` to `@` - --- > [!todo] TODO > > - btrbk > - in place conversion > - subvol layout > - dual Linux boot > - dual boot with windows > - automated package manager snapshots > - Swapfiles > - zfs comparison