How-to: Install CentOS 6.5 using btrfs for the root partition

I discovered today that CentOS 6.5 x86_64 can be installed using btrfs with very little effort!

Here’s how to do it:

  1. At the grub menu for the installation media (e.g. minimal install CD), press tab.  Pressing tab will give take you to a prompt where you may add to the installer’s kernel options.
  2. Append ‘ btrfs’ to the end of the line.
  3. Press enter.
  4. Proceed as usual, until you reach the ‘type of installation’ screen.  At this time, select ‘Create custom layout’.
  5. Many partition schemes are possible here.  I chose to start with a blank ‘sda’, without LVM.
    1. I think a non-btrfs partition type is necessary for /boot, but I’m not sure at the moment.  I’ll leave that up to you to investigate.
    2. The first partition I entered was ‘/boot’ with a 1024MB ext4 file system.
    3. For most installs, you should next consider creation of a swap partition, which is something documented in the CentOS/RHEL manuals quite well.  I chose not to create a swap partition for the machines where I tested this procedure, but I highly recommend you educate yourself about swap space before proceeding if you have not done so already.
    4. I used the rest of sda for ‘/’ using a ‘Fill to maximum’ btrfs partition.
    5. Proceed as usual with the installation.
    6. Profit!

It seems previous version(s) of CentOS 6.x may or may not have this feature which prompted folks to convert their ext4 partitions to btrfs after the initial install [1].  Lucky for us, this is no longer necessary.

Please let me know in the comments if you find this works on other CentOS 6.x versions/architectures and I’ll update this post.

1: http://wiki.centos.org/PhilipJensen/CentOS6ConvertToBTRFS

Thanks for reading,

– Joshua

// Founder @ Wrale

2 thoughts on “How-to: Install CentOS 6.5 using btrfs for the root partition

  1. I was not able to reproduce this on CentOS 6.5 inside a Virtualbox (64 bit). At first I tried the netinstall, then the minimal and then the live CD, all on 512 ram and the text installer did not have an option (as far as I could figure out) to create a custom layout. Then I increased the RAM to 1024 on the live CD and wen’t through the GUI installer and could finally create a custom layout. Unfortunately there was no option to create a btrfs partition. At this point I retried after running “sudo yum install btrfs-progs” and could now see the option for creating a btrfs partition! Unfortunately when I tried to proceed, I recieved this error message:
    “Your / partition does not match the live image you are installing from. It must be formatted as ext4″

    It appears to me that the only way to get your root partition over to btrfs is to convert it using a live CD AFTER having installed it as ext4 ( http://wiki.centos.org/PhilipJensen/CentOS6ConvertToBTRFS )

    Also, I could not tell if adding btrfs actually did anything for me. I get the feeling I should have added something like XXX=btrfs maybe? I literally just added “btrfs” to the end of the line as step 2 suggests “Append ‘ btrfs’ to the end of the line.”

    Any thoughts/help appreciated.
    Programster

Leave a comment