I had dual operating systems but when i re-install windows after that my ubuntu has been disappeared

Asked by muryali

Hi all,
I had two operating systems on my desktop. My windows had problem therefore I format windows partition and reinstall it. after that only windows is working i cant see ubuntu. I have two hard drives one for Ubuntu and one for Windows. my system is showing only windows disk.
Any one can help me please.
Many thanks.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu grub Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Karunesh Johri (kj-softprayog) said :
#1

That is because Windows has overwritten the Grub bootloader. A simple way is to re-install Ubuntu. You will get Windows as well as Ubuntu. If your user files are in a separate partition, take care to use manual partitioning of hard disk during (re)install of Ubuntu. Do not format /home partition.

Revision history for this message
sim-value (sim-value) said :
#2

http://ubuntuforums.org/showthread.php?t=224351

This is a tutorial how to restore GRUB bootloader which will gve you dualboot back

Revision history for this message
muryali (mkhalid-dikhan) said :
#3

dear sim-value
your article has not solve my problem. please not I have two hard drives for each OS

Revision history for this message
Tom (tom6) said :
#4

Reinstalling Ubuntu is a very Windows-ish answer. Sometimes it is necessary or easier but often there is a much more elegant way of working with linux that is completely unavailable in the Windows world.

As stated the problem is that a crucial part of your ubuntu's boot-loader, usually called 'grub' = GRand Unified Boot-loader, although sometimes a linux might use the Lilo boot-loader instead (very rare for Ubuntu, usually ubuntu uses grub). The part that installing Windows has overwritten is the part in the MBR (= Master Boot Record) of your hard-drive. Each hard-drive has only one MBR and most OS's can 'fix' it to read only there own boot-loader. To solve your problem, of getting an options to boot into either Windows or Ubuntu as and when you please you have 5 basic choices - of which sim-value gave the best choice. The options are

1. Reinstall grub, sim-value's answer. To boot into a LiveCd session simply get an Ubuntu Cd, the one you installed from is fine or else download another one from
http://www.ubuntu.com/getubuntu/download
Then put the cd in your cd/dvd drive and reboot the machine - choose the default option to "Try ubuntu without changes to my machine". If you installed ubuntu via a network or Usb stick then use either of these to boot the machine and choose the same option. Cd is usually the easiest option if available. This should get you to a working desktop which we call a "LiveCd session", if it works. Most distros of gnu/linux have this feature and i would tend to use my favourite for this type of work called Wolvix Hunter from
http://distrowatch.com/table.php?distribution=wolvix
DistroWatch is a popular & great place to compare and explore different distros from as it includes BSD & some pure Unix (rare for desktops) distros as well as the gnu/linux and hurd/linux (rare) - mostly though distros on there are the gnu/linux ones like Ubuntu (which happens to be top of their charts of top 100 popular distros ;) ). Ok, that sounded like a long answer but it just boils down to "Boot up from the installer cd to get to a working desktop and follow instructions from sim-value's link".

2. Install a new distro to a new partition on your drive and let it's boot-loader over-write the MBR and automatically pick-up on all the other OS's on your computer. Only the Windows boot-loader is incapable of doing this but it's fairly standard for gnu/linux, bsds, unix, mac and hurd/linux - really everyone else except Windows finds this easy to do automatically. Although this answer looks short there's a lot of faffing around and so many choices to make that and quite a few possible complexities that i would avoid it until you want to start trying out different distros for fun. Perhaps in a weeks time you'll be more than ready to start enjoying this exploration of the linux world :) A cautionary note tho ...
http://forums.wolvix.org/index.php/topic,1040.msg4956.html#msg4956

3. Create a new tiny partition of 100Mb and install grub (or lilo) to that, the same way as for option1. Again either grub or lilo should automatically pick up on Windows & Ubuntu and any other OS's on your system. Again if it doesn't automatically do so then it's just a case of using a text-editor like Notepad although Gedit or nano or something in a linux LiveCd is likely to be an easier text-editor to use for this, given that Windows fails to be able to read other distros partitions and anyway notepad is a bit limited anyway - i used to be a big fan of notepad. Although this seems a shorter answer and quite a few techie types recommend this route i would still stick with any of the other options because i don't like having lots of different partitions each wasting a little empty space.

4. Download and install "grub4dos", sorry i don't have a link perhaps google or something could help with this. Installing that grub inside Windows should be fairly easy and it should automatically pick up on all the OS's on your system, even if that's just Windows and Ubuntu. Again if it doesn't automatically detect all the OS's then it's just a case of neatly editing a text-file called "menu.lst" that even contains notes inside the text-file to help you with the editing! Notepad really would work well for this but i'd still rather use gedit or nano or some other linux text-editor.

5. Tweak and edit the Windows boot-loader to include an option for booing into Ubuntu. I have been told this is fairly easy but i've never seen how to do it. I'm completely clueless about doing this but my very techie neighbour did manage this and assures me it's really quite easy. I would definitely avoid this option if at all possible.

6. Reinstall Ubuntu, Karunesh Johri's answer. The advantage with this is that you've already done this once so you already know and have at least passing familiarity with the process. Karunesh Johri's suggestion of copying your /home directory onto a new partition and then noticing the bit in the installer where it lets you use this new partition as your new /home partition is brilliant and you'll end up with a much stronger system as a result of doing this.
  It's definitely recommended by techie's and even normal users soon see the benefits - even on a tiny drive like mine it would be an advantage. The root partition for Ubuntu only needs to be about 15Gb, i've gotten away with only 10Gb or even less on other machines but some people like to install lots of programs and have gone for 25Gb or even more if they plan to install Windows games into Ubuntu.
  The root folder of a linux (and possibly other *nix's too) is "/", notice that "/home" is a sub-folder within "/" and even though my poor limited human brain has difficulty with the concept that the "/home" folder can be on a different partition, possibly even one that's on a different drive, from the root folder "/" it's good to see that gnu/linux's like Ubuntu have absolutely no trouble with this and even prefer it to be like this! You might notice a performance increase with /home on one drive (perhaps with your swap partition if you have one) and your root "/" folder on a partition on a different drive. Note that the root folder "/" is roughly equivalent to the "C:" 'drive' in Windows.
  Windows (as usual) likes to confuse the issue by calling partitions 'drives' even when they are on the same physical drive! Imagine the scenario of buying a machine with only one physical drive. Windows then lets you 'partition it' and you end up with '2 drives; C: and (posssibly) D:' but when you open the side of the machine you still only have one physical hard-drive! Now i'm really confused! Windows really can't cope with having more than one partition or more than one drive but linux's grew up out of unix's which were designed to run on multi- well, pretty much anything and everything type systems :)
  Note that the /home folder contains all your normal users (and any guest) accounts and contains all your settings and data for everyone that uses the system so having it on a separate partition keeps it away from the OS and programs parts of Ubuntu, hence reinstalling becomes easier and safer, less need to backup your data. The only exception is the "SuperUser" often (and confusingly) called the "Root" user. It's best to avoid being superuser even temporarily if at all possible because of your systems security but sometimes it is necessary :( Almost all linux's avoid the need for you to use the superuser account much at all. Ubuntu is particularly careful :) Windows invariably runs as superuser almost all the time, even dropping you into superuser mode without letting you know and failing to get back into normal user mode afterwards! And then they wonder why viruses and malware are so prolific! Something like 300,000 known Windows viruses compared to 300 known linux ones, even those 300 are more of an endangered species as long as you avoid deliberately logging in as superuser (which is different from a user with "Administration rights").
  To avoid this whole issue about setting up new and different partitions i would just re-install using the "Manual Partitioning" option about halfway through the installers questions at the start. From this make sure that all partitions are UNticked in the "Format Partition?" column and this should prevent your data and settings (and even programs too) from getting overwritten. Not many people seem to know you can 'fool' the installer this way but i have managed this many times myself and other people have also managed it quie successfully. The time it goes wrong is the time you haven't backed up your data to external drive or dvd's of course but that's 'Murphys Law" so make sure you do backup just to make sure you didn't need to!
  One day i fancy trying to install and use Ubuntu for a little while and then partition off a spare 15Gb at the end of the drive and then try installing Ubuntu onto that and tell it that my 'pre-existing Ubuntu' is really just a /home partition. I'm curious to see if that will work and i suspect it will - Allowing me to boot into either Ubuntu with both looking and working pretty much the same as each other but i am curious to see exactly what really happens ;) Sadly my drives at the moment are way to small to be able to even try this this out. The final push that drove me to use linux was that Windows hosed my decent large and fairly new drives through some sort of innocuous user-error. I'm fairly sure the data is recoverable but the partition tables have been 'wiped'. I'm happily using old ancient drives on a fairly new(ish) system with Ubuntu in the meantime but one day plan to get around to sorting out the decently large drives.

To summarise, i would recommend trying one of the options to simply install (or reinstall preferably) the grub boot-loader. Sim-value's answer was best for almost every case. Although allegedly possible i would avoid using a boot-loader that's stored on a Windows partition, except out of curiosity to see how long before it fails. Karunesh Johri's answer hints at a better longer-term answer but is probably a little trickier than required right now, unless you already have /home on a separate partition in which case it might well be the easiest answer for now because you're already fairly familiar with most of the process :)

Linux is about Freedom and choice. An answer that is 'best' in 99% of cases might not be best for you or you might anyway choose to try out something different. In the Windows world trying to do something a different way often seems to generate a response like "You idiot, you've broken it now. It's your fault and you've got to spend a lot to fix it" (even for a trivial problem such as mouse opens things on a single click now instead of double-click) whereas trying something different in linux often generates a "Wow, i can't believe that works too! It's better that way, i think i'll copy your way now just to see what it's like" lol. Of course you could always just follow the standard answers instead ;)

Good luck and regards from
Tom :)

Revision history for this message
Tom (tom6) said :
#5

Lol, typical - i said 5 choices and then thought of an extra couple of options in the middle and forgot one i'd meant to include, lol, typical for *nix-land :) There's always another way i'm sure :) and i also forgot the link
https://help.ubuntu.com/community/WindowsDualBoot#Recovering%20GRUB%20after%20reinstalling%20Windows
which says about the same as sim-value's but only covers a single hard-drive and is slightly less easy to work from because it tries to be to brief!

Revision history for this message
Tom (tom6) said :
#6

In my last link

https://help.ubuntu.com/community/WindowsDualBoot#Recovering%20GRUB%20after%20reinstalling%20Windows

just before stage 4 try the same as in sim-value's link. From a LiveCd session go up to the top taskbar and click on

Applications - Accessories - Terminal

and into the terminal/command window/console try

sudo grub

it asks for your normal user password, not your SuperUser/Root one. It gives a new type of command-line, this one is the grub's own command-line! Now type in

find /boot/grub/stage1

this should give a few (hopefully only 1 this time though) answer such as

"(hd0,1" or "(hd0,2)"

The boot-loader is made to talk mainly with the machine and so it starts counting from 0 instead of 1 so if Ubuntu was installed on the 3rd partition of your primary (master or only) hard-drive then while linux will call it sda3 then grub will call it (hd0,2) - while the 2nd partition on your secondary (slave or 2nd) hard-drive would be sdb2 in linux but (hd1,1) in grub. Anyway, use the numbers your machine gives rather than my guess that it will say (hd0,1) and do

root (hd0,1)

setup (hd0)

This is probably best as 0 even if it said something like (hd1,2) before. (hd0) refers to the mbr on your primary hard-drive which is the normal place for the bios to look for instructions on where to find the boot-loader that takes over the boot-up process after the bios stage of the boot-up has finished it's part of the process. Then finally do

quit

To get back to a normal linux command-line in the terminal console and type

sudo reboot

hmm, i'm not sure but i think that you can run that without being superuser so perhaps it might be better to miss out the "sudo" command at the front and just type

reboot

either way should be fine though. As the LiveCd session does shutdown it should eject the Cd - take it out and close the tray. It might even ask you to do this and then press enter, some gnu/linux's do some don't - i can't remember the last time i tried this with Ubuntu ;)

Hopefully now during tis reboot you'll get the boot-menu offering Windows or Ubuntu? If not then we can just edit the text-file "menu.lst" to make sure it's all good again :)

Good luck and regards from
Tom :)

PS this post should have the complete answer. No need to read all the rest of my other posts!

Revision history for this message
muryali (mkhalid-dikhan) said :
#7

still i couldn't find any solution. some one said that there is a software that can do all these steps for me. any one can tell me please what is that one.

Revision history for this message
Tom (tom6) said :
#8

Hi again.

I think i made it sound too much. How long have you been using Ubuntu? Was there much stuff saved in Ubuntu that you cared about?

First can we try 1 step at a time? First step is can you put an Ubuntu cd in the cd/dvd drive and reboot the machine? Do you get a boot-menu with a top option saying something like "Try Ubuntu without making changes to my machine"? Does that get you to a working desktop with an install icon in the top left-hand corner?

Please let us know
Thanks and regards from
Tom :)

Revision history for this message
Tom (tom6) said :
#9

Hi, sorry for the double post again

I have a bad feeling that you previously had installed Ubuntu inside Windows using the Wubi installer whereas before my last posting we had all assumed you had installed the normal linux way. A clue would be the number of entries you used to have in your boot-menu. Did you used to get just one option for Windows and just one option for Ubuntu? If you had lots of Ubuntu lines to choose from then was there a line saying "memtest"? Just two options, one for Windows and one for Ubuntu would suggest that you had installed Ubuntu inside Windows and it's unlikely that you'll be able to recover anything from that without a lot of time and expertise.

There are some professional companies that specialise in data recovery but these tend to cost a fortune. It might be worth it if the data is impossible to reproduce and you've lost original sources and have no back-ups. The key is to stop using the drive at all right now. Get a 'new' drive from elsewhere (i used an old drive from an ancient machine), plug it inside your machine and install a linux onto that so that you can at least keep using the machine. If it's a tiny drive, say 10Gb or less and has Windows on it already then i would suggest using a smaller distro like Wolvix Hunter

Please let us know either way so we know how to help you further
Good luck and regards from
Tom

Can you help with this problem?

Provide an answer of your own, or ask muryali for more information if necessary.

To post a message you must log in.