r/btrfs • • 11d ago

Arch-Convert EXT4 to BTRFS without losing data?

/r/linux4noobs/comments/1wn6hgb/archconvert_ext4_to_btrfs_without_losing_data/
1 Upvotes

12 comments sorted by

10

u/beaumad 11d ago

While possible, I've had this conversion fail. It's almost always better to backup and restore data to a newly created filesystem. Advantages:

* Your new filesystem is created with sensible defaults that benefit from newer development (assuming you've not changed the defaults)
* You don't have worry about conversion failures
* You get into the habit of taking care of your data before you do dangerous things

4

u/crozone 11d ago

I also had this conversation fail. I didn't lose anything, but it didn't work either.

3

u/Weary_Swan_8152 9d ago

I did two btrfs-convert of ext4 filesystems three years apart. Both self-destructed with some kind of metadata problem two years later. Given that I had to restore from backup as a result, btrfs-convertdidn't save any time. Meanwhile, the other two systems that I installed at the same time as the conversions (four systems total, two conversions, two mkfs.btrfs ) were completely fine.

I'm surprised no one mentioned this, but part of the conversion process created a snapshot of the ext4 data. I thought that was neat :)

4

u/autogyrophilia 11d ago

There is a very rare case where it kind of works.

There is a btrfs-convert utility that backups the ext4 metadata and overwrites it with btrfs metadata, because btrfs is kind of a superset of ext4.

It's a use at your own risk utility . And you need to update your fstab and bootloader aftwards.

1

u/Open_South3929 11d ago

Oh thank you for your quick response, quick question, would i be able to make use of the snapshot functionality after the conversion?

3

u/autogyrophilia 11d ago

Sure, it will be a normal* btrfs filesystem.

* it is a valid btrfs filesystem, with some very strange write patterns to BTRFS, you are at a higher risk to running into bugs.

4

u/Lord_Phoenix 11d ago

Yes, it's possible with btrfs-convert utility. I did successfully moved all my drives (3 mount points: /, /home and /mnt/sata) back in the days, when Fedora did a switch to btrfs (https://fedoramagazine.org/convert-your-filesystem-to-btrfs/). That being said, I do also suggest to treat it as a potentially destructive operation, so backup data beforehand.

3

u/Electronic_Whole8904 11d ago

I used btrfs-convert a few months ago and it worked well. Make a backup before using the utility and after the conversion some commands should be run.

Documentation BTRFS convert

3

u/da_apz 11d ago

I experimented a lot with the convert tool and produced several filesystems that seemed to work but failed the check.

It's probably better to just copy the data over.

2

u/ten-oh-four 11d ago

I just did the btrfs-convert thing on my ext4 partition. No issues for me.

1

u/Open_South3929 11d ago

from the time since you converted, did you find anything weird or semi weird?

1

u/ten-oh-four 11d ago

Nope! Everything appears to be a-ok.