LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Laptop and Netbook (https://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/)
-   -   Is all hope lost? (https://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/is-all-hope-lost-876723/)

dariusjd 04-23-2011 07:33 PM

Is all hope lost?
 
Okay, I'm not sure if this is in the right section, but if it isn't, I'm sorry. Please move it. Now before we get into this, I will admit that I am a moron for doing this. But okay:

I have an Acer Aspire v5252 laptop. I installed Ubuntu via liveCD and dual booted it with Windows 7. I didn't like it, so I decided to get rid of Linux.
Some guide on the internet told me to delete the Linux partition from within Window's interface in order to get rid of Linux. I was not aware that this would delete my MBR/Grub. Now, I can't boot into Windows and when I start up the computer, I get "grub_rescue>".
I followed some more guides and I ended up booting the liveCD and compiling "ms-sys" to restore my Windows 7 boot record. I believe I used "sudo ms-sys -7 -f /dev/sda3". It told me that everything was done successfully.
I began to pat myself on the back and proceed to reboot the computer, hoping that the computer would now boot into Windows. Nope. Stupid grub_rescue> came up again.
I booted back into the Ubuntu liveCD and went to the Disk Utility and discovered that my partition that once read "Acer" and had all of my Windows files in it, was now gone and that allocated space read "Unknown". I used to be able to browse my Windows installation from within Linux/liveCD, now I cannot. I am assuming that I just f.cked myself, but I'm not sure!

Did I do something stupid and corrupt my Windows 7 installation? Is there anyway to rectify this and go back to my Windows 7 installation? Or am I forever doomed with my liveCD?

stress_junkie 04-23-2011 07:50 PM

It sounds like Windows is gone. If your computer came with a factory restore disk then you could use that to restore Windows. If you do not have one then you may be able to purchase one from Acer. If that is not available and you still want Windows then you will have to purchase a new Windows installation kit. Keep in mind that a generic Windows installation kit will not have Acer specific drivers. You would need to download those from the Acer web site if they are available.

If none of those options are appealing or available then you can still install Linux or BSD UNIX for free.

T3RM1NVT0R 04-23-2011 07:54 PM

@ Reply
 
Well not sure if it will recover or not but you can give it a try:

1. Boot the system using Windows 7 CD.
2. It will prompt you whether you want to install Windows 7 or repair.
3. Select the repair option.
4. It will give you couple of options. Don't try any option as of now. Just hit ctrl+F10. This will open up a command prompt.
5. From command prompt try typing C: to see if you are able to get in there. If it is unable to find any C: try with D: and try to do dir.
6. If you are able to see your files in there like: windows, Program Files etc you still have hope.

Try this and let me know how it goes and we can take it from there.

MS3FGX 04-23-2011 08:01 PM

I would say you pretty much destroyed the system, yes.

To start with, simply deleting the Ubuntu partitions is not the appropriate way to remove Linux, as it (as you have found out) still leaves the Linux bootloader in the MBR. With the Linux partition removed, the MBR is unsure how to proceed, so it throws up the problem you were seeing.

You then attempted to use "ms-sys" to repair the MBR, which was a step in the right direction. Unfortunately, it looks like you didn't read the documentation very clearly, or perhaps were not sure about the different components in the bootloader/MBR setup.

The command you ran:

Code:

sudo ms-sys -7 -f /dev/sda3
If we look at the documentation for those two switches:

Code:

Usage:
        ms-sys [options] [device]
Options:
-7, --mbr7      Write a Windows 7 MBR to device
-f, --force    Force writing of boot record

So what you did was tell ms-sys to force writing of an Windows 7 MBR to the third partition of the primary drive. Unfortunately, the MBR is not supposed to be written to a partition, it is meant to be written to the root of the drive itself, in this case, just /dev/sda.

If we check the last line of ms-sys's help, we get a big clue as to what happened:

Code:

Warning: Writing the wrong kind of boot record to a device might
destroy partition information or file system!

Presumably, had you not used the -f option, ms-sys would have refused to write an MBR to the invalid location. But since you told it to go ahead with the operation anyway, it wrote the MBR to the NTFS filesystem and blew it away.

Now, if there is any good news, it is that the MBR is a very small bit of data. So all that got written into the Windows 7 partition was a few bytes. Just enough, apparently, to smash up the filesystem, but it shouldn't have been enough to delete much of the actual content. You should be able to use data recovery software to get your data off of the drive intact, though I would say that repairing the filesystem and Windows itself would take more time than it is worth. I would suggest getting the data off of it, and then simply reinstalling Windows.

jthill 04-23-2011 08:07 PM

All hope is not lost.

/dev/sda3 is the third partition on your drive. You wrote a master boot record for the whole disk into your windows partition's boot slot. You wanted 'ms-sys -7 /dev/sda'.

http://www.ntfs.com/boot-sector-damaged.htm says you can run FIXBOOT from a Windows install disk's repair/rescue environment to copy a safety mirror of the partition boot record from its hiding place elsewhere in the partition. ms-sys's doc says it can write proper partition boot records with '-p', like 'ms-sys -p /dev/sda3', but it also warns there are differences in how Windows and Linux see partitions so this can cause problems.

Good luck.

dariusjd 04-23-2011 08:10 PM

Thank you all for your replies. And yes, MS3FGX, you are correct, I did not read the documentation thoroughly. Instead, I was being a moron and skimming the guide that I had looked up. There drive only consist of some mp3s and a few documents. If I can get those documents back, I wouldn't be beat up about this. Three questions:
  1. Can I run some kind of data recovery software from the Ubuntu liveCD? I was thinking that I could recover the data via the liveCD, upload it to my file server and proceed with reinstalling Windows. At this moment, the former Windows partition is just sitting there, labeled as "Unknown" and unmountable - will data recovery software even recognize it?
  2. If I did decide to attempt to repair the Windows installation with the disc, would the Windows disc even recognize the installation?
  3. When that master boot record was -forced- to be written, how exactly does that destroy the entire drive? Haha, I just don't understand that for some reason. But okay.


ADDITION: I forgot to mention: I do have a partition that was created by Windows remaining. It is labeled as "PQ Service". It has a "bootmgr" file, a "System Volume Information" folder and something else (I have to reboot the liveCD to check) in it. This was used by Windows Restore, I think. Is this of any use?

TobiSGD 04-23-2011 08:36 PM

1. I don't know if the Ubuntu-CD has it already installed, but you should be able to install testdisk even in the live environment, it is not so large. Testdisk contains the photorec-program, which is exactly what you need.
2. I would just give it a try, after you have rescued your data.
3. I don't know.

nicolasjengler 04-23-2011 08:46 PM

Quote:

Originally Posted by TobiSGD (Post 4334031)
1. I don't know if the Ubuntu-CD has it already installed, but you should be able to install testdisk even in the live environment, it is not so large. Testdisk contains the photorec-program, which is exactly what you need.
2. I would just give it a try, after you have rescued your data.
3. I don't know.

That's it. The problem now is that photorec recovers documents but "doesn't know" where they start and where the should finish so you may have to check out every document in order to see if everything's alright. Also photorec recovers the documents but not their name, only their extension. So if you had document.doc it will now be file00001.doc or something like that.

dariusjd 04-23-2011 08:52 PM

Quote:

Originally Posted by TobiSGD (Post 4334031)
1. I don't know if the Ubuntu-CD has it already installed, but you should be able to install testdisk even in the live environment, it is not so large. Testdisk contains the photorec-program, which is exactly what you need.
2. I would just give it a try, after you have rescued your data.
3. I don't know.

Quote:

Originally Posted by nicolasjengler (Post 4334035)
That's it. The problem now is that photorec recovers documents but "doesn't know" where they start and where the should finish so you may have to check out every document in order to see if everything's alright. Also photorec recovers the documents but not their name, only their extension. So if you had document.doc it will now be file00001.doc or something like that.

Can testdisk fix my Windows partition by any chance? I was reading up on it's documentation and it says that it repairs drives.
Also, photorec says it only for photos. It recovers documents too?
And lastly, can these programs from the Ubuntu liveCD? I keep running out of space when I try it.

syg00 04-23-2011 09:08 PM

I don't know what you're reading but you'd be better off at the homepage.
Quote:

Originally Posted by testdisk
It was primarily designed to help recover lost partitions and/or make non-booting disks bootable again

Quote:

Originally Posted by photorec
file data recovery software designed to recover lost files including video, documents and archives from hard disks, CD-ROMs, and lost pictures (thus the Photo Recovery name) from digital camera memory

They will run from the liveCD fine, but may be recovering to the (in-storage) current directory. Not much use.
To save all the guesswork, go here and do as it says.

TobiSGD 04-23-2011 09:16 PM

When using photorec from a live-CD you have to either use a external drive or a mounted network share. Didn't you say that you want to use your file-server for that?

And, as syg00 already stated, the first places for getting information about software are the manpages, the documentation in /usr/share/doc and the website of the developer. Keep in mind that 'some guide on the internet' in the first place caused your problem.

EDDY1 04-23-2011 09:33 PM

Boot ubuntu live-cd and see if you still have your pq service.
You can restore from there.

MS3FGX 04-23-2011 10:39 PM

Quote:

Originally Posted by dariusjd (Post 4334017)
  1. Can I run some kind of data recovery software from the Ubuntu liveCD? I was thinking that I could recover the data via the liveCD, upload it to my file server and proceed with reinstalling Windows. At this moment, the former Windows partition is just sitting there, labeled as "Unknown" and unmountable - will data recovery software even recognize it?
  2. If I did decide to attempt to repair the Windows installation with the disc, would the Windows disc even recognize the installation?
  3. When that master boot record was -forced- to be written, how exactly does that destroy the entire drive? Haha, I just don't understand that for some reason. But okay.

1. It looks like the previous posts have covered this pretty well already, but yes, that would be the general idea. Use the live CD to run any number of data recovery tools, and get it onto a server or removable device. Even though the partition is showing up as unknown right now, the recovery tools are designed to ignore that and deal with the raw data on the disk itself.

2. Probably not. If I had to guess, I would say that the Windows install CD will see that there is a partition there, but not recognize it as a valid Windows installation. As such, you probably won't even get the option to use the repair functions. But I could be wrong, it has been a long time since I installed Windows, perhaps the installer has gotten smarter since then.

3. It didn't, really. But it blew away the data at the very beginning of the partition, which happens to be a very important bit. Basically, writing the MBR to the partition overwrote the part of the partition which explains what kind of filesystem is on it, so the OS (Windows, Linux, whatever) doesn't know how to read it.

dariusjd 04-24-2011 01:25 AM

Okay guys. You have all been a tremendous help and I thank every last one of you!

I just put in a Windows 7 disc and I ran the repair process. Miraculously, Windows recognized my previous Windows 7 installation. I ran a system restore and the regular "Repair this Installation" option. I rebooted the computer and still got the stupid "grub rescue>" thing. Even though the Windows disc is recognizing my installation, should I just forget about it and reinstall?
I do have access to the command prompt.

EDIT: Actually, I was about to access all of my files via the command prompt. This is incredible; I thought all of my files were gone. However, I am still missing my MBR and I cannot boot into the OS. I have a Windows 7 disc and a Ubuntu LiveCD. I am contemplating going into Ubuntu and trying ms-sys again, but I'm afraid of losing my files for good. Any ideas guys?

syg00 04-24-2011 01:34 AM

Read this technet note.
Use /fixmbr and maybe /fixboot.


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