5.11.1 Converting a Non-root File System

Caution

Before performing a file system conversion, make a backup of the file system from which you can restore its state.

To convert an ext2, ext3, or ext4 file system other than the root file system to btrfs:

  1. Unmount the file system.

    # umount mountpoint
  2. Run the correct version of fsck (for example, fsck.ext4) on the underlying device to check and correct the integrity of file system.

    # fsck.extN -f device
  3. Convert the file system to a btrfs file system.

    # btrfs-convert device
  4. Edit the file /etc/fstab, and change the file system type of the file system to btrfs, for example:

    /dev/sdb               /myfs          btrfs    defaults  0 0
  5. Mount the converted file system on the old mount point.

    # mount device mountpoint