1

I have this setup:

image

I've decided to switch to Elementary OS Luna (fork of Ubuntu 12.04) as my main Linux distro. Now I need to delete my Ubuntu partition so I could add capacity to my eOS which only has 10Gb.

Currently my eOS is in /dev/sda9, and Ubuntu in /dev/sda8/. I forgot where my bootloader is installed, so I ran bootinfoscript, which returned this:

`============================= Boot Info Summary: ===============================

=> Grub2 (v1.99) is installed in the MBR of /dev/sda and looks at sector 1 of the same hard drive for core.img. core.img is at this location and looks in partition 94 for .

sda1: __________________________________________________________________________

File system:       ntfs
Boot sector type:  Windows Vista/7: NTFS
Boot sector info:  No errors found in the Boot Parameter Block.
Operating System:  
Boot files:        /bootmgr /Boot/BCD

sda2: __________________________________________________________________________

File system:       ntfs
Boot sector type:  Windows Vista/7: NTFS
Boot sector info:  No errors found in the Boot Parameter Block.
Operating System:  Windows 7
Boot files:        /bootmgr /Boot/BCD /Windows/System32/winload.exe

sda3: __________________________________________________________________________

File system:       ntfs
Boot sector type:  Windows Vista/7: NTFS
Boot sector info:  No errors found in the Boot Parameter Block.
Operating System:  
Boot files:        /bootmgr /boot/bcd

sda4: __________________________________________________________________________

File system:       Extended Partition
Boot sector type:  -
Boot sector info: 

sda5: __________________________________________________________________________

File system:       ntfs
Boot sector type:  Windows Vista/7: NTFS
Boot sector info:  According to the info in the boot sector, sda5 starts 
                   at sector 2048.
Operating System:  
Boot files:        

sda6: __________________________________________________________________________

File system:       swap
Boot sector type:  -
Boot sector info: 

sda7: __________________________________________________________________________

File system:       ext4
Boot sector type:  Grub2 (v1.99)
Boot sector info:  Grub2 (v1.99) is installed in the boot sector of sda7 
                   and looks at sector 851823520 of the same hard drive 
                   for core.img, but core.img can not be found at this 
                   location.
Operating System:  
Boot files:        /grub/grub.cfg /extlinux/extlinux.conf

sda8: __________________________________________________________________________

File system:       ext4
Boot sector type:  Grub2 (v1.99)
Boot sector info:  Grub2 (v1.99) is installed in the boot sector of sda8 
                   and looks at sector 860224256 of the same hard drive 
                   for core.img. core.img is at this location and looks 
                   for (,msdos9)/boot/grub on this drive.
Operating System:  Ubuntu 13.04
Boot files:        /etc/fstab

sda9: __________________________________________________________________________

File system:       ext4
Boot sector type:  -
Boot sector info: 
Operating System:  elementary OS Luna
Boot files:        /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img`

I need advice as to how to proceed. I mean, does removing the Ubuntu and the /dev/sda7/ partition NOT mess up my GRUB? Please help, thank you.

4

In general, there's no reason why you shouldn't be able to delete the Ubuntu partition or install Elementary OS on top of it.

In the vast preponderance of cases, Linux distros attempt to detect all available OS installations (including buggy, obsolete products from Redmond, WA), construct a boot menu based on the detected installations, and then install GRUB to the MBR of the boot drive. As such, your GRUB boot menu probably will be reconstructed from scratch when you install Elementary OS.

If the Elementary OS installation fails (more precisely, if it fails before it attempts to install GRUB), and assuming you haven't moved or resized any of the other partitions, you should still be able to boot to your other partitions using the leftover GRUB config in the bootblocks.

ADDENDUM: @d4ryl3 clarified his question by asking: "Will removing the Ubuntu and the /dev/sda7/ partition NOT mess up my GRUB?" The answer to that is, "Probably not."

It depends on who last installed GRUB, how GRUB is configured to look for partitions, and how you want to repartition your disk. If GRUB is configured to look for volume IDs or volume labels, then you'll probably be okay, since volume IDs generally don't change when partitions are moved around, and volume labels definitely don't (unless you do so explicitly).

If OTOH GRUB is configured to look for "raw" partition numbers, then you'll still probably be okay. /dev/sda7, for example, is known as /dev/sda7 by virtue of being the seventh entry in the partition table found in the MBR. "Deleting" a partition typically means marking a partition entry as invalid or hidden; it typically does not mean moving all the following entries up to fill the deleted entry, since doing so would cause all those entries to get new partition numbers. If partition numbers get changed, then the GRUB installation should be re-run so it knows the latest partition geometry.

The ways you can be bitten badly are if the partition entries are moved around, or the data blocks described by the partition are moved around and GRUB needed something out of where the data blocks used to be. Neither scenario appears likely in your case. However, you haven't described how you want to repartition the disk, which can affect the outcome.

Two things you should probably take care to do after repartitioning and before rebooting:

  • Re-run the system utility that detects all OS partitions and re-installs GRUB to the MBR.
  • Create a bootable USB stick with GRUB on it so you have half a chance of repairing any damage.
  • @ewhac Actually, eOS is already installed in /dev/sda9. I was just testing it and decided to keep it and ditch my Ubuntu installation. My question is will removing the Ubuntu and the /dev/sda7/ partition NOT mess up my GRUB? – d4ryl3 Oct 30 '13 at 7:09
  • @d4ryl3: Ah. The answer to that question is, "Maybe." Let me edit the answer a bit... – ewhac Oct 30 '13 at 19:44
  • @ewhac Thanks, sorry my question wasn't so clear but I've updated it. Well, Windows 7 was installed first, then Ubuntu, then eOS. After installing eOS, the only thing I did to add it to GRUB was sudo update-grub2. I did no other modifications to GRUB. Second, I wanted to delete /dev/sda7 and /dev/sda8 and add the unallocated space to /dev/sda9, bringing it to 40+GB. I think the swap partition needs to be moved, too. So that's how I want things to be. Still safe to proceed? Thanks for your time, by the way. – d4ryl3 Oct 31 '13 at 6:43
  • 1
    @ewhac Hey, man. I went ahead and used the eOS live CD, deleted both said partitions and moved the swap file to the end of the drive so I could resize my eOS. When I reboot, I got the error error file '/boot/grub/i386-pc/normal.mod' not found. I googled it, and just reinstalled GRUB on my eOS partition (which is now /dev/sda and I was able to boot again. I just did a sudo update-grub2 to update the GRUB entries. You're right in setting up expectations. Thanks. :) – d4ryl3 Nov 7 '13 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.