LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Moving /boot from /dev/hda2 to /dev /hda3 (https://www.linuxquestions.org/questions/linux-general-1/moving-boot-from-dev-hda2-to-dev-hda3-570514/)

Neo-Leper 07-18-2007 05:39 PM

Moving /boot from /dev/hda2 to /dev /hda3
 
I have four partitions on hda,

/swap
/dev/hda2 (boot)
/dev/hda3 (root)
/dev/hda4 (/var)

Home is on another HD.

Now what I need to do is install XP to test something, and I may just keep it for those games that don't work with CrossOver and VirtualBox.


But...... I have the maximum amount of partitions allowed. Both XP and Gparted says that. (All of the above partitions are primary ones.)

So what I want to do is move the boot from /dev/hda2 to the root, /dev/hda3. But I don't know how to do this. Is there a simple way of just reinstalling Grub maybe? Or a few files to edit to point to the /dev/hda3/boot?

(I also tried to install XP on another HD, but it says it need to write to hda and there where no usable partitions. so I am not going to bother with doing it that way, XP is not the brightest operating system.)

Thanks

Brian1 07-18-2007 06:11 PM

Since all partitions are Primary then no addtional partitions can be added. Is ther still space not partitioned on the drive?

If there are 3 primary partitions then the last one would be an extended partition where logical partitions can be created in. The limit I do not know.

Of course XP really loves the primary first partition of the first drive. But if you install the second drive by itself and install XP. After the install put the first drive back in as the master and the windows as slave. Then for a grub option use something like this to swap drives ids on boot of XP.
Code:

title windows
        map (hd0,0) (hd0,2)
        map (hd0,2) (hd0,0)
        setup (hd0)
        rootnoverify (hd0,2)
        chainloader +1

Or leave the XP as master drive and linux as slave. Using a boot disc re install grub to the master boot record of the new drive. Edit /etc/fstab and change drive ids to match the new setup. /dev/hda2 to /dev/hdb2. Also edit grub.conf file. It would be easier to create a /boot on the new drive and copy the contents of the old /boot to the new /boot. Again make fstab and grub are id'ed correctly.

Brian

Brian

syg00 07-18-2007 06:56 PM

I would doubt moving an average /boot would free enough space for XP.
Probably don't need to anyway. Install Virtualbox in Linux, and run XP as the guest - that way it sees just the (virtual) disk you define for it.
Works fine - if you have enough space.

Of course the opposite also works fine.

rupertwh 07-18-2007 07:00 PM

Hi Neo-Leper,

easy-peasy:

1. umount /boot
2. mount /dev/hda2 /mnt
3. cp -a /mnt/* /boot
4. umount /mnt
5. Adjust /etc/fstab and /boot/grub/menu.lst accordingly
6. grub-install /dev/hda (probably necessary / assuming you have GRUB in MBR)

And better not destroy old /boot partition before you know it works...

Rupert

Neo-Leper 07-18-2007 08:07 PM

Quote:

Originally Posted by rupertwh
Hi Neo-Leper,

easy-peasy:

1. umount /boot
2. mount /dev/hda2 /mnt
3. cp -a /mnt/* /boot
4. umount /mnt
5. Adjust /etc/fstab and /boot/grub/menu.lst accordingly
6. grub-install /dev/hda (probably necessary / assuming you have GRUB in MBR)

And better not destroy old /boot partition before you know it works...

Rupert

Thanks everyone. The above is what I was looking for. I am going to try this shortly. Right now I got side tracked with DesktopBSD, lol.

Neo-Leper 07-19-2007 02:35 PM

Quote:

Originally Posted by rupertwh
Hi Neo-Leper,

easy-peasy:

1. umount /boot
2. mount /dev/hda2 /mnt
3. cp -a /mnt/* /boot
4. umount /mnt
5. Adjust /etc/fstab and /boot/grub/menu.lst accordingly
6. grub-install /dev/hda (probably necessary / assuming you have GRUB in MBR)

And better not destroy old /boot partition before you know it works...

Rupert

After getting side tracked with DesktopBSD, getting grub image set up and then getting XP installed on VirtualBox I am finally back to this, lol.

I tried sudo umount /boot in the terminal, I also tried sudo umount /dev/hda2 with the same result. It is telling me the device is busy. Gparted won't let me unmount it either.

jay73 07-19-2007 04:22 PM

Quote:

I tried sudo umount /boot in the terminal, I also tried sudo umount /dev/hda2 with the same result. It is telling me the device is busy. Gparted won't let me unmount it either.
I hope you don't mean the Gparted that is installed on your hard disk. It's not a good idea to edit a mounted system and, luckily enough, it often produces only warnings and doesn't do anything. The best you can do is either use a gparted livecd or do the editing from another system on your computer (providing you have more than one installed, that is).

rupertwh 07-19-2007 04:42 PM

Quote:

Originally Posted by Neo-Leper
I tried sudo umount /boot in the terminal, I also tried sudo umount /dev/hda2 with the same result. It is telling me the device is busy. Gparted won't let me unmount it either.

ok, my mistake. So it's not *that* easy... Best is probably to do this from a rescue/live cd.

Neo-Leper 07-19-2007 07:45 PM

I will give it a try with the gparted disk later. Thanks. I was wondering if I should try it that way, it is still easy to do either way :)

Neo-Leper 07-20-2007 12:54 PM

Did it my way and didn't break anything ;) lol
 
Everything I tried was not working. I have no idea why, but it is probably due to user error, lol.

So I did it my way.

I used the Gparted live cd and resized hdb and put aside 10G(fat32) for XP, while keeping hdb1 the same (it is where my /home is,) XP=hdb2.

I went into my bios and switched the auto for hda and SATA off. Tested it by booting and there was nothing to boot from hdb, so all was well so far.

So I rebooted with the XP installation disk in. I tried to install it on the fat32 I set up with gparted but it didn't want to do that, so I did a quick format with the ntfs file system and installed it. Before when I didn't turn off anything in the bios and tried to install XP on hdb or the SATA partition it kept telling me it had to write to hda and it couldn't, it wanted me to format it first, (NOT!!!) But this time it worked even though XP did pick up all the HD's and partitions. So I hoped it wouldn't rewrite the MBR....... But XP did, have I mentioned today how much XP annoy's me?!!!

So I booted the Ubuntu 7.04 installation (livecd) disk. I opened the terminal and type in "sudo grub" grub> came up. So I then typed in where my /boot was, which was "root (hdo,1)" and then enter. After that I typed in "setup (hd0)"

It reinstalled grub and all is fine. All I have to do is add XP to fstab and menu.lst.


So /boot stays where it is and XP is now installed.

Neo-Leper 07-20-2007 01:50 PM

Ok. My way is having one problem. I am going to see if I can figure out a solution first and then just post that here. XP really annoys me, lol.

Neo-Leper 07-20-2007 02:10 PM

I found a way to work around the problem I am having until I can find, if I can find, a better solution.

What happened was when I disabled HDA and SATA in the BIOS XP completely installed in HDB as it should (HDB is the slave and HDA is the master.)

I added this to grub,

title Windows XP
root (hd1,1)
savedefault
makeactive
chainloader +1

I also tried it these ways,

title Windows XP
root (hd1,1)
savedefault
chainloader +1

title Windows XP
root (hd1,1)
makeactive
chainloader +1

title Windows XP
root (hd1,1)
chainloader +1


But no matter what grub would not boot XP. It said starting up and it would just hang there.

So I went into the bios (F1) and changed the boot order so that the slave, HDB where XP is, would boot first and then XP booted fine. So for now I have a boot menu in the BIOS, the default setting is set to boot the master (hda) with grub. If I want to boot XP i have to hit (esc) when I start the computer so it brings up the bios boot menu. From there I can choose to boot the slave, hdb, with XP.

It works but I would like to get this so Grub does it all. Anyone have any ideas? I won't be using XP that much so it is not a huge deal. I would just like to figure this out.

Also can anyone explain to me what I did wrong or missed when I installed XP this way?

Thanks.

Neo-Leper 07-20-2007 10:20 PM

I got it to work and boot from grub. This is what my XP entry looks like in fstab now.


title Windows XP
map (hd0) (hd1)
map (hd1) (hd0)
root (hd1,1)
savedefault
makeactive
chainloader +1


All times are GMT -5. The time now is 07:10 AM.