There may be several reasons to switch to Btrfs, for me personally it’s because my KF2 server is eating up too much space, and Btrfs supports both compression and deduplication. Neither ext4 nor XFS have these so on CentOS I have no other option than Btrfs. Beware, RH deprecated it, so the 8.x series won’t have it, but until then, it’s pretty darn sweet. I’m pretty sure EPEL or some other repo will pick it up afterwards anyway.
Anyhow, to migrate your /home to Btrfs:
/homewon’t be accessible for a little while.
mkdir /mnt/root mount /dev/vda2 /mnt/root
/dev/vda2 is the identifier of your root partition, check with
fdisk -l, YMMV.
pushd /mnt/root mv home home-old popd
UUID=487fd25d-cbcf-44e7-a835-4411ae5183d1 /home btrfs defaults,compress-force=zlib 0 0
You can check the partition’s UUID with
/home. There are several options for this,
restorecon -rv /home.
If you’re curious how much space you save with compression and stuff:
yum install gcc btrfs-progs-devel git clone https://github.com/kilobyte/compsize.git cd compsize make ./compsize /home
To me it’s quite impressive:
# compsize /home Processed 4126 files, 224846 regular extents (224847 refs), 1750 inline. Type Perc Disk Usage Uncompressed Referenced Data 41% 12G 28G 28G none 100% 3.3G 3.3G 3.2G zlib 34% 8.7G 25G 25G
Enjoy.Tags: btrfs, centos, compression, dedup, deduplication, enterprise linux, rhel