Btrfs is a file-system that touts many improvements over traditionally simple file systems like ext4. Such as but not limited to: Snapshots, and file error corruption detection and recovery
Thing is if you’ve already got an installation it’d be a pain to reinstall everything just to switch file systems; so let’s convert it 🙂
First we need to boot from a live-system eg: CD or USB, we’ll be using https://endeavouros.com/ here but any distro that comes with btrfs-convert utility should work.
Next you’ll need to find the partition that you’ve installed the OS to,
sudo su fdisk -l
In my case its on /dev/sda3 for root partition and /dev/sda4 for home partition
The next step is to check the filesystem for corruption, this can be done using the fsck utility.
fsck /dev/sda3 fsck /dev/sda4
If it’s clean then you’re good to continue, otherwise repair the partition first
Now lets do the actual conversion, this may take a long time and possibly crash if the volume is very big (but is reversible):
btrfs-convert /dev/sda3 btrfs-convert /dev/sda4
In my case it completed successfully, so next lets mount and chroot into our OS
mount /dev/sda3 /mnt mount -t proc none /mnt/proc mount -t sysfs none /mnt/sys mount -o bind /dev /mnt/dev mount -o bind /dev/pts /mnt/dev/pts modprobe efivarfs chroot /mnt bash mount -t efivarfs efivarfs /sys/firmware/efi/efivars
Now we need to see what the filesystem uuid is for our new filesystem
In our case we can see that our /dev/sda3 has a UUID of 5bb0773c-86b0-40ca-b6f9-e0eb5dd6193a and our /dev/sda4 has a UUID of d81e1f4d-4c6e-46bb-a6ac-05e65d369e9f so those what we will use
Next lets modify our fstab to match something like this (remember to change the file-system from ext4 to btrfs in the next column)
Next we will need to rebuild grub, first mount the EFI folder (in our case its /dev/sda1)
mount -t auto /dev/sda1 /efi
Next lets detect the operating systems on the root file-system
Copy them to grub
grub-mkconfig > /boot/grub/grub.cfg
Now lets install grub
grub-install --efi-directory=/efi --target=x86_64-efi /dev/sda
Last but not least we may need to rebuild the initramfs (note that you may have to reboot into fallback initramfs if this command doesn’t work in chroot and run it there)
mkinitcpio -P exit reboot
If all went well we should have a working Btrfs installation now 🙂
and we didn’t need to re-install our programs 😛
Assuming things went well lets delete the conversion image since we don’t need it anymore (optional – saves space).
btrfs subvolume delete /ext2_saved
Manual Method: How to easily create and mount a snapshot
btrfs subvolume snapshot / @
Next we need to find out the subvolume id of this new subvolume
sudo btrfs subvolume show /@ | grep "Subvolume ID"
btrfs subvol set-default 425 /
Reboot, and in order to go back we can just mount the previous volume
btrfs subvol set-default 5 /
If you don’t feel like managing the snapshots yourself, you can always use snapshot manager like snapper:
yay -S snapper snap-sync snap-pac snapper-gui-git sudo snapper create-config / sudo snapper list sudo snapper-gui
http://snapper.io/tutorial.html and https://github.com/ricardomv/snapper-gui
I saw your comment on RT.com in the article :
//How Washington hustled up the foundations of a global electronic kraken
27 Sep, 2021
You have suggested to use EndeavourOS (Arch Linux) under XOrg with Pop-Shell. I went to the endeavour.com website. They have 10 Desktop Environment flavors. One of them is Xfce.
Can you please tell me which XOrg were you referring to in your comment and which would you recommend ? I have only 4 GB RAM on my old 2-core AMD Phenom X550 3.1 GHz Desktop PC shared with onboard graphics in use.
I would like to try the Endeavour OS. Prefer one with live-DVD capability.
Xorg is a window manager, by default Gnome uses wayland, but this is not compatible with the pop-shell extension. You can use whatever desktop environment you like, but you’ll need either Gnome or a variant of Gnome to use pop-shell (without bugs) afaik.