I have just finished my first installation on btrfs. I should admit at the outset that I haven’t been doing much of homework on this so please bear with me. I used Gparted in the live usb and created two partitons one ESP and one / formatted as btrfs:
Model: WDC WD10 JPVX-08JC3T6 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 785GB 785GB ext4
2 785GB 893GB 107GB ext4
3 893GB 1000GB 107GB ext4
Model: SKHynix_HFS001TD9TNG-L3A0B (nvme)
Disk /dev/nvme0n1: 1024GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 106MB 105MB fat32 boot, esp
2 106MB 43.1GB 42.9GB btrfs
I have seen that some users have subvolumes for home and or Timeshift snapshots. Is this something I should have created at the time of installation or is it possible to do it now? Or should I have created a separated partition only for home and then what format should I have chosen btrfs or ext4?
I’ll be grateful for any comments and suggestions. If you need some more info please tell me.
Breaking a volume into subvolumes is one of the most useful features of a filesystem like btrfs. You should definitely do it. The more the better in my opinion.
You can create subvolumes whenever you want. You will have to move the data and setup mounts for them in /etc/fstab.
IMO, this totally defeats the purpose of using a filesystem like btrfs in the first place. One of the big advantages of using a fs like btrfs is that you can separate volumes with there own policies and snapshots without having to separate the space on the physical disk or worry about which is filling up first.
The counterpoint to this is that if your /home is on a separate partition it makes it easier to install a different distro without erasing your /home partition. I am not really a fan of that practice to begin with though.
I think I am beginning to get the idea. I hope! So I could in princip create a subvolume for /usr, for /var, for /timeshift etc. and then create @usr, @var, and @timeshift entries in fstab?
How should I move the data in a directory? Via mounting them first at /mnt, copy to the subvolume and delete the source?
I am truly green about this so I really don’t know what an optimal set up should look like. It is a learning project at this point but since I will be migrating to this new laptop it would be nice to get it right (somewhat) from the start.
You only need @ and @home to use the useful tools that make btrfs a good choice on a home pc: timeshift, timeshift-snapshot, grub-btrfs, and btrfs subvol commands.
But remember these snapshots will all be contained on the same drive so you should keep some other backup externally as well.
Grub-btrfs is in addition to the grub package, it doesn’t write the boot code so just install it, run
$ grub-mkconfig -o /boot/grub/grub.cfg
and reboot.
Grub-btrfs doesn’t add anything to os-prober so it will be the same as before, and grub is fine finding other OS’s with Manuels patch but it won’t find other btrfs installs (the grub patch conversations about this go back years!).
you even can boot the live iso and create subvolumes from there. (sudo btrfs subvolume create @<your_subvol_name>). in the live environment, you can then move/copy the files/folders in the new subvolume as well (use of cp -rp is a good idea; -r for recursive so all subdirectories and files get copied; -p to preserve the rights/ownership - (edit:) or maybe even better: use rsync). I for myself use snapper instead of timeshift . Look here for suggested filesystem layout: https://wiki.archlinux.org/index.php/Snapper#Suggested_filesystem_layout (althought this is for snapper)
Here is a good topic on that matter on the arch forum: https://bbs.archlinux.org/viewtopic.php?id=194491
I haven’t used timeshift with btrfs but I was wondering if it could be used to create btrfs snapshots locally and rsync snapshots on another drive. I guess it could be started twice with command-line options?
So if I understand this correctly, I couldn’t be able to set up a a multi-boot system where all the systems are installed on btrfs and boot them via Grub?
Not with grub, it doesn’t see btrfs on other drives. One solution was to symlink / and /etc so grub would find them but that didn’t work for me so I ended up with ext4 as my 2nd drive. I don’t know if @manuel would kindly look at this? I’ve seen Ubuntu and Redhat bug reports on this for years and no-one seems to want to finish it.
Afaik it’s an one or the other with timeshift. Personally I don’t use either, because the restore options in timeshift always confused me. I create local btrfs snapshots with https://github.com/digint/btrbk and an external rsync backup with Back in Time.
I recall seeing on another thread where @ricklinux posted about his setup. A triple system, if I remember correctly, all on btrfs and each one with it’s own ESP but then using rEFInd to boot them. This is way above my pay grade but that was what started me off at the first place to make a similar setup.