Skip to content

Latest commit

 

History

History
58 lines (45 loc) · 1.23 KB

Convert-EXT4-to-BTRFS.md

File metadata and controls

58 lines (45 loc) · 1.23 KB

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, Add btrfs between lvm2 andfilesystems

Rebuild the ram image:

Arch Linux:
===========
mkinitcpio -p linux

Edit /etc/fstab:

  • Change the root partition filesystem from ext4 to btrfs
  • 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.