Converting a root filesystem from Reiserfs to XFS
This is a section of my adventures into install Linux on a laptop. This page is meant to explain how I converted from a Reiserfs root filesystem to an XFS root filesystem on a system with limited disk space.
After my installation of Debian GNU/Linux with Reiserfs support I ended up with a disk layout of :
hda1 /boot ext2 7MB hda5 / reiserfs 2GB hda6 -swap- 96MB
After installing and looking into other peoples experiences with laptop and also information about Reiserfs I came to the conclusion that I would like to preserve battery power on my laptop as long as possible but the noflushd daemon would not work along side the reiserfs filesystem so I decided to look for an alternative filesystem. I could have gone for ext2 but seeing as this laptop is a bit of an experiment/toy I thought I would try out XFS.
hda1 /boot ext2 7MB hda5 / reiserfs 1.1GB hda6 / ext2 0.9GB hda7 -swap- 96MB
This obviously took a while. After it had finished I edited my lilo.conf and /etc/fstab to change instances of hda5 to hda6, not forgetting to change /mnt/etc/fstab as well!! Also changing the filesystem of / in the fstab to ext2.mount -t ext2 /dev/hda6 /mnt cd / tar lvcf - . | (cd /mnt ; tar xpvf -)
mkfs_xfs -f /dev/hda5 (-f to force overwrite of reiserfs) mount -t xfs /dev/hda5 /mnt
Then I checked my lilo.conf and fstab (only /mnt/etc/fstab) change the root filesystem line tocd / tar lvcf - . | (cd /mnt ; tar xpvf -)
Then I rebooted again, first in single user just to check it worked ok then in full./dev/hda2 / xfs defaults 1 1
I'm not going to worry about mounting the fat16 partition so I didn't need to change the fstab. I double checked the lilo.conf and re-ran lilo just to be sure then rebooted in single user mode and grew the xfs filesystem to use the whole partition:hda1 /boot ext2 7MB hda5 / xfs 1.9GB hda5 -dos- fat16 40MB hda6 -swap- 96MB
xfs_growfs /dev/hda5
What I need to do is create a rescue disk with XFS support so I can boot off floppy and mount the root filesystem if I need to.
I did all this without doing any backups of my current setup. I had only recently installed a fairly plain Debian system so didn't have much to lose if I screwed it all up. I advise anyone else doing this to backup their data first.
Neil Cheshire - created - 25th July 2001