Deleting sda partition on multi OS disk, will cause grub booting problems?

Hi all

I have a question (probably stupid). Let me first describe the situation.

That is my disk

 fdisk -l
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1        3724    29912998+  83  Linux
/dev/sda2           29256       30401     9205245    7  HPFS/NTFS
/dev/sda3            3725        4271     4393777+   5  Extended
/dev/sda4   *        4272       12104    62918572+  83  Linux
/dev/sda5            3725        4271     4393746   82  Linux swap / Solaris

I want ot install a new opensuse 11.4 as yest another OS. Due to the fact that I already have 4 sda partitions, I have to make some changes. What I am thinking about is to copy the sda2 (windows recovery) data to some folder etc (nevermind), then delete the sda2. Then I want to create a new primary partition for the new suse 11.4 and install it. What is worying me is the grub boot menu. I was planning to edit the new one (the opensuse 11.4), with old data.

###Don't change this comment - YaST2 identifier: Original name: linux###
title Desktop -- openSUSE 11.2 -
    root (hd0,3)
    kernel /boot/vmlinuz- root=/dev/disk/by-id/ata-Hitachi_HTS542525K9SA00_080105BB0F00WDHE41DC-part4 resume=/dev/disk/by-id/ata-Hitachi_HTS542525K9SA00_080105$
    initrd /boot/initrd-

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 11.2 -
    root (hd0,3)
    kernel /boot/vmlinuz- root=/dev/disk/by-id/ata-Hitachi_HTS542525K9SA00_080105BB0F00WDHE41DC-part4 showopts apm=off noresume nosmp maxcpus=0 edd=off powersa$
    initrd /boot/initrd-

###Ubuntu confs
title Ubuntu 9.04, kernel 2.6.28-13-generic
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.28-13-generic root=UUID=9e73a658-582c-4b31-a7cd-c3121d91e899 ro quiet splash
    initrd /boot/initrd.img-2.6.28-13-generic

title Ubuntu 9.04, kernel 2.6.28-13-generic (recovery mode)
    root (hda0,0)
    kernel /boot/vmlinuz-2.6.28-13-generic root=UUID=9e73a658-582c-4b31-a7cd-c3121d91e899 ro  single
    initrd /boot/initrd.img-2.6.28-13-generic

Now my question is will the settings of (hda0,n), change due to the fact that I have deleted the sda2? I have a lot of unused space at the end of my disk and want to create a new “sda2” there.

I don’t understand why you do have an extended partition which contains only a swap partition. But you probably don’t know either. Do you?
Anyway, to answer your question, if you do not intend to create more partitions, you don’t need to ‘delete’ sda2, you just need to reformat it. It’s not the same. By deleting a partition, you modify its geometry and write to the partition table, while by reformating a partition, you just modify its content without changing its geometry. The later is safer.

Ubuntu default installation procedure.

I want to change the size of sda2, currently is around 9GB and I have a lot of free space at the end of disk, which I am planning to use. So my guess is that I would need to delete it.

IMHO, you should resize the /dev/sda4 partition smaller if it is not full, creating the free space between your sda4 and sda5.
Then move it to the end of the drive, using Gparted LiveCD.
Using sda2 without moving it to the end of the drive might cause you problems with grub, ie, location of partitions change.

Alternatives, virtual machine with Xen or VBox to emulate openSUSE.

To clarify a bit what please_try_again wrote, you seem to think that you can have only four partitions (saying:

Due to the fact that I already have 4 sda partitions, I have to make some changes
). This is not the case. You only can have four PRIMARY partitions. That is not to say that you haven’t a strange set-up. There are four Primary partitions of which one is a the Extended partition (sda3), but it sits somewhere in the middle (even before sda2) and is filed up with only one Logical partition (sda5).

Also, out of some strange idea to spare us some reading, your* fdisk -l* listing is incomplete, thus we have to guess e.g. how big the disk is.

Thx all for your help :), things are lot more clear now :).

Yes you are right I used a couple of shortcuts and I’ve “cut” the fdisk to make the post shorter. Now I see that it was a bad idea ;).

You should not worry about changes which might or might not occure depending on what you’re going to do with your partitions and just read some documentation (or some posts in this forum) about how to reinstall both Grubs (Legacy and Grub2) as well as edit the menu for Legacy Grub (usually not needed for Ubuntu, where running ‘update-grub’ refreshes the boot menu). This surely won’t hurt to learn it before partitioning.
Without touching sda1 and sda4, here’s what I would do.

[li]delete sda2 and sda3 (which means delete sda5 before)
[/li][li]create a primary partition in the whole space right after sda1. It will become sda2.
[/li][li]sda4 will become sda3
[/li][li]create an extended partition including all unallocated space at the end of the disk, right after the last primary partition (sda3 or sda4, depending when you look at it).
[/li][li]In this extended partition, create:
[li]a partition for swap. (sda5)
[/li][li]a partition for /usr (sda6) (I’ll explain why later)
[/li][li]a partition for /home (sda7)
[li] Install openSUSE selecting “Create partition setup” and expert mode during setup and select the following partitions:
[li]sda2 for / (ext4)
[/li][li]sda5 for swap
[/li][li]sda6 for /usr (ext4)
[/li][li]sda7 for /home (ext4)

A separate /usr partition will allow you to use sda2 (which would have been to small otherwise) as / for openSUSE. Notice that “/usr” has nothing to do with users. It means “unix system resources” and is the largest of all directories under Linux. The partition dedicated to users is /home.

There is no ideal partition setup and be prepared to get other advice. It depends on what you are doing, as well as distros choices and the circumstances (in this particular case, that would have been making the most reasonnable use of the freed space in what was previously your ‘misplaced’ extended partition - although it is perfectly legal to have the extended partition in the middle … but unclean somehow.)

Don’t believe those who are going to tell you (as I’ve often read here) that having / on a primary or logical partition is the same thing - although it works similarly well, it doesn’t mean that you should not preferably put / in a primary partition whenever it is possible.


Simple overview of my disk (old partitions) (250GB)
sda1 (ubuntu) sda3 (extended + swap sda5 around 4GB) sda4 (suse 11.2) … free space 130GB … sda2 (windows recovery)

What I did was deleteing the sda3 (with sda5), recreating it in the free space, with sda5 as suse 11.4 and sda6 as swap. In the future I will expand the sda1 with additional 4GB, or maybe clear the whole disk and start over once I get a new cd drive (current one is broken).

Actually as you can see this is exactly what I did (in the opposition of what I intended to do in the first place), I found couple of post etc, saying that this is a good “solution/workaround” for the 4 primary partitions limitation. Can you tell my why I should not prefer this, or give me some link to explanation?

A *complete" fdisk output also provides a simple overview. :wink:

This is OK. But you’ll have to change the UUID of the swap partition in Ubuntu’s /etc/fstab, because the UUID changes when you reformat/recreate a partition and Ubuntu uses this syntax (openSUSE uses another notation).

I don’t like the idea of expanding Linux filesystem. It’s possible but … Well, you can do that. It’s legal. I would have created another primary in that space and install the / of whatever Linux. But, you know, with partitioning, there are just too many possibilities and philosophies. Some are worse than others though.

This is true. This is a good solution if you don’t have the choice. In your case, you have the choice (sda2). / is the most important. Linux will boot without swap and without /home but it won’t without /. And a primary partition is a safer place. I can tell you where to find the geometry (start sector and size) of sda2, while I couldn’t tell where to find the geometry of sda6 (without knowing where the extended partition starts to find out where sda5 starts, to finally find out where the geometry of sda6 is written on disk). So put the most important stuff in the safest place, as you would do in real life. From the system point of view, Linux indeed doesn’t care. So having / in a logical is not a problem. It is only harder to recover in case of a castastrophe. Sometimes … there are catastrophes. Also a primary partition can boot directly while a logical one can not (needs a boot manager installed either in MBR or in another primary). That’s why openSUSE installs Grub bootloader in the bootsector of the extended partition if you install / in a logical. OK … I’ll stop here. :wink:

thx for info :slight_smile:

Pls do responders a favor by posting an unaltered fdisk -l There’s plenty of problem solving tools that provide good clear information. You can explain, label in commentary later.