Reinstalling Windows partition

This forum is dedicated to basic help and support :

Ask here your questions about basic installation and usage of Mageia. For example you may post here all your questions about getting Mageia isos and installing it, configuring your printer, using your word processor etc.

Try to ask your questions in the right sub-forum with as much details as you can gather. the more precise the question will be, the more likely you are to get a useful answer

Reinstalling Windows partition

Postby mackowiakp » Oct 31st, '13, 23:04

I have 2 HDD in PC. First hard drive (bootable) is partitioned as follows:

- sda1 - windows XP (drive C:)
- sda5 - root partition om M3
- sda6 - UNIX swap
- sda7 - home

The second drive is partitioned as:

- sdb1 - Windows drive D:
- sdb5 - as extension of home partition of the first drive for "ordinary" users, excluding root

I use GRUB ver 2 as boot manager.
I want to reinstall Windows (dont care about content of Win, because I need it only from time to time for tests). Only Linux content is important for me.
So after reinstaling, I want to have:

First HDD:
- bootable root Linux partition (viz GRUB)
- swap
- home

On second drive:
- Windows partition as Drive C: (bootable via GRUB)
- Linux partition as extension of home partition of the first drive for "ordinary" users, excluding root.

Of course I can use Gparted or similar to resize etc partitions. But I want to install WIN "clean" from the beginning, without losing any Linux content on any Linux partition.
Is it possible? How can I do this to have still possibility to choose Linux/WIN boot via GRUB. Can anybody share any experience? How rebuild GRUB after reinstalling WIN?
Linux is like wigwam. No Windows, no Gates but Apache inside

WARNING ! The administrator has the right to refuse to install WINDOWS, invoking the conscience clause
mackowiakp
 
Posts: 660
Joined: May 23rd, '13, 07:32
Location: Gdynia, Poland

Re: Reinstalling Windows partition

Postby jtwdyp » Nov 1st, '13, 18:43

mackowiakp wrote:Of course I can use Gparted or similar to resize etc partitions. But I want to install WIN "clean" from the beginning, without losing any Linux content on any Linux partition.
Is it possible? How can I do this to have still possibility to choose Linux/WIN boot via GRUB. Can anybody share any experience? How rebuild GRUB after reinstalling WIN?


I can tell you what I'd do:

Though how one convinces windows to install to the 2nd drive is NOT something I know. And/or how to get it to not want/need to create a "D:" partition for it's recovery stuff. I'll presume that you know how to do that. If not, perhaps somebody else will explain that part.

But 1st, this depends on if your using grub legacy or grub2... If like my Mageia3 installations its using grub legacy (GNU GRUB version 0.97) then I'm more comfortable with the process...

If your using grub 2, Stop here...

You plan to "resize etc partitions"... it sounds like you intend to eliminate the current windows partition on /dev/sda... Because your Linux root partition is evidently on a logical partition it's device name will likely remain as /dev/sda5. But I think grub legacy's name for it would change. Currently your /boot/grub/menu.lst file probably refers to it as "(hd0,1)" {First drive is "0" second partition is "1"} But if you remove the /dev/sda1 partition and resizing the extended partition {which contains the logical /dev/sda5} to the left, grub legacy will see sda5 as the first partition and your menu.lst will need to call it (hd0,0) instead of (hd0,1)... So you would need to edit your "M3" grub entry accordingly. Likewise, if you currently have an windows boot entry in your grub menu, you would also need to change it's grub partition name. Probably from "(hd0,0") to "(hd1,0)"

If you don't you could try something like this
Code: Select all
title winDoze
root (hd1,0)
map (0x81) (0x80)
map (0x80) (0x81)
makeactive
chainloader +1


But Just as importantly, grub's stage 1 image in the MBR will no longer be able to find either stage 1.5 nor stage 2.

The easiest way to fix this is with a rescue or live cd. I like to use Puppy linux for that.

But using Puppy or any live cd equipped with grub legacy I would open a root shell and at the
# prompt type "grub"
Then at the "grub>" prompt type "find /boot/grub/menu.lst" Then using the output of that tell the grub shell to "root" to that partition. And finally to "setup" to the MBR. You want to be careful when you do this, but since the existing grub boot won't work...
Code: Select all
# grub
Probing devices to guess BIOS drives. This may take a long time.


    GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

 [ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the possible
   completions of a device/filename. ]
grub> find /boot/grub/menu.lst
find /boot/grub/menu.lst
 (hd0,0)
grub>


Note: If your results are NOT "(hd0,0)" then substitute your results in the example below.

Once the grub shell confirms it's name for the partition containing your menu.lst file, the next command is to "root" to it:

Code: Select all
grub> root (hd0,0)


Then you can recreate the stage 1 image in the MBR with:

Code: Select all
grub> setup (hd0)


Note: this time you didn't specify a partition...

Hope this helps.
--
JtWdyP
User avatar
jtwdyp
 
Posts: 88
Joined: Jun 10th, '13, 08:30


Return to Basic support

Who is online

Users browsing this forum: No registered users and 1 guest

cron