Convert file systems with Fstransform

Few people know that they can convert their filesystems from one type to another without losing data, i.e. non-destructively. It may sound like magic, but Fstransform can convert an ext2, ext3, ext4, jfs, reiserfs or xfs partition to another type from the list in almost any combination. More importantly, it does so in-place, without formatting or copying data anywhere. Atop of all this goodness, there is a little bonus: Fstransform can also handle ntfs, btrfs, fat and exfat partitions as well.

Before you run it

There are certain caveats and limitations in Fstransform, so it is strongly advised to back up before attempting a conversion. Additionally, there are some limitations to be aware of when using Fstransform:

  • Both the source and target filesystems must be supported by your Linux kernel. Sounds like an obvious thing and exposes zero risk in case you want to use ext2, ext3, ext4, reiserfs, jfs and xfs partitions. Fedora supports all of that just fine.
  • Upgrading ext2 to ext3 or ext4 does not require Fstransform. Use the Tune2fs utility instead.
  • The device with source file system must have at least 5% of free space.
  • You need to be able to unmount the source filesystem before you begin.
  • The more data your source file system stores, the longer the conversion will last. The actual speed depends on your device, but expect it to be around one gigabyte per minute. The large amount of hard links can also slow down the conversion.
  • Although Fstransform is proved to be stable, please back up data on your source filesystem.

Installation instructions

Fstransform is already a part of Fedora. Install with the command:

sudo dnf install fstransform

Time to convert something

Converting one file system to another in-place can take a while

The syntax of the fstransform command is very simple: fstransform <source device> <target file system>. Keep in mind that it needs root privileges to run, so don’t forget to add sudo in the beginning. Here goes an example:

sudo fstransform /dev/sdb1 ext4

Note that it is not possible to convert a root file system, which is a security measure. Use a test partition or an experimental thumb drive instead. In the meantime, Fstransform will through a lot of auxiliary output in the console. The most useful part is the estimated time of completion, which keep you informed about how long  the process will take. Again, few small files on an almost empty drive will make Fstransform do its job in a minute or so, whereas more real-world tasks may involve hours of wait time.

More file systems are supported

As mentioned above, it is possible to try Fstransform with ntfs, btrfs, fat and exfat partitions. These types are very experimental, and nobody can guarantee that the converion will flow perfect. Still, there are many success stories, and you can add your own by testing Fstransform with a sample data set on a test partition. Those additional file systems can be enabled by the use of the –force-untested-file-systems parameter:

sudo fstransform /dev/sdb1 ntfs --force-untested-file-systems

Sometimes the process may iterrupt with an error. Feel free to repeat the command again — it may eventually complete the conversion from second or third attempt.

Fedora Project community


  1. Oadmin

    Am one of the few people who didn’t know you can change filesystems type without losing data.
    Great write up.

  2. Triet

    Btrfs has it’s own conversion utility, so if that’s the route you’re taking, then btrfs-convert may be your best bet.

  3. Barry

    “The more data your source file system stores, the longer the conversion will last. ”

    Should this be the longer the conversion will take?

  4. The transfer-tool sounds great. After simple search, found it’s an open source project. Cool…

  5. I was not aware of it. Thank you for sharing!!

  6. Costa A.

    That tool is going to be useful if and only if the time it takes to convert from a file system to another is less than backing up your data, convert with gdisk/fdisk, restore data.

  7. I wanted to convert a 875 GB partition from xfs to ext4. There are about 110 GB of files on the partition. I first saved the contents of the partition to another partition and ran fstransform. After copying the files to a loop file, fstransform reported an error on the unmount. I stopped fstransform, unmounted the partition and ran fstransform again. This time it ran for about 5 hours and eventually completed. The partition is now ext4 as I wanted. Opening the partition in Files gives “Folder is Empty”. Starting GParted shows the partition as 119 GiB used. So why is the “folder” empty?

    Seems to me that copying the contents of the partition to another partition, unmounting and deleting the partition, then formatting it for ext4, mounting the partition, and then copying the files back would be a lot faster (1 to 1 1/2 hours in total) and would actually work. Am I missing something?

    • You are not missing anything. If you have the space for a backup on reasonably fast media, backup, reformat, restore is the safest and fastest option. I have had systems that had incremental remote backup only (for disaster recovery), and no space for a copy. In that situation, this would be handy. If fstransform fails – just reformat and spend a day or so restoring from the remote backup.

  8. ray

    can I convert an old msdos game on cd to run on linux?

Comments are Closed

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat. Fedora Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora logo is a trademark of Red Hat, Inc. Terms and Conditions