Tricky situation with re-installing windows and Grub


Recommended Posts

Okay, I have to re-install windows for a cousin, however he has 2 different Linux installations and they both are in middle partitions, not the primary ones. For example :

Hard Disk 1 ----> /Sda1 (windows) /Sda2 (linux) /Sda3 (Data)

Hard Disk 2 ----> Sdb1 (data) / Sdb2 (Linux) /Sdb3 (Data)

Now, Grub is installed onto Sda1 according to him and he's not sure where Grub is for the 2nd installation. It's definitely not (?) in the primary Sdb1 partition because it doesn't boot when I detach Sda and boot with just Sdb attached. Actually I get thrown to a 'Grub-rescue' prompt with a couple other messages that I can't recollect atm, I'm not at the machine.

Does this mean Grub is, in fact, also installed on Sdb for the 2nd Linux install he did? If yes, how can I get Grub to 'see' the Linux installation on /Sdb2? He doesn't have any /boot or /swap for either.

And how do I repair Grub on Sda1 after I reinstall Windows for him? I'm kinda lost to be honest, but I'm willing to touch it _only_ if I can fix it for him... because I just don't have the time to give if it ends up borking both Linux installations. He wants both installations, and preferably be able to boot both individually with their own Grub.

I hope I've explained it clear enough, I need help :p

After you install Windows and remove GRUB from the MBR, use Super Grub2 Disk to boot from the Linux installation on the secondary hard drive and reinstall GRUB. The command should look something like the following, assuming the drive is /dev/sdb:


sudo grub-install /dev/sdb
[/CODE]

You should now be able to boot GRUB from that hard drive if it is set as primary in BIOS. Next, use Super Grub2 Disk again to boot from the Linux installation on the hard drive with Windows. You can reinstall GRUB using a similar command to the one you used previously; just reference the other hard drive. The command should look something like the following, assuming the drive is /dev/sda:

[CODE]
sudo grub-install /dev/sda
[/CODE]

If yes, how can I get Grub to 'see' the Linux installation on /Sdb2? He doesn't have any /boot or /swap for either.

You only need one grub (bootloader) installed in the MBR of the first disk (as setup in bios), the VBR (volume boot record) will take care of the rest. As far as getting grub to see additional distros goes, it should be as simple as:

grub-mkconfig -o /boot/grub/grub.cfg

Assuming you're using Grub2. For Grub 1, you'll have to edit grub.cfg by hand or pehaps use something like os-prober.

And how do I repair Grub on Sda1 after I reinstall Windows for him? I'm kinda lost to be honest, but I'm willing to touch it _only_ if I can fix it for him... because I just don't have the time to give if it ends up borking both Linux installations. He wants both installations, and preferably be able to boot both individually with their own Grub.

Load up a live cd / usb pen with the same architecture (32/64 bit) as the installation (important!), then chroot into the installation:

# change sda1 to your linux partition
mount /dev/sda1 /mnt

# mount temporary file systems in preparation for chroot
mount -t proc proc /mnt/proc
mount -t sysfs sys /mnt/sys
mount -o bind /dev /mnt/dev
mount -t devpts pts /mnt/dev/pts

chroot /mnt /bin/bash

# restore grub
grub-install /dev/sda

That's what I do anyway.

  • Like 2

^ Thanks for the detailed breakdown bro, I'll be printing this page and taking it across to refer :)

I manage to take good care of my own Linux install, but this Triple installation (Windows, Linux, Linux) with a messy disk structure is kinda throwing me off. I'm going there tonight, will update the thread when I get back.

Cheers!

To add to what simplezz said, booting from a live disc and using a chroot to recover your GRUB installation would certainly work (and is, in fact, the method that most distribution's installers use to install from disc in the first place), but is merely an alternative to my method of booting into each OS installation. The main advantage of simplezz's solution over mine is that you can update both installations at once (or only do one or the other, as simplezz suggested).

Also, if you are using Debian or a Debian-based distribution (such as Ubuntu or Linux Mint), the distribution provides scripts that probe for existing OS installations and add them to the boot menu. (These scripts are called every time there is a kernel update and will overwrite your grub.cfg, including any custom modifications you have made. If you want to add custom boot entries, place them in /boot/grub/custom.cfg instead.) Once you are in the chroot or booted into the OS installation, use

sudo update-grub[/CODE]

instead of

[CODE]sudo mkconfig -o /boot/grub/grub.cfg[/CODE]

.

Assuming you're using Grub2. For Grub 1, you'll have to edit grub.cfg by hand or pehaps use something like os-prober.

I believe that GRUB Legacy uses [i]/boot/grub/menu.lst[/i] by default instead of [i]/boot/grub/grub.cfg[/i] like GRUB 2. However, unless your distribution is rather old (like Debian Lenny or CentOS 5), it should have shipped with GRUB 2 instead of GRUB Legacy, so my correction is probably irrelevant.

You only need one grub (bootloader) installed in the MBR of the first disk (as setup in bios), the VBR (volume boot record) will take care of the rest. As far as getting grub to see additional distros goes, it should be as simple as:

grub-mkconfig -o /boot/grub/grub.cfg

Assuming you're using Grub2. For Grub 1, you'll have to edit grub.cfg by hand or pehaps use something like os-prober.

Load up a live cd / usb pen with the same architecture (32/64 bit) as the installation (important!), then chroot into the installation:

# change sda1 to your linux partition
mount /dev/sda1 /mnt

# mount temporary file systems in preparation for chroot
mount -t proc proc /mnt/proc
mount -t sysfs sys /mnt/sys
mount -o bind /dev /mnt/dev
mount -t devpts pts /mnt/dev/pts

chroot /mnt /bin/bash

# restore grub
grub-install /dev/sda

That's what I do anyway.

To add to what simplezz said, booting from a live disc and using a chroot to recover your GRUB installation would certainly work (and is, in fact, the method that most distribution's installers use to install from disc in the first place), but is merely an alternative to my method of booting into each OS installation. The main advantage of simplezz's solution over mine is that you can update both installations at once (or only do one or the other, as simplezz suggested).

Also, if you are using Debian or a Debian-based distribution (such as Ubuntu or Linux Mint), the distribution provides scripts that probe for existing OS installations and add them to the boot menu. (These scripts are called every time there is a kernel update and will overwrite your grub.cfg, including any custom modifications you have made. If you want to add custom boot entries, place them in /boot/grub/custom.cfg instead.) Once you are in the chroot or booted into the OS installation, use

sudo update-grub[/CODE]

instead of

[CODE]sudo mkconfig -o /boot/grub/grub.cfg[/CODE]

.

I believe that GRUB Legacy uses [i]/boot/grub/menu.lst[/i] by default instead of [i]/boot/grub/grub.cfg[/i] like GRUB 2. However, unless your distribution is rather old (like Debian Lenny or CentOS 5), it should have shipped with GRUB 2 instead of GRUB Legacy, so my correction is probably irrelevant.

I'm back, and it was very .....easy, thanks to both of you's detailed instructions! Way easier than I had thought it would be :p

Before I reinstalled Windows, I decided to try and boot each hard disk on it's own to see how it goes - and surprisingly this time the 2nd hard disk booted his 2nd Linux install without a hitch. Not sure why it hadn't worked the first time I tried it. I proceeded to reinstall Windows onto his 1st hard disk, and followed simplezz's instructions to get Grub back on his HDD 1. Windows wasn't available as an option until I booted into Linux and did 'sudo update-grub' as xorangekiller said.

That was it, both Linux installs are now bootable and both disks can be booted individually.... mission accomplished! :D

Thanks for reporting back. Glad to hear that everything went well. Learning something new is always a good thing (especially if it turns out to be easier than you anticipated).

Indeed my friend, and thanks once again to your and simplezz's instructions. They were perfect - that was all I needed to do! :)

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Display Driver Uninstaller (DDU) 18.1.5.5 by Razvan Serea Display Driver Uninstaller (DDU) is a utility for completely removing AMD/NVIDIA/INTEL graphics drivers and related packages from your system, attempting to eliminate all leftovers (including registry entries, folders and files, driver store). Though AMD/NVIDIA/INTEL drivers can usually be removed via the Windows Control Panel, this uninstaller tool was created for situations where standard uninstall fails, or when you need to fully remove NVIDIA or ATI graphics card drivers. After using this driver cleaner, your system will behave as though it’s the first time you’re installing a new driver—similar to a fresh Windows installation. As with all such tools, we recommend creating a restore point beforehand, allowing you to undo changes if issues arise. If you're having trouble installing an older or newer driver, try it—there are reports that it resolves such problems. Recommended usage: The tool can be used in Normal mode but for absolute stability when using DDU, Safemode is always the best. Make a backup or a system restore (but it should normally be pretty safe). It is best to exclude the DDU folder completely from any security software to avoid issues. You do NOT need to uninstall the driver prior using DDU. Requirements: .NET Framework 4.8 Compatible with Windows 7, 8, 8.1, 10, and 11 (32-bit or 64-bit) Note: Using on Insider Preview builds is at your own risk. Display Driver Uninstaller (DDU) 18.1.5.5 changelog: Added 'Reset to recommended' button for the Options. General fixes and improvements. Download: Display Driver Uninstaller (DDU) 18.1.5.5 | 1.7 MB (Freeware) Download: DDU Portable | 1.2 MB Links: Display Driver Uninstaller Home Page | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • WACUP 1.99.51.24568 Preview by Razvan Serea WACUP (WinAmp Community Update Project) is a modern, enhanced version of the classic Winamp music player, designed for better stability, performance, and compatibility. Built for Windows, WACUP retains the familiar Winamp interface while adding 64-bit support, bug fixes, and new features like improved audio format support, customizable skins, and optimized playlist management. Unlike bloated alternatives, WACUP focuses on lightweight performance and regular updates, making it the best choice for fans of the classic Winamp experience. Basically, if you miss the good old days of Winamp and want a modern upgrade that doesn’t mess things up, WACUP is for you! WACUP key features: Classic Winamp Feel – Keeps the familiar interface and functionality. Bug Fixes & Stability – Fixes old Winamp issues and improves performance. 64-Bit Support – Works better on modern systems. More Formats & Plugins – Supports additional audio formats and third-party plugins. Customizable UI – Skins and tweaks for a personalized look. Better Library Management – Improved playlists, media organization, and search. No Bloat – Focuses on performance without unnecessary extras. Regular Updates – Community-driven development with new features and fixes. WACUP 1.99.51.24568 Preview changelog: Fixed a deadlock seen from the recent crash reports when doing some of the drag + drop actions within the media library window Fixed a loading crash seen related to a problem with some of the artwork cache image files being restored which should now be better handled allowing for the bad image to be removed without it failing Fixed a deadlock seen from the recent crash reports when the internal metadata cache clearing is triggered which could block the main ui thread for too long with this now being moved to a background thread Fixed some performance issues with some of the methods related to determining artwork support which mainly affected the local library import / refresh (this is still slower for some compared to other players because there's more data & artwork aspects being checked for which means doing more processing on a single file despite the best of attempts to reduce duplicate / heavy processing where possible) Fixed a crash with the JTFE based missing files hotkey which no one seems to have used for an age for this to appear (maybe it's time to seriously consider stripping out features that aren't being used) Fixed how some of the file types which use extra information to reference their sub-songs is handled which was preventing some from being correctly resolved back to their base file (noticed fixing above) Fixed an issue with the handling of files with underscores in their filepath which wasn't being correctly handled causing some of the filename to be lost when shown as the title if title reading is delayed Fixed a few things that might be behind NotSoDirect not being stable for some setups though am still not certain that the changes done for this are going to fully resolve the problem from the crash reports Fixed the OS toast handling when there's no prior shortcut in the OS start menu to now create the shortcut (needed to allow the yes/no buttons for the new build / post-release toast) to be done as a hidden one so it's less likely to cause annoyance for those not wanting to see it whilst still allowing this less than ideal OS api implementation requirement to be met to avoid toasts without the needed buttons Fixed a regression when moving from taglib1 to taglib2 which broke some of the handling in place to allow for external programs to still access files when wacup has a held open cached instance of the file Everything else Updated cppwinrt (gen_win10shell.dll) to 3.0.260520.1 (26 May 2026) Updated libcurl (libcurl.dll) to 8.2.1 (24 Jun 2026) Updated Monkey's Audio (in_ape.dll) to 13.15 (28 Jun 2026) Updated mpg123 (mpg123.dll) to 1.33.6 (6 Jun 2026) Updated OpenSSL (libcurl.dll) to 3.5.7 (9 Jun 2026) Updated pugixml to 1.16 (16 Jun 2026) Updated taglib (tag2.dll) to 2.3.0 (11 May 2026) Updated vgmstream (in_vgmstream.dll) to the latest Git commit from 28 Jun 2026 Download: WACUP 64-bit | 9.6 MB (Freeware) Download: WACUP 32-bit View: WACUP Website | Screenshots Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • "over a thousand engineering hours" and started selling it but could not take a couple of minuets to send an AI email to ask permission. What an expensive lesson.
    • just tested it yesterday, a simple page with autoloading ADS takes 60mb....just 1 page for 60 megabytes.   poor people with a limited internet never will visit neolose
    • Tor Browser 15.0.17 by Razvan Serea Protect your privacy. Defend yourself against network surveillance and traffic analysis. Tor is a network of virtual tunnels that allows people and groups to improve their privacy and security on the Internet. The Tor software protects you by bouncing your communications around a distributed network of relays run by volunteers all around the world: it prevents somebody from watching your Internet connection and learning what sites you visit, it prevents the sites you visit from learning your physical location, and it lets you access sites which are blocked. The Tor Browser Bundle lets you use Tor on Windows, Mac OS X, or Linux without needing to install any software. It can run off a USB flash drive, comes with a pre-configured web browser to protect your anonymity, and is self-contained. Tor Browser 15.0.17 changelog: All Platforms Updated Tor to 0.4.9.11 Updated NoScript to 13.6.25.1984 Build System / All Platforms Bug tor-browser-build#41821: Update gpg subkeys for boklm Bug tor-browser-build#41827: Update morgan's keychain with renewed key Download: Tor Browser (64-bit) | Tor Browser (32-bit) | 109.0 MB (Open Source) View: Tor Browser Website | Other Operating Systems Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • Week One Done
      Collagen Project earned a badge
      Week One Done
    • Reacting Well
      Wakeen1966 earned a badge
      Reacting Well
    • Rookie
      Almohandis went up a rank
      Rookie
    • Apprentice
      jahara21 went up a rank
      Apprentice
    • Reacting Well
      NovaEdgeX earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      526
    2. 2
      +Edouard
      265
    3. 3
      PsYcHoKiLLa
      146
    4. 4
      Steven P.
      99
    5. 5
      macoman
      55
  • Tell a friend

    Love Neowin? Tell a friend!