I've got myself in a pickle

I’ve got myself in a bit of a pickle.

I’ve got 1 hard disk drive and was trying to load a second external drive. With the 2nd drive turned off, my first hard disk drive is partitioned like this…

SDA1 Linux Native Ext3
SDA2 Linux Native Ext4
SDA3 Linux Native Ext4 /
SDA4 Extended
SDA5 Linux Swap
SDA6 Linux Native Ext3 /home

SDA1 Contains OpenSUSE 11.1
SDA2 Contains OpenSUSE 11.2
SDA3 Contains OpenSUSE 11.3

I tried to mount the 2nd (external) drive by editing /boot/grub/device.map but I must have made an error, because now it boots directly into sda1 openSUSE 11.1 and when I try to look at SDA2/SDA3 it say’s Invalid System Type. Presumably because they’re formatted with Ext4. So I can’t edit back my device.map file.

What I want to do is boot into SDA3 OpenSUSE 11.3. Would anybody know why it’s only booting to SDA1 and/or have any suggestions to get me back booting to SDA3? This may be a 2 step process, because I may have to boot to SDA2 first so I can edit back my /boot/grub/device.map on SDA3 before finally booting to SDA3.

You don’t have to edit device.map to add external disks. In fact you don’t have to edit device.map at all, and this file is only needed while using grub in a shell. You must have done something else, like reinstalling Grub or booting into another partition with the makeactive option. More likely you have a Grub installed on sda1 with a short timeout and no entries for your other Linux versions in its menu and this partition has become the active one. You have to use fdisk to set the bootflag on the partition containing the Grub you were using before. I would recommend to set the bootflag on sda3, as it is the last one you installed and ist menu might include entries to boot the other versions.

  • I’m assuming you removed your external disk and boot from the one hd.

Once you are in openSUSE 11.3, you should install grub in MBR.

booting into another partition with the makeactive option

I did this but it was on a partition on the external drive. Not on SDA1. Ah! I remember now my system would only save to SDA1 but not to SDB1. So the makeactive option was installed onto SDA1.

I have grub installed on SDA1 SDA2 and SDA3. The latest version SDA3 has 11.1 and 11.2 on the boot menu but of course SDA1 only has 11.1 on it. I see the menu for about 10 seconds when SDA1 is booting. It only has 11.1 and Failsafe 11.1 on the menu.

I don’t know how to use FDISK from the command line to set to bootflag to SDA3. The help wasn’t very informative either. Could you give me the command line to do this?

Here is my Terminal session. Nothing is altered after a reboot. Even Expert Partitioner says SDA2/SDA3 are unused. I think the problem is I’m in 11.1 which doesn’t recognise EXT4 formats?

linux-bkqm:~ # fdisk -l /dev/sda

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xe466e466

Device Boot Start End Blocks Id System
/dev/sda1 * 1 1306 10490413+ 83 Linux
/dev/sda2 1307 2612 10490445 83 Linux
/dev/sda3 2613 3918 10490445 83 Linux
/dev/sda4 3919 60801 456912697+ f W95 Ext’d (LBA)
/dev/sda5 3919 4140 1783183+ 82 Linux swap / Solaris
/dev/sda6 4141 60801 455129451 83 Linux
linux-bkqm:~ # fdisk /dev/sda3

The number of cylinders for this disk is set to 1306.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:

  1. software that runs at boot time (e.g., old versions of LILO)
  2. booting and partitioning software from other OSs
    (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition’s system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): a
Partition number (1-4): 3
Warning: partition 3 has empty type

Command (m for help): v
20980889 unallocated sectors

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
linux-bkqm:~ #

You did half of the job. You have to toogle the bootflag on the two partitions, the one you want to set it off and the one you want to set it on.
So : a - 1 and a - 3.
I don’t know why fdisk complains about an empty type on partition 3 while fdisk -l shows 0x83 (?)
You can try :

file -s /dev/sda*

to see more.

  • Press escape to leave gfxmenu
  • Press ‘c’ to get a shell
  • At the Grub prompt, type the commands in red :
grub> root (hd0,2)
 Filesystem type is ext2fs, partition type 0x83
grub> chainloader +1

grub> boot

Toggling both a and c did the trick. I’m now back in 11.3. Thank you very much.