Talk:Conversion from Ext3
Hi Devs, Admins,
The link on the Main Page to this particular page (as of 23/01/09, 18:33 GMT) says, 'Conversion from Ext3 and Ext4'.
However, this page talks about the conversion of ext3 to btrfs only: there is no mention of ext4, or ext4 compatibility with this method.
As there are many major differences in ext4, I think there should be some clarification. Particularly as ext4 is due to be supported in Ubuntu 9.04, and will be the default FS in Fedora 11, there will most-likely be a lot of ext4 users wishing to migrate to btrfs when it is stable. :)
- It is possible to convert EXT4 to btrfs and back again. I've done it numerous times. Nutznboltz 19:37, 15 June 2011 (UTC)
Convert from ANY to btrfs
I just created an account to give you this algorithm. It uses only the Linux FIBMAP and FIGETBSZ ioctls.
- On old filesystem create a huge file using "cp /dev/zero NewFilesystem" or more safely use a special pattern that repeats every 512 bytes to mark the free sectors. (You can use multiple 2Gb files for FAT32 etc)
- Unmount then remount the old filesystem read only. (So you don't change last access times, noatime would be ok)
- Read the block numbers allocated in your NewFilesystem file.
- On the raw device construct your new empty filesystem in the space allocated to the NewFilesystem file. You should check that any block you use has your magic pattern from step 1.
- On this new filesystem create the "old_filesystem_image" file from sectors NOT in the NewFilesystem file.
- Create the snapshot.
- Create the new filesystem by creating all the new filesystem structures using block numbers or copied files (small files) from the old mounted filesystem. This is a normal "mirror" operation except you are creating the filesystem using userspace tools not the kernel driver.
End result, you can copy any filesystem that understands the normal file operations plus FIBMAP.