I’m typing this entry under Ubuntu 8.04, booted from an external USB disk. The initial installation of ubuntu was pretty straightforward, just make sure the external drive is connected when you boot the first time and in my case I had to replace all occurrences of hd1 with hd0 in /boot/grub/menu.lst after installation.

Afterwards I decided I wanted linux on a different external drive, so I copied the partition from one drive to the other using gparted copy-paste. Again, pretty straightforward, but remember to shrink the source partition first to prevent wasting time copying free space. Remember to install grub after copying: sudo grub-install –recheck /dev/sdc1 –root-directory=/mnt/x

All was well, until I noticed a new entry in grub’s boot menu, Dell Utility Partition, and I tried to boot from it. Not only did it not boot, it prevented linux from booting ever again.

To make a long story short, what happened was that something in the Dell Utility Partition marked the first partition as FAT16. Normally the first partition of the drive would be the Dell Utility Partition, but in this case I booted from another drive and the first partition was my linux partition.

Booting from my original linux and reinstalling grub using the above command line failed with error /mnt/x/boot/grub/stage1 not read correctly. This error is printed by the /usr/sbin/grub-install script where it checks whether grub can access the /boot/grub/stage1 file. This command failed because the partition got marked as FAT16. Apparently, mount doesn’t care about the partition’s type and will actually detect the file system, but grub just checks the type and uses the appropriate file system handler.

The fix: use fdisk to fix the partition type. Run sudo fdisk /dev/sdc, print the partition table using p, change the type of the partition using t. ext3 is partition type 83. After this, grub-install should complete successfully.