How to create a partition table with btrfs?

7,704

Solution 1

Firstly, BTRFS is just a different animal in comparison to EXT4. To put it succintly, EXT4 is a filesystem, where as BTRFS is a filesystem integrated with a volume manager. If you've ever worked with LVM2, then you have experience with a volume manager.

Whether you should adopt BTRFS over EXT4 is subjective; Only you can answer that. It's not merely that one is better than the other. To help you decide, I recommed you go to https://btrfs.wiki.kernel.org/index.php/Main_Page, scroll down to the Guides and usage information section, and read all of those articles; Except the article on RAID, which you can probably skip. That will give you a sense of that BTRFS is about.

Regarding the partitioning scheme, there are two things at play here: the disk partitions and the BTRFS volumes. First, I'll re-map your old partitioning scheme, and then explain the reasoning.

Partitioning scheme

Note: The actual partition numbers are irrelevant, it's the fact that it's a partition that's important.

/dev/sda1    /boot
/dev/sda2    swap
/dev/sda3    /        subvol=/volumes/root
/dev/sda3    /home    subvol=/volumes/home

Here are the important things to note:

  1. /boot and swap are partitions.
  2. / and /home are BTRFS subvolumes on the same BTRFS filesystem.
  3. There's only one partition with a BTRFS filesystem.

BTRFS doesn't support swap. It's a filesystem, not a partition so making it a swap partition doesn't make sense. As of this writing, BTRFS doesn't support swap files, but you can use a loop-mounted file and pay the performance penalty. Point being, it's best to leave it as a partition.

According to the documentation, if you're using Grub 2, you can put /boot in a BTRFS subvolume rather that it's own partition. I'm still on Grub 1, so... there's my reasoning :)

The main diversion here from EXT4 is in how the data is partitioned out. In short, instead of using multiple partitions, whose sizes must be chosen well in advance, you can dump it all into the same big partition and use subvolumes to divide things logically.

Encryption

BTRFS currently doesn't have native support for encryption, but... there are ways. See here

Solution 2

The partition table doesn't indicate which filesystem type is used on each partition. It only indicates the purpose of the partition, e.g. “Linux filesystem” or “Linux swap”.

In any case, you wouldn't directly set anything: you tell the installer to use btrfs when it's doing the disk preparation. I think you need to select manual partitioning; this blog post includes screenshots from an older version. You only need to have a separate /boot partition if you encrypt the system partition¹. You don't need a separate /home partition; one of the advantages of btrfs is that you can use subvolumes to segregate storage that's on the same physical support.

Btrfs has some nice features, but unless you have a use for these features, that's no advantage for you.

¹ There used to be a bug with Grub when /boot was on btrfs and Grub was installed in the partition rather than on the hard disk (which is useful for dual boot setups where Grub isn't the primary bootloader, itself not a very common scenario). But this bug is long resolved.

Share:
7,704

Related videos on Youtube

Garynall96
Author by

Garynall96

Updated on September 18, 2022

Comments

  • Garynall96
    Garynall96 over 1 year

    I want to install Ubuntu 16.04.1 (the latest release at this moment) in my laptop and am thinking about the partition scheme and the filesystem of my new OS.

    Firstly, the current partition table I got on my current system (an outdated Fedora) is: boot (ext4), home (encrypted ext4), root (encrypted ext4) and swap. It has worked well for me but I am thinking about using btrfs instead of ext4 since I have been reading that the former is an improvement over the latter. However, me being a very basic and non-technical user, I don't understand how changing the filesystem would change my partition table. Specifically I would like to know:

    Can I simply make my new partition table: boot (btrfs), home (encrypted btrfs), root (encrypted btrfs) and swap?

    If not, I would like to take some suggestions about the appropiate partition table under the btrfs filesystem or if it is even worth adopting this filesystem?

    • text
      text over 7 years
      note: brtfs still has problems and not productoin ready.