HOWTO Convert Filesystems
From Gentoo Linux Wiki
| Installation • Kernel & Hardware • Networks • Portage • Software • System • X Server • Gaming • Non-x86 • Emulators • Misc |
Contents |
[edit] Introduction
This will work for these filesystems:
[edit] Warning
- Note sys-apps/convertfs has been removed from portage (see below referenced bug).
Best way is the simple way - boot from a live cd, mount the partition you wish to convert (read-only), then copy to somewhere useful (an external USB drive for example) using something like 'cp -dPRp'; unmount the copied partition, reformat it with the new filesystem, mount it back up and copy everything back.
From here on, the method requires sys-apps/convertfs which is no longer provided, or considered safe. Also the claims about O(N) don't appear to hold up.
- This can cause corrupt filesystems. Always backup your data.
There are some reports of severe data corruption - be warned
Please read Bug 107635 before continuing.
If the partition you are converting is big and full of data be prepared for a really long wait, the conversion cannot be interrupted (it will result in a damaged/corrupted filesystem depending on the stage). The complexity of the algorithm used is O(N) where N is the size of the filesystem.
[edit] Getting Started
First:
emerge convertfs
Next get yourself a gentoo ISO
Reboot with the cd in the drive and mount your root partition
mount /dev/hdxx /mnt/gentoo
Now copy the following files from /mnt/gentoo/sbin/ to /tmp/:
- convertfs
- convertfs_dumb
- devclone
- devremap
- prepindex
Set your path to include /tmp via export PATH=$PATH:/tmp
Rename convertfs to convfs, because convertfs wants to create a directory named convertfs in /tmp.
Now unmount the drive
umount /mnt/gentoo
[edit] Converting the Partition
Now convert the partition
cd /tmp/
convfs /dev/hdxx current_fs new_fs
After the conversion is done it's probably a good idea to run fsck
- reiserfsck program is used to check and repair a linux reiserfs filesystem.
- xfs_repair program is used to repair a linux xfs filesystem.
- fsck.jfs program is used to check and repair a linux jfs filesystem.
- e2fsck program is used to check and repair a linux ext2 or ext3 filesystem.
So something like:
fsck.jfs /dev/hdxx
[edit] Checking The New System
Next, mount the filesystem,
mount /dev/hdxx /mnt/gentoo
and then proceed to edit /mnt/gentoo/etc/fstab to use the correct filesystem, reboot, and you're done..
