LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 04-26-2007, 10:49 PM   #1
VoidRoamer
LQ Newbie
 
Registered: Mar 2004
Distribution: Mandrake
Posts: 9

Rep: Reputation: 0
Partition rearrangement & dual booting Ubuntu/XP via GRUB


Hello,

I currently have Ubuntu (ext3) and WinXP (ntfs) set up do dual-boot on my PC using two 80GB HDDs. I have just upgraded my system and wish to move my existing partitions to my new 320GB SATA drive, use the 80GB SATA drive for backups and remove the 80GB PATA drive.

I have succeeded moving my Ubuntu partitions, dd'ing them from the old 80GB SATA drive they were on to the 320GB SATA drive and then modifying and reinstalling GRUB. Unfortunately, Windows just doesn't want to play nice, I can't reinstall or repair the existing installation since MS doesn't like to share, the XP installer bails since it can't overwrite the beginning of the drive where I have my linux ext3 partitions.

I have moved the Windows partition from hda1 to sda5, used the windows cd rescue console to reinstall the sda5 boot partition (not the MBR) and then included an appropriate entry in GRUB's config file. I had thought that doing so would establish the NT bootloader in sda5 and permit GRUB to chain it, but I was wrong. Usually GRUB reports either error 12: Invalid device or Invalid filesystem 0x7 (NTFS), once or twice I have actually gotten to the NT bootloader however it crashes the whole system at the very beginning of the process. Is the fact I am using a logical partition an issue?

Below is some relevant data on my system & confs, I would be greatful if anyone can help me here.

----------------------------------------

fdisk -l

Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 4863 39062016 83 Linux
/dev/sda2 4864 4985 979965 82 Linux swap / Solaris
/dev/sda3 4986 19574 117186142+ 83 Linux
/dev/sda4 19575 38913 155340517+ 5 Extended
/dev/sda5 * 19575 20668 8787523+ 7 HPFS/NTFS
/dev/sda6 20669 27680 56323858+ 7 HPFS/NTFS
/dev/sda7 29179 38913 78196356 83 Linux

Disk /dev/sdb: 80.0 GB, 80025280000 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 4563 36652266 83 Linux
/dev/sdb2 4564 4629 530145 82 Linux swap / Solaris
/dev/sdb3 4630 9729 40965750 83 Linux

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 1020 8193118+ 7 HPFS/NTFS
/dev/hda2 1021 9729 69955042+ f W95 Ext'd (LBA)
/dev/hda5 1021 8709 61761861 7 HPFS/NTFS
/dev/hda6 8710 9729 8193118+ b W95 FAT32

----------------------------------------

cat /boot/grub/device.map
(same ordering as BIOS boot order)

(fd0) /dev/fd0
(hd0) /dev/sda
(hd1) /dev/sdb
(hd2) /dev/hda

----------------------------------------

cat /boot/grub/menu.lst
(excerpt)

title Ubuntu, kernel 2.6.17-11-generic
root (hd0,0)
kernel /boot/vmlinuz-2.6.17-11-generic root=/dev/sda1 ro quiet splash vga=794
initrd /boot/initrd.img-2.6.17-11-generic
quiet
savedefault
boot

title Microsoft Windows XP Professional
root (hd0,4)
savedefault
makeactive
chainloader +1

----------------------------------------

cat boot.ini

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(4)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(4)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /noexecute=optinroot

Last edited by VoidRoamer; 04-27-2007 at 01:42 AM.
 
Old 04-26-2007, 11:38 PM   #2
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
I could be mistaken, but from what I gather from similar experience recently on another machine here, Windows has to be in the first partition on a given disk. I think it won't work if it's elsewhere..
You are right about one thing for sure Windows does not like to share.. But it will if it's first in line
I am totally unsure as to whether it needs to be in a primary partition, or if a logical one is OK.
 
Old 04-27-2007, 01:17 AM   #3
samstar
Member
 
Registered: Apr 2007
Distribution: suse 10.2
Posts: 324

Rep: Reputation: 30
Hi,

As long as windows can have its OS loader installed in the primary active partition, then the rest can be installed in any other partitions. I've always installed it in the primary, though, 'cause it always plays better that way.

Here's a caveat, though:
Quote:
If you are installing Windows XP into a logical partition, and wish to leave unpartitioned space for other operating systems, you should manually create the Windows XP partition rather than allow the Windows XP installation to create it. This can be accomplished by using the Windows XP disk administrator, or manual partitioning with System Commander, Partition Commander or DriveWorks.
From http://www.v-com.com/support/sup_os_WinXP.html

Sam
 
Old 04-27-2007, 01:39 AM   #4
VoidRoamer
LQ Newbie
 
Registered: Mar 2004
Distribution: Mandrake
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by samstar
As long as windows can have its OS loader installed in the primary active partition, then the rest can be installed in any other partitions. I've always installed it in the primary, though, 'cause it always plays better that way.
Sam
What constitutes the OS loader though? I thought GRUB provides equivalent functionality? As for everything else, ntldr, boot.ini, ntdetect, etc all reside on the windows system partition (in this case sda5).

I would have thought that in theory, simply imaging my original XP partition hda1 to the new location on sda5, then running fixboot from the windows CD rescue console to install the sda5 boot record would be sufficient since the GRUB bootloader then chains the bootloader on the target partition. I don't know enough about the Windows boot process to be certain, hopefully somebody does.

(as an aside, I have added the contents of boot.ini to my original post)
 
Old 04-27-2007, 02:06 AM   #5
samstar
Member
 
Registered: Apr 2007
Distribution: suse 10.2
Posts: 324

Rep: Reputation: 30
Hi Void,

I was just quoting the page I linked to. That OS loader is the windows equivalent of grub. I'm not saying you have to install it. Grub will work instead.

I've always loaded the windows boot record on the primary MBR, regardless of where the windows files are, then overwritten it with a grub bootloader using a linux boot disk to repair the MBR and automatically configure the windows boot for me.
 
Old 04-27-2007, 09:16 PM   #6
VoidRoamer
LQ Newbie
 
Registered: Mar 2004
Distribution: Mandrake
Posts: 9

Original Poster
Rep: Reputation: 0
Hi again,

I just wanted to say thanks for the assistance but I've surrendered to inevitability and given up my backup drive to Windows since I don't intend on resizing/moving every partition on my HDD.

If anyone has a definitive answer to the aforementioned issue, I'd still be very interested in hearing it.
 
Old 04-28-2007, 02:51 AM   #7
samstar
Member
 
Registered: Apr 2007
Distribution: suse 10.2
Posts: 324

Rep: Reputation: 30
I think I found the solution for you in the grub manual. I think you have to 'hide' the partitions that come before the windows partition to get it to boot. It's at least worth a shot.

Under the "title Microsoft Windows XP Professional", add these lines:
Code:
unhide (hd0,4)
hide (hd0,0)
hide (hd0,1)
hide (hd0,2)
hide (hd0,3)
And, instead of "root (hd0,4)", add:
Code:
rootnoverify (hd0,4)
Leave the rest of the config the way it is.

Sam
 
Old 04-28-2007, 03:28 AM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,483

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
As samstar said above Windows requires a (active) primary partition for it's loader code (ntldr, boot.ini a few other bits and pieces). Doesn't need to be the first, but must be the only one marked active (bootable).
Forget the hide/unhide - only required if you have multiple (separate) Windoze - say Win98 as well.
M$oft really has a totally f*cked up loader.
Windows also appears to have a lot of location dependant entries in the registry - doesn't like to be moved. Re-install it to be sure.

Linux can be put anywhere, although a few of the popular distros (Fedora, Ubuntu ???) seem to demand primary partitions as well.
In that case it's crappy installer code from the distro developers, not a limitation of Linux itself.
 
Old 04-29-2007, 09:09 AM   #9
archan
LQ Newbie
 
Registered: Apr 2007
Posts: 4
Blog Entries: 1

Rep: Reputation: 0
is it posible to have more than 2 os in a hard disk??
suppose 2 linux & 1 winows xp ??
 
Old 04-29-2007, 09:32 AM   #10
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
@ Archan -- Yup, for sure There's virtually no limit to how many Linuxes you can stick on a drive, other than actual space you have to work with.
 
  


Reply

Tags
dual boot, ext3, grub, ntfs, partitions, windows, xp


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
trouble dual booting Ubuntu and Fedora Core 4 with GRUB. bgryderclock Linux - Software 5 04-04-2007 01:46 PM
dual booting xp and ubuntu need help with the fat32 shared partition reddwarf1387 Linux - General 4 02-07-2007 11:23 PM
GRUB is not booting the correct partition in a dual drives system ps6000 Linux - Software 4 01-11-2007 11:59 AM
Dual-booting Ubuntu using Grub fails tsalem Linux - Newbie 10 01-25-2005 10:47 PM
dual booting Win2k & RH Linux using ntldr->GRUB has problems whitepine Linux - General 3 01-28-2003 06:39 PM


All times are GMT -5. The time now is 09:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration