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

    • All these CEOs got the biggest boners thinking about firing employees for AI. Turned out it was just a wet dream.
    • And the fact that the majority of people from Poland are white European Christians while the people you are complaining about in post after post are not is just a coincidence... Every sentence in your post I am replying to is racist nonsense. None of it is actually based on any facts whatsoever. All immigrants are seeking a better life too. It's literally the only reason they would risk everything and leave their homes, families, and homeland. They are working and contributing to the economy too, as you even admit. They get the same benefits your partner did AND that YOU are eligible for as well. That is one of the key things of the EU and a mark of a civilization. That is the definition of a society where everyone is given a chance, treated equally and fairly, and is judged by the content of their character, not their different skin color or which version of ignorant superstitious nonsense their parents lied about as children. Racists around the world said the same things about the Irish and Jews and Poles (like your partner) and...every other immigrant movement over the centuries. What's your family's heritage, by the way? Were your ancestors lied about with racist fearmongering crapola by self-entitled locals the same way as you are now? If someone like that said the same things about all people from Poland, like your partner, would they be right? Or would you want them to judge your partner based on who they actually were, not where they just happened to come from?
    • Again, this is an irrelevant attempt to attack the messenger. The truth does not require any justification.
    • Removed the blue and underline as you did not post a link. This would also  be considered spamming.
    • Why it's almost impossible to produce a smartphone in the United States by Hamid Ganji If you look at the back of some Apple products, you can see the famous phrase “Designed by Apple in California, Assembled in China.” This phrase appears on products from one of the largest smartphone brands in the United States. These products are designed in the U.S., but their manufacturing takes place in China, India, Vietnam, or even Brazil. But why can’t Apple, as one of the largest American tech companies, produce its iPhones on U.S. soil? The idea for this topic came to me after the Trump Foundation launched a smartphone called the T1 and claimed that it was designed and built with American values in mind. However, this claim did not last long, as it was revealed that Trump’s phone was actually a rebranded HTC U24 Pro, with only a gold case and minor internal component changes. You see? Even a phone that is supposed to represent American values is manufactured in China. With a gross domestic product (GDP) exceeding $32 trillion, the United States is currently the world’s largest economy, while China ranks second with around $20 trillion. On the other hand, the United States is by a wide margin the global leader in various technological fields, and American companies spend hundreds of billions of dollars annually on research and development. From Apple and Google to Microsoft, Lockheed Martin, Boeing, and others, American tech and industrial giants lead their foreign competitors in many sectors. The United States also has no shortage of smartphone brands. Apple, Google, and Motorola are among the major brands in the smartphone market, collectively holding a significant share. However, the vast majority of their products are manufactured outside the United States. So why is it that the world’s largest economy, home to the most advanced technology companies and industrial powers, cannot produce a smartphone on its own soil? Let’s explore this question together. Even threats to impose tariffs won’t work After Trump entered the White House as the 47th President of the United States, his administration adopted strict tariff policies. One of these policies was the imposition of a 25% tariff on smartphones manufactured outside the United States. Trump said he “had a little problem” with Apple CEO Tim Cook over producing smartphones outside the U.S. So he thought that threatening a 25% tax on imported phones might force Apple to bring manufacturing back to the United States. “I have long ago informed Tim Cook of Apple that I expect their iPhones that will be sold in the United States of America will be manufactured and built in the United States, not India, or anyplace else,” Trump wrote on Truth Social. Image via The White House Although Apple currently manufactures some of the iPhone’s chips in the United States with TSMC's help, it still shows no willingness to shift full iPhone production to the country. At the time, renowned Apple supply chain analyst Ming-Chi Kuo wrote on X, “In terms of profitability, it’s way better for Apple to take the hit of a 25% tariff on iPhones sold in the US market than to move iPhone assembly lines back to the US.” However, manufacturing a smartphone in the United States is not as easy as it might seem, and many technical and economic barriers are involved. The lack of necessary manufacturing hubs There is a clear reason why many companies prefer to manufacture their products in China. China has established itself as the main global manufacturing hub for international companies, and over the past few decades, large contract manufacturers have emerged there, allowing companies like Apple to outsource production. One such example is Foxconn, which also manufactures some Apple products in India. Building the infrastructure required to produce smartphones in the United States would require tens of billions of dollars in new investment. Factories would need to be built, essential manufacturing equipment would have to be installed, and, most importantly, a skilled workforce capable of operating these systems would need to be recruited and trained. The United States currently lacks the core infrastructure needed to manufacture smartphones, and for this reason, many companies prefer to outsource production to Chinese contractors rather than spend tens of billions of dollars to build that infrastructure, which is significantly more economically efficient. Additionally, building such infrastructure in the United States could take up to a decade, ultimately leading to a significant increase in the product's final price for consumers. Shortage of trained labor in the U.S. compared to China Decades of serving as a global manufacturing hub have allowed China to build a massive talent pool in the production sector that is almost unmatched worldwide. Today, if a company chooses to manufacture its products in China, it can be confident that the workers involved in production have years of experience in their respective roles and are capable of producing high-quality goods with minimal errors. Even if we assume that tens of billions of dollars were invested in building smartphone manufacturing infrastructure in the United States, finding skilled workers would remain highly challenging. Apple CEO Tim Cook visiting the iPhone 6 assembly line in China in 2014. Image: Tim Cook on X In a 2015 interview on CBS’s 60 Minutes, Tim Cook said the main reason Apple isn’t producing in the US is a lack of skills. "China put an enormous focus on manufacturing, in what you and I would call vocational kind of skills. The US over time began to stop having as many vocational kinds of skills. I mean you could take every tool and die maker in the United States and probably put them in the room that we're currently sitting in. In China you would have to have multiple football fields,” Cook said. Also, in 2017, at the Fortune Global Forum in Guangzhou, Cook once again emphasized the importance of highly skilled Chinese workers. “China has moved into very advanced manufacturing, so you find in China the intersection of craftsman kind of skill, and sophisticated robotics and the computer science world. That intersection, which is very rare to find anywhere, that kind of skill, is very important to our business because of the precision and quality level that we like. The thing that most people focus on if they’re a foreigner coming to China is the size of the market, and obviously, it’s the biggest market in the world in so many areas. But for us, the number one attraction is the quality of the people,” Apple CEO said. Higher labor costs in the United States Producing almost any product in the United States is more expensive than in many other countries, and one of the main reasons is the higher cost of labor in the U.S. According to the Bureau of Labor Statistics, median weekly earnings of full-time workers in the United States were $1,235 in the first quarter of 2026. Meanwhile, the average annual salary in China's private sector in 2025 was RMB 71,590 (US$9,961). In many parts of the world, the weekly wage of an American worker is equivalent to several months of income. Another important factor to consider is that in the United States, the workforce capable of working on a smartphone assembly line is highly specialized and therefore commands higher-than-average wages. According to an estimate by Bank of America, producing an iPhone in the U.S. is technically possible, but “iPhone cost can increase 25% purely on higher labor cost in the U.S.” However, this 25% increase applies only if final assembly is performed in the United States while components are still sourced from China or elsewhere. In this case, the price of a base iPhone would rise from $799 to around $1,000. But in another scenario, if Apple were to produce the required components for the iPhone within the United States, production costs could increase by more than 90%. Trump’s dream for a “Made in the USA” iPhone might never come true In a free-market capitalist economy, one of the primary responsibilities of any CEO is to maximize profit. Using Apple as an example, Tim Cook’s role is to maximize the company’s profits so that it can fund research and development for new products and invest in areas such as artificial intelligence, while also keeping shareholders satisfied. Therefore, it is entirely understandable that Apple would choose not to bring its manufacturing back to the United States and instead keep production in countries where labor is cheaper, and products can be manufactured at a lower cost, thereby maximizing its profit margins. What is your opinion about manufacturing smartphones in the United States? If you are an American citizen, would you be willing to pay hundreds of dollars more for a smartphone made domestically in the USA? Let us know in the comments.
  • Recent Achievements

    • Conversation Starter
      jessse3334 earned a badge
      Conversation Starter
    • Reacting Well
      JuvenileDelinquent earned a badge
      Reacting Well
    • One Month Later
      Excellence2025 earned a badge
      One Month Later
    • Week One Done
      Excellence2025 earned a badge
      Week One Done
    • Week One Done
      flexorcist earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      506
    2. 2
      +Edouard
      196
    3. 3
      PsYcHoKiLLa
      153
    4. 4
      Steven P.
      72
    5. 5
      FloatingFatMan
      65
  • Tell a friend

    Love Neowin? Tell a friend!