I wanted to get rid of my Ubuntu 10.04 partition in my netbook. I wanted to have enough free space to try to install and use other operative systems in my computer.
Ubuntu was the first GNU/Linux that I installed there, but it’s long time ago since I don’t use it (I also have Debian stable and Debian testing, and the old, preinstalled Windows XP which I neither use but I prefer not to delete for several reasons (I have no installation disks, sometimes I want to try other things for my friends and family which use Windows, and also for future BIOS updates).
In this post I will explain the “problems” that I had (it seems that I am clumsy enough to run into several beginner problems, but luckily (GIYF) I could solve them quite quickly).
Probably this is not an elegant way to do some things but it’s my personal experience, I hope it helps somebody.
So this was my Grub menu (the order of the items is not relevant):
Windows XP Ubuntu GNU/Linux 10.04 Debian GNU/Linux 6 (stable, Squeeze) Debian GNU/Linux 7 (Testing, Wheezy)
I booted in Debian testing (as usually), opened GParted and I had these partition in my disk:
/dev/sda1 >> Primary, NTFS, Windows /dev/sda2 >> Extended (the rest of the disk) /dev/sda5 >> ext4, Ubuntu /dev/sda6 >> ext3, Debian 6 /dev/sda7 >> ext3, Debian 7 /dev/sda8 >> swap
I tried to delete /dev/sda5 but it was not possible (GParted was requesting to “delete any logical partitions with a number higher than 5”). I didn’t want to do that! So I prepared a Live-USB with Puppy Linux (a nice way to give life again to old, small USB drives!) and booted my netbook with it. I tried again to delete /dev/sda5 but obtained the same message… I supposed that Puppy was using the swap partition /dev/sda8. I shrinked my NTFS partition, and created a new swap partition there. I swapped off /dev/sda8, swapped on /dev/sda3 (the new swap), and deleted /dev/sda8 and /dev/sda5. So my new partition table was like this:
/dev/sda1 >> Primary, NTFS, Windows /dev/sda3 >> Swap /dev/sda2 >> Extended (the rest of the disk) Free space (big enough to install new systems) /dev/sda6 >> ext3, Debian 6 /dev/sda7 >> ext3, Debian 7 Free space (small, around 2,8 Gb)
I could use the free space at the beginning of /dev/sda2 to install my new systems, but I don’t know why I thought that I could shrink the extended partition and later, with the new OS installer create a primary partition in the free space. So I did it.
And when I rebooted, I got the grub rescue prompt. I had lost my grub menu! (not sure if the reason was that it was written in the Ubuntu partition, or because of moving forward the start sector of the extended partition).
No panic, I still had my Puppy Live-USB. I booted again with it, and used Grub4Dos utility to install grub in my master boot record. I rebooted and I had a long, old-grub menu including Lupu (Puppy Linux from USB), and my other systems, but my Debian testing was not bootable. That grub menu included an entry “boot grub2” and I tried it, and from there I could boot my Debian testing. From there, I did sudo grub-install and installed Grub2 in my Master Boot Record, and solved the problem: all my systems were listed, and bootable from there.
Then I realised that with this configuration, I already had 3 primary partitions (NTFS, swap, extended) so if I wanted to install several systems in my free space it had been nonsense to shrink the extended partition. Time wasted isn’t it? Well, it was my free time, and I learned several things:
- When reorganizing partitions, think not only in what you want now, but in the future too.
- Always have a Live-CD or Live-USB system near!
- Some systems use/install grub, others grub2
- Grub may be installed to the MBR or a partition. If you plan to create and remove partitions maybe it is better idea to install grub in the MBR.