One of the cool features of BTRFS is subvolumes. Subvolumes sort of act like partitions but reside together on a single partition. One of the greatest advantages to this is all your free space is available to any subvolume on a given partition.
One of the other features of BTRFS is it can reside on a whole device thus no partitioning is required at all. Yes - that's right - mkfs.btrfs /dev/sda rather than mkfs.btrfs /dev/sda1. As an added bonus, BTRFS performs slightly better when it occupies an entire device in this manner.
As I noted in several previous posts of mine, I multiboot several different distros. I am in the midst of replacing a failing drive and partition re-arranging is going on so I thought this would be a good time to experiment with the idea that one could have several distros installed to the same BTRFS device (partition). Since I multiboot I also use this method of maintaining GRUB and I will reference this post here. For now: the BTRFS partition I am using is not the boot partition so GRUB is being maintained elewhere. I will update this thread when I go full BTRFS.
It's worth noting that a BTRFS device can be a single partition on a drive, an entire drive, or a combination of drives and/or partitions.
The basic steps to create multiple installs on a single BTRFS device:
1. Install your new Kubuntu (10.04 or newer) to the BTRFS device selecting BTRFS as the partition format type. Do not create separate /boot or /home partitions. The installer will automatically create a separate home subvolume. If you were to mount the root device you would see two "folders" named @ and @home. These are actually the subvolumes created by the installer. @ holds the contents of / and @home will contain the contents of /home.
2. Rename the new subvolumes to something unique. Since I installed Kubuntu Quantal Quetzal this way, I changed @ to @12_10 and @home to @12_10home. This paves the way for the next install to take the default subvolume names without wiping out the current install. NOTE: There is no special btrfs command needed to rename a subvolume. Just use "sudo mv" like you would to rename any other folder or file.
3. Change the subvolume names in the new install fstab to match the above edits. This is also a good time to add any desired mount options to your fstab, like space_cache, discard, ssd, compress and any others that your system benefits from.
4. Edit the new install's /boot/grub/grub.cfg to match the new subvolumes names. This is necessary for the first boot into the new subvolumes. Once you're in, running update-grub will put everything right. ***IMPORTANT NOTE*** the root subvolume becomes /@12_10 in grub.cfg rather than just @12_10.
5. Update 40_custom on your boot install (see the GRUB post linked above) to reflect/@12_10and run update-grub.
6. Boot into your new install and run update-grub.
You can now install a second distro and repeat! It should be obvious, but I'll state it anyway: Don't select formatting for the subsequent installs or you'll wipe out this one!
As multi-booter, this has some serious advantages:
Admittedly for now; This is more trouble than just partitioning and using ext4. Hopefully soon Ubiquity and other installers will have the ability to create custom subvolumes at install time and this will become the defacto method of installing. However, I just can't help myself and I must lead the pack! As BTRFS grows in features and becomes more widely used, it's many advantages will benefit even the most basic users.
I'll report back any sucess/failures with this concept soon as I'll be re-doing my system in the next couple of weeks. Happy Kubuntu-ing!
One of the other features of BTRFS is it can reside on a whole device thus no partitioning is required at all. Yes - that's right - mkfs.btrfs /dev/sda rather than mkfs.btrfs /dev/sda1. As an added bonus, BTRFS performs slightly better when it occupies an entire device in this manner.
As I noted in several previous posts of mine, I multiboot several different distros. I am in the midst of replacing a failing drive and partition re-arranging is going on so I thought this would be a good time to experiment with the idea that one could have several distros installed to the same BTRFS device (partition). Since I multiboot I also use this method of maintaining GRUB and I will reference this post here. For now: the BTRFS partition I am using is not the boot partition so GRUB is being maintained elewhere. I will update this thread when I go full BTRFS.
It's worth noting that a BTRFS device can be a single partition on a drive, an entire drive, or a combination of drives and/or partitions.
The basic steps to create multiple installs on a single BTRFS device:
1. Install your new Kubuntu (10.04 or newer) to the BTRFS device selecting BTRFS as the partition format type. Do not create separate /boot or /home partitions. The installer will automatically create a separate home subvolume. If you were to mount the root device you would see two "folders" named @ and @home. These are actually the subvolumes created by the installer. @ holds the contents of / and @home will contain the contents of /home.
2. Rename the new subvolumes to something unique. Since I installed Kubuntu Quantal Quetzal this way, I changed @ to @12_10 and @home to @12_10home. This paves the way for the next install to take the default subvolume names without wiping out the current install. NOTE: There is no special btrfs command needed to rename a subvolume. Just use "sudo mv" like you would to rename any other folder or file.
3. Change the subvolume names in the new install fstab to match the above edits. This is also a good time to add any desired mount options to your fstab, like space_cache, discard, ssd, compress and any others that your system benefits from.
4. Edit the new install's /boot/grub/grub.cfg to match the new subvolumes names. This is necessary for the first boot into the new subvolumes. Once you're in, running update-grub will put everything right. ***IMPORTANT NOTE*** the root subvolume becomes /@12_10 in grub.cfg rather than just @12_10.
5. Update 40_custom on your boot install (see the GRUB post linked above) to reflect/@12_10and run update-grub.
6. Boot into your new install and run update-grub.
You can now install a second distro and repeat! It should be obvious, but I'll state it anyway: Don't select formatting for the subsequent installs or you'll wipe out this one!
As multi-booter, this has some serious advantages:
No lost space or over-full partitions due to over/under-estimating partition sizes. In fact: No partitioning at all.
When removing unwanted installs the space is immediately reusable.
All the available space can be used for /home storage.
All my installs can be backed-up using snapshots.
For more space simply add in another partition or drive to my BTRFS device without going off-line.
When removing unwanted installs the space is immediately reusable.
All the available space can be used for /home storage.
All my installs can be backed-up using snapshots.
For more space simply add in another partition or drive to my BTRFS device without going off-line.
Admittedly for now; This is more trouble than just partitioning and using ext4. Hopefully soon Ubiquity and other installers will have the ability to create custom subvolumes at install time and this will become the defacto method of installing. However, I just can't help myself and I must lead the pack! As BTRFS grows in features and becomes more widely used, it's many advantages will benefit even the most basic users.
I'll report back any sucess/failures with this concept soon as I'll be re-doing my system in the next couple of weeks. Happy Kubuntu-ing!
Comment