Reconfigure to boot from extended partition?

Rashkae ubuntu at
Mon Aug 27 16:38:08 UTC 2007

NoOp wrote:
> Is it possible to reconfigure an extended partition so that it is bootable?
> On the first ubuntu system that I set up last year I screwed up and
> created the ubuntu partition as extended rather than ext3 etc. The
> problem that I have now is that I must have the windows drive in the
> system for it to boot. If possible I'd like to reconfigure the second
> drive (linux) so that it can boot on it's own, but still retain all of
> the data & configuration that exists on it. I'd also like to configure
> so that I can still dual boot into the windows drive. The drives are
> configured as:
> $ sudo fdisk -lu
> Password:
> Disk /dev/hda: 19.2 GB, 19259154432 bytes
> 240 heads, 63 sectors/track, 2487 cylinders, total 37615536 sectors
> Units = sectors of 1 * 512 = 512 bytes
>    Device Boot      Start         End      Blocks   Id  System
> /dev/hda1   *          63    30088799    15044368+   7  HPFS/NTFS
> /dev/hda2        30088800    37603439     3757320    f  W95 Ext'd (LBA)
> /dev/hda5        30088863    37603439     3757288+  82  Linux swap / Solaris
> Disk /dev/hdb: 41.1 GB, 41110142976 bytes
> 255 heads, 63 sectors/track, 4998 cylinders, total 80293248 sectors
> Units = sectors of 1 * 512 = 512 bytes
>    Device Boot      Start         End      Blocks   Id  System
> /dev/hdb1              63    80292869    40146403+   5  Extended
> /dev/hdb5             126      498014      248944+  83  Linux
> /dev/hdb6          498078    80292869    39897396   83  Linux
> Relevant parts of menus.lst:
> title		Ubuntu, kernel 2.6.20-16-386
> root		(hd1,4)
> kernel		/vmlinuz-2.6.20-16-386 root=/dev/mapper/Ubuntu-root ro acpi=off
> noacpi vga=0x0319 splash vga=788
> initrd		/initrd.img-2.6.20-16-386
> savedefault
> ....
> # This entry automatically added by the Debian installer for a non-linux OS
> # on /dev/hda1
> title		Microsoft Windows 2000 Professional
> root		(hd0,0)
> savedefault
> makeactive
> chainloader	+1
> Note: I've backed up the important data on the linux drive.
> Can I simply reinstall grub and tell it to boot from hdb? ala:
> or will that just make matters worse?

So, if I understand you correctly, you want to be able to add/remove the 
Windows Drive at will, but always be able to boot into Linux?

This is certainly not a problem, and having installed Linux on an 
Extended partition will not be a barrier at all.  The only downside I 
see is that your Swap partition is located on your Windows drive, so 
removing that drive will also deprive you of any swap (and indeed, might 
cause booting problems with swap defined in your /etc/fstab)

In any case, to make hdb bootable, you can do the following:

Boot into linux and run grub shell

#sudo grub

Once in the grub shell, issue the following commands.

device (hd0) /dev/hdb
root (hd0,4)
setup (hd0)


you should then be able to boot from your Linux drive only.  However, 
you'll have to edit the boot options if you do so.  (When grub first 
starts, press ESC to display the boot menu, press e key to edit the 
Linux entry, scroll down to the root (1,4) and change it to root (0,4)

The drive your bios boots from is always hd0 to grub.  If you plan on 
removing the Windows drive often, I would switch them around so Linux is 
always on Drive 0 and windows is on drive 1.  (This will require a minor 
edit to the /boot/grub/menu.lst file for Windows to boot.), but if Linux 
is on hda and windows on hdb, then you will no longer have to edit the 
boot options when you want to boot Ubuntu with the Windows drive removed.

More information about the ubuntu-users mailing list