One of the recent big changes in Jaunty and Karmic is the support for ext4. So I wanted to test ext4 , of course, without formatting the hard disk. So here are the steps I followed .(Warning – The steps below had worked for me – But I guess you will be better off doing more self-research before taking these steps).
Installing GRUB 2 :
I read some articles in net saying that ext4 needs Grub 2 – I was not able to confirm it but since I had lot of data in my hard disk , I decided to take the safer route. (Warning – Grub 2 from standard Ubuntu repository was in beta4 when I wrote this post).
1) To install Grub 2 use sudo apt-get install grub2 . During the post installation trigger, you will get a dialog box asking if you want to ‘Chainload into Grub 2′. Select that option.
2) Reboot the computer and keeps your finger crossed.
3) In the new Grub menu option screen, you will get an option for ‘Chainload into Grub 2′. Select the option. At the top , it will say Grub version 1.97. If so you have got the right version.
4) If every thing went fine then run the command sudo upgrade-from-grub-legacy in a terminal. This will make your system use Grub 2 permanently.
Update : As per Eric’s comment, I wanted to make the instructions a little bit clearer. It is a better idea to run the fsck on a unmounted partition. So if you trying to convert your root partition to ext4 , then doing it from a LiveCD is a good idea . If it is a non root partition, unmount it first and perform the steps.
1) Use df or partition manager to find the partition that you want to convert to ext4. In my case , I wanted to convert my root partition so it was /dev/sda1.
2) Run the command : sudo tune2fs -O extents,uninit_bg,dir_index /dev/<partition>. (Replace <partition> with the actual partition you found in step 1 – eg /dev/sda1)
3) Do a file check on your partition. sudo e2fsck -pf /dev/<partition>. Running fsck also internally calls e2fsck when the device has extx format – so you can call the command as sudo fsck -pf /dev/<partition> too . In my case since the root partition was affected, I had to reboot, go into the recovery mode , enter the Console login option and run the command. A safer alternative I guess would have been to run all the steps using Ubuntu LiveCD.
4) Once the file check finishes, mount the file system again sudo mount -t ext4 /dev/<partition> /mnt. Inspect it to make sure everything is fine.
5) To make the system always mount the partition as ext4, you must alter the fstab. Assuming you have mounted at /mnt , vim /mnt/etc/fstab.
6) In the fstab file , find the entry for the partition you converted to ext4. Change the mounting option from ext3 to ext4. Save the file.
7) Now you want to reinstall the grub on your new shiny ext4 partition. sudo grub-install /dev/<device name> where <device name> is obtained by removing the digit from the partition you were using all along ie /dev/sda instead of /dev/sda1.
8 ) Reboot your computer. To find all your ext4 partitions use the command df -t ext4 in the terminal. Make sure the partition you modified is in the list.
So those were the steps to install Grub2 and ext4. Hope the upgrade goes fine !!