The partition to be converted should not be mounted when attempting conversion.
Boot up in a live environment.
Find your partition
lsblk
Check the filesystem:
fsck -f /path/to/partition
Run the conversion utility:
btrfs-convert /path/to/partition
NOTE: If you encounter a core dump here, then you may need to build a special branch of btrfs-progs:
git clone https://github.com/kdave/btrfs-progs.git cd btrfs-progs git fetch git checkout delayed_ref_fix ./autogen.sh make ./btrfs-convert /path/to/partition
Chroot into the system
Edit /etc/mkinitcpio.conf
:
- Add "/usr/bin/btrfs" to the
BINARIES
list - In the
HOOKS
, Addbtrfs
betweenlvm2
andfilesystems
Rebuild the ram image:
Arch Linux:
===========
mkinitcpio -p linux
Edit /etc/fstab
:
- Change the root partition filesystem from
ext4
tobtrfs
- Change the mount options to
noatime,compress=lzo,defaults
Reboot to make sure it all boots up properly.
NOTE: Adding
compress=lzo
to the mount options will only compress new files
To compress pre-existing files:
btrfs filesystem defragment -c lzo -v -r /
In a test VM, this yielded a 36% reduction in space utilization.