Restore MBR with SysRescueCD - Question

Topics about disk partitioning (fdisk, parted, gparted, partimage), Volumes Management (lvm, evms, dmraid), Storage, file systems, ...
Post Reply
brotaffe
Posts: 2
Joined: 20 Jul 2009, 13:39

Restore MBR with SysRescueCD - Question

Post by brotaffe » 20 Jul 2009, 13:50

Hey guys.

I have the following problem:

Due to some bug (or a feature, whatever you want it to be) in the Windows Vista SP2, it cannot be installed if there are partitions on the hard disk that are not NTFS.

Of course I have several partitions with a non-NTFS formating.

A a workaround, one should "fix" the MBR using the "fixmbr" command of windows (as such getting rid of any non-NTFS partitions in the MBR), install the SP2 and restore the original MBR. Since I have made a backup of the MBR with your great little helper SysResCD, I want to use the necessary dd command to restore the MBR afterwards and get e.g. my GRUB bootloader back working again.

So my question is, does this work, or does the fixmbr command anything that cannot be fixed with dd again?

Are there any problems because of the extented partition table?

Thanks very much for advice,

brotaffe

Ruler
Posts: 35
Joined: 29 Jul 2009, 19:20

Post by Ruler » 30 Jul 2009, 20:30

I don't know if I'll be of much help, but I can tell you that dd can write pretty much anything to a drive. It does a binary copy. If you have an image of your drive created with dd if=/dev/sda of=file bs=whatever count=whatever and then use dd if=file of=/dev/sda bs=whatever, it will put it back EXACTLY the way it was before, down to the 1 and 0 level. However, this may not be what you want to do as it's quite dangerous. If you have too much or too little data, it could either overwrite data instead of just the boot record or overwrite part of it and leave the rest unchanged. Note that dd does not distinguish between the various data structures on a hard drive. The MBR, partition table, file system, etc are ALL treated the same.

There are a few options that I can see that might work. Any of them could conceivably cause data loss, so be sure to have a backup before trying any of them. (I detest vista and it wouldn't surprise me at all if M$ designed SP2 that way intentionally to combat people using a real operating system on the same hardware.) If you try them and nuke your OSs, configs, or lose the info on your drive because you don't have a backup, don't blame me - I've used similar techniques in the past to accomplish different things and they should work, but until trying them in a specific situation, I cannot be 100% certain.

1. Use the fixmbr command from windoze to kabosh your MBR and install SP2. Boot from your Linux install CD and use the root=/dev/sda[blah] parameter to boot the kernel off the CD and use /dev/sdablah as the root file system. You could then reinstall lilo or grub using either lilo or lilo -M /dev/sda or whatever the equivalent grub commands are.

2. fdisk /dev/sda and change all the partition types to 07, thereby making SP2 see only NTFS partitions. Assuming that windoze doesn't try to create a file system on them when it sees an NTFS file system with an invalid structure on it, you should be able to put them back with fdisk and have no data loss.

3. Partimage the non-ntfs partitions to a flash drive, delete them, upgrade vista, create identical partitions of the right types, restore image from partimage.

4. The best option of all would be to stop using that messy mac-OSX-wannbe cluster of an OS known as vista and use a real OS, using WINE and even Qemu for emulation if absolutely needed. :D


Hope I at least gave you some ideas. Best of luck to ya.

brotaffe
Posts: 2
Joined: 20 Jul 2009, 13:39

Post by brotaffe » 12 Aug 2009, 10:54

Hey Ruler!

Thanks a lot for your answer!

Well, after I tried about ANY solution for this SP2 problem (found about 8 different problems and possible solutions using google) and no one wokred (including yours, thx again) , I finally gave up.

After carefully reading the Knowledge Base of the SP2 Update (I should have done this a lot earlier, probably), I found out that the SP2 Update does not work on cloned partitions, whatever the reason. Unfortunately, I just restored an Image of the NTFS partitions a couple of mounth ago (for reasons I cannot really remember anymore) using DriveImageXML.

I think that's actually it.

I guess you would hardly believe it, but fortunately MS already published a workaround for that issue!!! Isn't that fantastic??

Guess what the "workaround" is.

Yeah. There can only be one if it is a suggestion coming from MS:

A complete ,fresh reinstall of the Vista partition.

Honestly, I was seriously pi**ed off when I read that.

Unfortunately, in this case I have to have Vista or Win7 in order to get MS Office to work absoluteley as much flawlessly as possible. I know MSO 2007 runs on WINE almost perfect (apart from the updates; use it myself on my machine), it just is no solution here.

I hope the tools I found to backup all the user accounts and other settings will work fine so that I will be able to do that on 1 day without any major problems.

Anyhow, I know that many people think this was done by MS on purpose. I have to confess I do not think MS to be that reckless on purpose. I rather think it just happened to be so in the production phase of SP2 and right now they have neither the manpower (aka time or money) to fix it. Vista is only supported two more years and hardly any non-private customer uses it -> No serious pressure for a fix.

So, again many thx for your help!


brotaffe

Ruler
Posts: 35
Joined: 29 Jul 2009, 19:20

Post by Ruler » 12 Aug 2009, 18:18

Sorry to hear about your luck on that, but I'm glad you found the problem.

I looked up that DriveImageXML and believe that the problem lies in how it creates/restores it's images. It says on the page that you can create images of partitions, even when they're in use. To me, this indicates a file-level backup instead of a system-level. (Very similar to the 'system restore' in windoze that I've never had fix anything.)

I would be interested to see how SP2 handles being installed on a partition that was cloned using a *nix based cloning tool. In theory (and from what I've experienced in practice as well), dd will duplicate everything on a drive, such that it's indistinguishable from the original. (It even tricks the XP activation BS that watches for a change in the hard drive! A guy ran out of space on his 30 gig drive running XP, so I used dd to clone the 30 gig onto a new 160 gig, then gparted to expand the partition to the full amount of available space. :) ) I've used it with great success in the past, but again I don't use vista.

Frankly, I don't think I could do my job without tools like dd, partimage, and the System Rescue CD in general. I've used different windoze-based tools and have always reverted to the linux utilities to get done what I need - too much odd behavior for my liking in the windoze versions.



Heh, I think we have differing views on microsoft, because I do think they're that careless. It's kind of like the calculator included with windoze 1.0 through 3.1 having 2.01 - 2 = 0 or the 49.7 days of run-time bug in 9x and NT until 2000 or so... both bugs existed for years, but they did nothing to fix them. (Of course, getting a windoze system to run for 49.7 days is a miracle in and of itself... ;) ) My boss has a tablet PC and the sound quit working on it one day. The driver was there and the speakers worked, but just nothing would come out. After much searching, I found reference to a patch that, if you had a sound card based on certain chipsets, had automatic updates on, and if it updated in a specific 4-hour window, your sound would be hosed. The only solution was to wipe and reinstall windoze. (Nobody has anything better to do, at least according to MS.) Having the firewall default to on in XP SP2 without telling you or giving you an option during the upgrade was ridiculous as well, which also broke one heck of a lot of software. (The body shop here was down for nearly 2 days when SP2 hit the update site; the people who wrote the software didn't even know what to do about it at the time.)

I just have to wonder at how many other brain-dead errors exist inside the "OS" and what they affect. Coupled with the fact that MS updates windoze even if you tell it not to, it scares the hell outta me.


This is more than a little off-topic though. After you get it up and going, I'd use partimage to take an image of the partitions and dd to back up the MBR/partition table. I'd bet dollars to donuts that it'll work if the same thing happens in the future.

Post Reply