LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 01-14-2005, 10:56 AM   #1
belliott4488
Member
 
Registered: Oct 2003
Location: Ellicott City, MD, US
Distribution: Fedora 11
Posts: 67

Rep: Reputation: 15
okay to add new drive for dual-booting?


I currently run Red Hat Linux 9.0 as the only OS on my home PC. I've decided that I really need to set it up as a dual-boot machine with Windows (*sigh* - I know ...), for those two or three things I have to do that require Windows. I know that installing Windows after Linux is a bad idea, and I'm kind of due for a distro upgrade, anyway, so here's what I'd like to do:

Buy a new hard drive, set it as the master drive, and set my existing drive to be the slave drive. Then install Windows and an up-to-date Linux distro on the new drive in dual-boot mode.

My question is this: what trouble will I run into when I try to read my current drive? I assume Linux will now identify it as /dev/hdb, so will that mess up the partitions on that drive, which have always existed on /dev/hda?

Here are the specifics, in decreasing order of liklihood, I'm guessing:
1. Will I be able to read data files, e.g. documents in my old /home directory?
2. Will I be able to run any scripts or executables on the old drive, if they currently expect to find resources on /dev/hda, which will have become /dev/hdb?
3. Is there any way to set up the new boot loader (presumably GRUB) to include booting RH9.0 from the second drive as an option?

thanks,
bruce
 
Old 01-14-2005, 11:14 AM   #2
KimVette
Senior Member
 
Registered: Dec 2004
Location: Lee, NH
Distribution: OpenSUSE, CentOS, RHEL
Posts: 1,794

Rep: Reputation: 46
You'll need to make a boot CD or floppy BEFORE you install Windows, and test to make sure you can mount and boot to /dev/hdb.

Next, you will want to modify grub (menu.lst) and fstab so the OS knows to boot from /dev/hdb and to mount /dev/hdb(1?2?) as /

Test by installing the new drive as /dev/hda and your current one as /dev/hdb and then booting from the floppy or CD. This will make sure that you modified the fstab file correctly. Once you know you can boot fine from the boot floppy/cd, then you can install grub to the MBR of /dev/hda after you install Windows. KEEP THAT BOOT FLOPPY OR CD - you'll need it if you make mistakes in the grub configuration file!

You could use LILO as well, but I happen to prefer grub because it provides a better user experience - it's easier to talk someone through selecting the OS with grub (just select it and hit enter - it cannot get any easier than that!) than with LILO (okay, hit tab, now type the name of the OS. Hit enter. etc.) for one example.
 
Old 01-14-2005, 12:55 PM   #3
belliott4488
Member
 
Registered: Oct 2003
Location: Ellicott City, MD, US
Distribution: Fedora 11
Posts: 67

Original Poster
Rep: Reputation: 15
KimVette - Thanks. That response was exactly what I needed - just slightly beyond my grasp, so that I can figure it out, but I'll learn something new in the process.

When I modify GRUB, I take it that I modify menu.lst on the boot floppy (so that it will still boot my current distro even after the drive becomes /dev/hda), right?

I think think the answer to that is 'yes', but then I'm wondering, how do I do this test before I've installed Windows and the new Linux distro? Should I partition the new drive first, then do the test, and then (assuming the boot disk works) install the new OS's?

I guess I'm not sure at what point the new drive becomes /dev/hda and the old one becomes /dev/hdb - is it when I partition the new drive, when I install the new OS's, or will it just "happen" when I boot from the floppy?

thanks,
Bruce

P.S. Love that signature!
 
Old 01-14-2005, 11:15 PM   #4
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 1,752

Rep: Reputation: 189Reputation: 189
guess I'm not sure at what point the new drive becomes /dev/hda and the old one becomes /dev/hdb - is it when I partition the new drive, when I install the new OS's, or will it just "happen" when I boot from the floppy?

/dev/hda is the master drive on the primary IDE controller
/dev/hdb is a slave drive on the primary IDE controller.

If you have 2 drives on the primary IDE cable, whichever one you jumper as master will be /dev/hda, the slave will be /dev/hdb.

If you leave that Linux drive in while you install windows, windows will overwrite the boot loader. Now if you want to use windows ntloader to choose which drive to boot then it's ok. If you want to boot the machine with grub then add
title Windows XP Amateur edition
rootnoverify (hd0,0)
chainloader +1
For lilo add
# Windows Boot Section
other = /dev/hda1
label = WindowsXP
table = /dev/hda
#End of Windows boot section

Those are just examples, add your correct parameters.

Windows also won't be able to see that ext2 ext3 Reiserfs drive.
Linux will be able to r/w the windows FAT32 drive. Linux will be able to read not write to a NTFS drive.
 
Old 01-15-2005, 09:34 AM   #5
belliott4488
Member
 
Registered: Oct 2003
Location: Ellicott City, MD, US
Distribution: Fedora 11
Posts: 67

Original Poster
Rep: Reputation: 15
Thanks! Good info.

Will anything significant change if I'm installing Win2000 instead of XP?

Also, you say: "If you leave that Linux drive in while you install windows, windows will overwrite the boot loader." The only boot loader I have right now is the one on the drive that will become the slave, i.e. /dev/hdb. Is that the one that you say Windows will overwrite? I wouldn't have thought Windows would even be aware of what was on the second drive.

Will I ever use that boot loader (on /dev/hdb) again? I thought that whatever bootloader is in the MBR of the master drive would be the only to be called. In other words, I thought a MBR on a slave drive would become useless - is this wrong? Can one bootloader call another one?

- Bruce

Last edited by belliott4488; 01-15-2005 at 09:36 AM.
 
Old 01-15-2005, 02:58 PM   #6
KimVette
Senior Member
 
Registered: Dec 2004
Location: Lee, NH
Distribution: OpenSUSE, CentOS, RHEL
Posts: 1,794

Rep: Reputation: 46
Quote:
guess I'm not sure at what point the new drive becomes /dev/hda and the old one ...
/dev/hda -> master IDE device on your first IDE channel
/dev/hdb -> slave IDE device on your second IDE channel
/dev/hdc -> master IDE device on your second IDE channel
etc.

What is now /dev/hda will become /dev/hdb when you configure it as the master device on your first IDE channel

Quote:
Will I ever use that boot loader (on /dev/hdb) again? I thought that whatever bootloader is in the MBR of the master drive would be the only to be called. In other words, I thought a MBR on a slave drive would become useless - is this wrong? Can one bootloader call another one?
The MBR isn't "useless" on the second drive, but (unless you configure the BIOS to do otherwise - and I would not recommend this until you gain a better understanding of how the bootstrap process works) you won't be using it as the boot drive - the MBR on the new /dev/hda will be where you install grub (or LILO)

Last edited by KimVette; 01-15-2005 at 03:02 PM.
 
Old 01-15-2005, 04:33 PM   #7
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Milwaukee, WI
Distribution: Mint
Posts: 6,642

Rep: Reputation: 69
Here's what I would suggest: Put the new drive into the machine and remove the existing one (the one with Linux already installed). Install Windows on the new drive. Reinstall the old drive (the one with Linux) as the primary slave (/dev/hdb). Boot into Linux (using a floppy or CD) and then edit your bootloader and your fstab to reflect the correct references to hda for Windows and hdb for Linux. If you're using lilo, rerun it. If all goes well, you'll be sitting in front of a dual booting machine. Congrats.

Regarding your post-install questions: Yes, you'll be able to read your old /home directory just fine. Keep in mind that adding a second physical drive will not have any impact on data that resides on a different drive. As for any scripts that you've written, if they include an explicit reference to hda (which of course should now be hdb) then Yes, as you suspected they will fail if you try to run them. Fortunately the fix is a piece of cake, and as you already mentioned you would just need to replace the "hda" reference with "hdb".

Good luck with it. As a side comment, as you probably know Redhat officially discontinued support for v9.0 last year, and so you might want to consider moving to a distro that is current. (There's nothing wrong with Redhat 9, but my point is just that without official support, you would need to continually monitor and install any patches or security updates, which can represent a fair amount of work) -- J.W.
 
Old 01-15-2005, 04:55 PM   #8
belliott4488
Member
 
Registered: Oct 2003
Location: Ellicott City, MD, US
Distribution: Fedora 11
Posts: 67

Original Poster
Rep: Reputation: 15
J.W. - thanks for the response.

One thing I didn't get: since I'd have Windows installed on the master drive (/dev/hda), what bootloader and fstab do I edit (to point to hdb for Linux)? Are they the Windows bootloader and fstab on hda? I had been thinking that I'd need to have GRUB or LILO on hda in order to have dual-boot capabilities, but maybe Win2K is more flexible than I'd realized.

Or, did you mean for me to edit the boot floppy, which was made when Linux was on hda, but which I assume will need to be edited to look to hdb for Linux?

And thanks for the note re: RH 9.0. Yes, I know it's a little out-of-date, in addition to being unsupported, so I'm thinking of SuSE, which I just installed on my wife's PC, or Fedora, since I'm kind of locked into using rpm and apt. I just picked up the new drive today ($60 for a 160 GB drive!), so I should have plenty of room for multiple OS's or even multiple distros if I really wanted.

- Bruce
 
Old 01-15-2005, 06:17 PM   #9
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Milwaukee, WI
Distribution: Mint
Posts: 6,642

Rep: Reputation: 69
I was assuming that you wanted to install Windows on the new drive, and leave Linux on the old drive. In other words, /dev/hda would house Windows, and /dev/hdb would house Linux.

If this is correct, then in that scenario, there would only be one fstab and lilo.conf file, both of which would be on /dev/hdb in the /etc directory. (You wouldn't have two of them, and Windows doesn't have an fstab or lilo.conf.) Thus, after booting up Linux using a floppy or CD, you would just need to manually edit the fstab and lilo.conf file to modify the references to Linux to now point to /dev/hdb (where they would currently live) as opposed to /dev/hda (where they used to live when you only had the one disk). In order to make those changes take effect, you need to manually rerun lilo as root: /sbin/lilo

Reboot, and if all goes well then you'll be presented with the lilo boot menu. You should not need to manually edit anything on the floppy disk (if that's what you're using) Good luck with it -- J.W.
 
Old 01-15-2005, 06:58 PM   #10
belliott4488
Member
 
Registered: Oct 2003
Location: Ellicott City, MD, US
Distribution: Fedora 11
Posts: 67

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by J.W.
I was assuming that you wanted to install Windows on the new drive, and leave Linux on the old drive. In other words, /dev/hda would house Windows, and /dev/hdb would house Linux.
Yes, that's the plan, initially at least. I'd also like to install an up-to-date Linux distro on the new drive, as soon as I have one. My thinking is that when I partition the new drive, I'll make a small boot partition for Windows, then a Linux boot partition (I don't know if I need to worry about the 1024 cylinder limit, but it seems easy to avoid, so I'll just be sure my boot partitions are all under it). I'll make a smallish NTFS partition for Windows apps, but then leave the rest of the drive for FAT32 or ext3 partitions. At least, that's the plan. I'd only boot RH from the second drive as long as I have to, but once the new distro is up and running, I don't expect to need to boot it up any more.

Quote:
If this is correct, then in that scenario, there would only be one fstab and lilo.conf file, both of which would be on /dev/hdb in the /etc directory. (You wouldn't have two of them, and Windows doesn't have an fstab or lilo.conf.) Thus, after booting up Linux using a floppy or CD, you would just need to manually edit the fstab and lilo.conf file to modify the references to Linux to now point to /dev/hdb (where they would currently live) as opposed to /dev/hda (where they used to live when you only had the one disk). In order to make those changes take effect, you need to manually rerun lilo as root: /sbin/lilo

Reboot, and if all goes well then you'll be presented with the lilo boot menu. You should not need to manually edit anything on the floppy disk (if that's what you're using) Good luck with it -- J.W.
Okay, I think I've got it now, almost. From your description, it sounds like the only boot programs on hda are for Windows, so when I reboot, why won't the PC simply boot windows? Does Lilo put something into the boot sector of hda when I rerun it (as you instruct)?

I could just follow your instructions and keep my fingers crossed, but I'll feel better when I understand what I'm doing a little better. Okay, a lot better.

- bruce
 
Old 02-12-2005, 12:26 PM   #11
belliott4488
Member
 
Registered: Oct 2003
Location: Ellicott City, MD, US
Distribution: Fedora 11
Posts: 67

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by J.W.
I was assuming that you wanted to install Windows on the new drive, and leave Linux on the old drive. In other words, /dev/hda would house Windows, and /dev/hdb would house Linux.
Yes, that's what I tried ...
Quote:
If this is correct, then in that scenario, there would only be one fstab and lilo.conf file, both of which would be on /dev/hdb in the /etc directory. (You wouldn't have two of them, and Windows doesn't have an fstab or lilo.conf.) Thus, after booting up Linux using a floppy or CD, you would just need to manually edit the fstab and lilo.conf file to modify the references to Linux to now point to /dev/hdb (where they would currently live) as opposed to /dev/hda (where they used to live when you only had the one disk). In order to make those changes take effect, you need to manually rerun lilo as root: /sbin/lilo

Reboot, and if all goes well then you'll be presented with the lilo boot menu. You should not need to manually edit anything on the floppy disk (if that's what you're using) Good luck with it -- J.W.
Man, did this not work ... now that I'm dead in the water, I think I see what I did wrong, but let me describe it for verification, and then I'll beg for some kind of remedy. Here's what I did:
1. Disconnected original drive with Linux on it.
2. Installed new drive as master and installed Windows 2000 on it.
3. Disconnected the new drive, reconnected the old one, which was still set as master, and rebooted into Linux.
4. Created a Linux boot floppy, and restarted the machine, booting from the floppy.
5. Edited /etc/fstab and /boot/grub/grub.conf, replacing all occurrences of "hda" with "hdb", after first making backup copies.
6. (Here's where I likely screwed up.) I then powered down and connected both drives, switching the original Linux drive to be slave. NOTE: I did *not* rerun grub while booted from the floppy - that's what I now see in your instructions above (replacing lilo with grub). I had thought that "rerunning" meant "rebooting", but I'm now betting that if I'd rerun it grub while I was still booted up from the floppy, then something would have been updated on the floppy so that it would then know to look for hdb rather than hda on the next reboot.

Anyway, as you've guessed - if I'm right about this - rebooting from the floppy no longer works. When it tries to load the file system it gets hung.

So my question is this: is there any way to repair this? If there's any way to get to fstab and grub.conf on the Linux drive, I could set them back, restore the drive to master, and start over again, but I don't know how to get to them without being able to boot some version of Linux first. Maybe I should try to get a version of Linux that will run from a CD (Knoppix?)?

Another option is to install Fedora on the new drive, which has been the plan all along, and then once it's running, go to hdb to try and fix things. Unfortunately, Fedora is refusing to install because of some kind of hard drive error. I suspect that I partitioned the disk badly when I installed Windows, but that's another problem ...

I'm having a very bad morning ...

- Bruce
 
Old 02-13-2005, 08:42 AM   #12
belliott4488
Member
 
Registered: Oct 2003
Location: Ellicott City, MD, US
Distribution: Fedora 11
Posts: 67

Original Poster
Rep: Reputation: 15
Okay .... just in case anyone was worried sick over my lost Red Had installation - I was able to download Knoppix (using Windows, of all things), burn it to a CD, and then reset my grub.conf and fstab files to their previous versions. I then set the Linux drive to be master (hda) again, and booted successfully from the floppy.

Now I'm back to following J.W.'s instructions. I can reset my grub.conf and fstab files back to the versions that replace "hda" with "hdb", and this time I'll run /sbin/grub and watch the floppy drive to see that something's being written to it. But ... I'd really like to understand what I'm doing a little better, first ...

For one thing, running /sbin/grub puts me into an interactive grub session with a grub> prompt. There are a lot of useful-looking commands, but they also look dangerous if I don't know what I'm doing. Can anyone tell me which commands to use here? As I understand it, I'm trying to update something on the floppy to recogize the changes in the grub.conf and fstab files, namely the hda -> hdb replacements.

... which is really something else I'd like to understand better. The only reference to "hda" that I see in grub.conf is in the comments at the front, where it defines boot=/dev/hda. Will grub actually read this line, despite the "#" at the beginning? Should I uncomment this line? In the uncommented lines, all the drive references seem to be to "hd0" - should I change this to "hd1"?

Here is the top of my original grub.conf, in case there's anything unusual about it:

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/hda2
# initrd /initrd-version.img
#boot=/dev/hda
default=0
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
title Red Hat Linux (2.4.26-1.ll.rh90.ccrma)
root (hd0,0)
kernel /vmlinuz-2.4.26-1.ll.rh90.ccrma ro root=LABEL=/ hdc=ide-scsi
initrd /initrd-2.4.26-1.ll.rh90.ccrma.img


I have the same question about my fstab file, which explicitly mentions "hda" only for the swap partition. Should "/" and "/boot" have explicit references to "hda"? Here's my fstab (sorry about the column alignment - this editor seems to collapse whitespace):

LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/hda3 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0
none /var/lib/jack/tmp tmpfs defaults 0 0
/dev/cdrom1 /mnt/cdrom1 udf,iso9660 noauto,owner,kudzu,ro 0 0


Thanks in advance for any clarification anyone would like to offer. After yesterday's near disaster, I'm trying to be a little more cautious.

BTW, that Knoppix CD is great!!

- Bruce

Last edited by belliott4488; 02-13-2005 at 09:50 AM.
 
  


Reply


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 W2K On main drive and Linux Mandrake 10.1 on partitioned slave. Kavon89 Linux - Newbie 15 09-10-2005 03:22 PM
Multi-drive dual booting Hikaru79 Linux - General 1 06-30-2005 09:47 PM
Dual Booting - Shared Drive Question? paul1892 Linux - Newbie 8 01-02-2005 07:27 AM
dual booting fc2 and xp with xp on a sata drive pjamell Linux - General 3 11-29-2004 11:15 PM
Are you dual booting and Windows stopped working (booting) then here's the answer: rberry88 Linux - General 1 02-12-2004 09:05 AM


All times are GMT -5. The time now is 05:34 PM.

Main Menu
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