Converting an Ext File System to a Btrfs File System
You can use the btrfs-convert utility to convert an
ext
file system to a Btrfs file system. The utility preserves an image of
the original file system in a snapshot named extN_saved
,
such as ext4_saved
. With this snapshot, you can roll back the conversion,
even if you have modified the btrfs
file system.
Note that you can't convert the root file system or a bootable partition, such as
/boot
, to Btrfs.
Note:
The conversion to Btrfs isn't supported on the Arm (aarch64) platform. If you're running Oracle Linux 8 on the aarch64 platform, you can migrate data from one file system to another file system.
If you convert the root file system to Btrfs, you can use snapshots to roll back changes such as upgrades that you have made to the file system.
Converting a Non Root File Ext File System to a Btrfs File System
Caution:
Before performing a file system conversion, back up the file system from which you can restore its state.
To convert an ext
file system other than the
root file system to Btrfs:
-
Unmount the file system.
sudo umount mountpoint
-
Run the correct version of fsck (for example, fsck.ext4) on the underlying device to check and correct the integrity of file system.
sudo fsck.extN -f device
-
Convert the file system to a btrfs file system.
sudo btrfs-convert device
-
Edit the file
/etc/fstab
, and change the file system type of the file system tobtrfs
./dev/sdb /myfs btrfs defaults 0 0
-
Mount the converted file system on the old mount point.
sudo mount device mountpoint