Sunday, June 24, 2012

Diskpart in Windows XP does not show usb drive

In "diskpart" on Windows XP, when you do a "list disk" command it won't show your USB drives. However: It will in Windows Vista or Windows 7. Fun fact: I tried copying diskpart.exe from a Windows7 installation into a Windows XP installation and running it, and got the error message that the file wasn't a valid Win32 application. So don't bother trying that :-)

Sunday, June 17, 2012

Fixing a virtual machine with ntldr is missing error message

Contributed by Nicholas J. Fiorello Jr. 1. Created a snapshot. Might seem kind of silly to snapshot a broken VM, but it prevents anything from making it worse. 2. Configured VM to boot from CD (fixntldr.iso) 3. Booted CD. First choice worked. 4. Discovered that NTLDR, BOOT.INI, and NTDETECT were all missing 5. Changed Administrator Password 6. Shutdown 7. Configured VM to boot from CD (XP iso with SP3) 8. Booted into recovery console. 9. Ran FIXMBR. 10. Ran CHKDSK. 11. Copied NTLDR and NTDETECT from CD 12. Rebooted 13. Created new BOOT.INI 14. Rebooted 15. Removed snapshot

Finding the files on the CD and different startup options

My son called me with the news that the computer would do nothing but display an "NTLDR is missing" message. I tried to give him instructions over the phone, like Robert Stack in "Airplane." Got home, realized the problem is serious. Luckily, I found your site on my Blackberry, followed the instructions and...civilization has returned! Thanks you so much. Couple of suggestions: for Dummies (like yours truly) you could explain how to find the appropriate files for copying from the cd drive to the c drive (I just used the search function, but I was thrown at first when I didn't see the files on the menu). Also, the last instruction, the final instruction, the driving of the golden spike instruction, was different on my machine. I had to go system-advanced-start up and recovery. Just a different set of menus, but again, I was worried that I'd get oh-so-close to the goal and fall short. Anyway, the story ends happily thanks to you, and I'm very grateful!

Fix for Cloning a Win2K partition to a hard drive with a different geometry and getting ntldr is missing

Contributed by Rob Garrett (Rob would like you to consider it speculation until it's had a chance to be test by someone else, and I (Miles) would like you to attempt to backup your data before trying anything if it's super important) Hello Miles! I solved my "NTLDR is missing" problem, and my Windows boots now! Also I solved this problem using a method not explicitly mentioned on your pages: http://tinyempire.com/notes/ntldrismissing.htm http://www.tinyempire.com/shortnotes/files/ntldr_missing.htm Stop me if you've heard this one. My particular "NTLDR is missing" message was being produced by a Win2k partition that had been cloned from a partition on a hard drive with different physical geometry (heads, sectors, etc) . The way I fixed it was by using a hex editor to change a single byte in the boot sector of the cloned partition. That fixed it, and the cloned partition boots now. I was just so damn proud of myself that I thought it'd be fun to tell someone about it, and I thought the owner of the "ntldrismissing.com" domain might be a good choice. So if you are wondering "Who the heck" I am, and if maybe you are wondering if I have written to you before asking you for help fixing my hard drive, or paid you any money, the answer is: "No, I haven't". We have not met before. First let me say thank you for bravely registering the domain "ntldrismissing.com", and also for writing a comprehensive page covering nearly all possible variants of the "NTLDR is missing" problem, plus tools like boot disk and CD images. BTW your boot-CD did allow me to boot into my cloned Win2k partition. However, from there I was unable to figure out how to get my cloned partition to boot on its own. Tried lots of stuff. This is listed below in the section titled: A bunch of stuff I tried that didn't work. Only one thing I tried worked, specifically the editing-the-boot-sector trick, and that's what this story is all about. Anyway, I will naively assume you want to hear this story, and proceed to the gory, gritty details of how I fixed that boot sector, including: which byte got changed, to what value, etc. But first a little background on the cloning operation. I am attempting to copy a Win2k installation from an old laptop hard drive to a new laptop hard drive. The way I image the partition(s) on the laptop hard drive is by booting the laptop with a Linux LiveCD (specifically Feather-Linux, but Knoppix would probably work too), then mounting a Samba share on a remote computer, then using "partimage" on the laptop to do the actual cloning work of reading the hard drive and copying data to an image file on the remote computer. E.g. to mount a Samba share named "bedrock" located on a computer at private network address 192.168.0.5 mkdir /mnt/remote mount -t smbfs -o username=fred,password=ybdbdo! //192.168.0.5/bedrock /mnt/remote Well I say "remote", but the other computer is actually in the same room. In this case "remote" is a figure of speech meaning connected by a network. Did I mention this laptop has a network card, and the LiveCD successfully detects and configures it via DHCP? That part, the getting the network up and running part, is very important! It is necessary for the next step: moving multi-Gb sized image files back and forth. This is done using a utility named "partimage", which is included on the Feather-Linux CD. Note: "partimage" program has a companion server-program named "partimaged", where the "d" is for daemon. It is intended to run on a Linux machine, where the images are stored, and listen for connections from the "partimage" client. Unfortunately, I couldn't figure out to get that stupid thing to work. However I did figure out how to get the Samba daemon running, and the mounting a remote Samba share works just as well. Theoretically that Samba share could be a shared folder on a Windows machine. Although in my case it was running on a Linux machine. I'm kinda running out of space on my Windows desktop PC. Anyway, the setup for "partimage" looks sort of like so: Partition to save/restore /dev/hda1 Image file to create/use /mnt/remote/batman-hda1 And I also click the box that says "Save partition into a new image file". The reverse process of writing a image to a hard drive partition is similar, except I check the box that says "Restore partition from an image file". After restoring the image "batman-hda1" from hda1 from the old laptop hard drive into a new first partition hda1on a new laptop hard drive, this cloned hard drive gave me the infamous "NTLDR is missing" error message. A bunch of stuff I tried that didn't work: Copying new copies of boot.ini, ntldr, ntdetect.com, from a Win2k install CD or from other sources - didn't work. Running fixmbr and fixboot via recovery console via win2k install CD - didn't work. Running a "check" with "fix all errors" on this partition, after booting into it using Miles Comer's "fixntldr4w2k" boot CD - didn't work. Using sysprep.exe - the Microsoft system preparation utility on the drive to be cloned, before cloning it - didn't work. Something that sort of worked: Miles Comer's "fixntldr4w2k" boot CD, made it possible to boot into this Win2k installation. However from there I couldn't figure out how to make the hard drive boot on its own, without relying on the CD. Also note: it had to be the CD. I did not get a chance to try the floppy, as this laptop does not have a floppy drive. I was thinking about giving up, and reinstalling Win2k from scratch, plus all the apps I had on that partition. In fact I even got started on a new Win2k install on this drive. The new first partition was named "silversurfer". Well, I'm not sure if that was actually its name, written on it, when viewed from inside Windows, but for the purposes of the discussion that follows I will call it that. This partition, "silversurfer", the first partition of the new hard drive, had no problems booting Win2k It gave me no "NTLDR is missing" error. In fact this was true even after imaging "silversurfer",and cloning it back. It still booted just fine. But if I cloned "batman" to the same place, it wouldn't boot...except by way of your boot CD. Boot sector editing I really wasn't looking forward to this, but it turned out to be easier than I thought it would be. To make a copy of just the boot sector from a partition, doing this trick under Linux, in my case the Feather-Linux LiveCD, type: dd count=1 if=/dev/hda1 of=/mnt/remote/batman-bs Note for "dd", by default the blocksize is 512 bytes, same as specifying: bs=512. The total number of bytes that gets dumped is count*bs = 1*512 = 512 bytes. I also made a copy of silversurfer's boot sector, and named it "silversurfer-bs". Note my bs suffix stands for "boot sector", not "blocksize", or whatever else bs might stand for. ;-) Number of heads (sides) ? Now somewhere in all the surfing I had been doing, trying to solve this problem I came across that phrase "number of heads (sides)". Also the word "geometry" would come up sometimes too. I think it might have been this article: http://support.microsoft.com/default.aspx?scid=kb;en-us;314057 This article suggested using a program named "sys.exe" from a Win98 startup disk to rewrite the boot partition, using: sys c: The thing I didn't try: I did not get around to trying this. It would have required me acquiring a cd version of a Win98 startup floppy, which probably isn't that hard, but I did not try this. So I don't know if that would have worked or not. The thing that did work : Here are some snapshots of the first 32 bytes of those boot sectors: silversurfer-bs Offset 0 1 2 3 4 5 6 7 8 9 A B C D E F 00000000 EB 58 90 4D 53 44 4F 53 35 2E 30 00 02 08 20 00 ëXMSDOS5.0... . 00000010 02 00 00 00 00 F8 00 00 3F 00 80 00 3F 00 00 00 .....ø..?.€.?... batman-bs Offset 0 1 2 3 4 5 6 7 8 9 A B C D E F 00000000 EB 58 90 4D 53 57 49 4E 34 2E 31 00 02 08 20 00 ëXMSWIN4.1... . 00000010 02 00 00 00 00 F8 00 00 3F 00 FF 00 3F 00 00 00 .....ø..?.ÿ.?... The bytes I am interested in are at offset 18h through 1Bh. According to _Table 32.10 BPB Fields for FAT32 Volumes_ of the _Microsoft Windows 2000 Professional Resource Kit_, here: http://www.microsoft.com/technet/prodtechnol/Windows2000Pro/reskit/part7/proch32.mspx those are the bytes that have something to do with "geometry". The two bytes at 18h and 19h are a word that contains the "sectors per track" geometry value for disks that use INT 13h. The two bytes at 1Ah and 1Bh are a word that contains the "number of heads" geometry value value for disks that use INT 13h. These statements are paraphrased from the Microsoft reference mentioned above, which for some reason used "count of heads" instead of "number of heads". Must be the same thing. Also I'm not sure if the hard drives physically have the number of heads or sides indicated. FFh=255d. 80h=128d What I do know is that this hard drive will boot when it has the "silversurfer" image, but not when it has the "batman" image. So maybe I should try to make the "batman" boot sector look more like the "silversurfer" boot sector, with respect to these geometry parameter thingies? That's a guess. To do this I only need to change one byte. Specifically at offset 1A, I change the FFh to 80h. Now those geometry parameters (offset 18h through 1Bh) look identical to those of the silversurfer boot sector. Then I save this file as "batman2-bs" First 32 bytes of new boot sector: batman2-bs Offset 0 1 2 3 4 5 6 7 8 9 A B C D E F 00000000 EB 58 90 4D 53 57 49 4E 34 2E 31 00 02 08 20 00 ëXMSWIN4.1... . 00000010 02 00 00 00 00 F8 00 00 3F 00 80 00 3F 00 00 00 .....ø..?.€.?... Then I use "dd" to write the new boot sector back to the first hard drive partition. dd count=1 if=/mnt/remote/batman2-bs of=/dev/hda1 Then poweroff. Take out the Linux LiveCD. Power up the laptop, and this time my cloned "batman" Win2k partition boots up just fine. I suspect this hard drives Master Boot Record (MBR) is still the one that got put there when I installed "silversurfer" from scratch, and it still points to the first partition (hda1) or maybe the partition that's marked "active", or something like that. Also I should mention: copying the entire "silversurfer" boot sector onto the cloned "batman" partition - doesn't work. That probably belongs in that list of things I mentioned before... Anyway, that is my story of how I fixed my particular "NTLDR is missing" message, produced by a Win2k partition that had been cloned from a partition on a hard drive with different physical geometry (heads, sectors, etc) . Telling this story to someone was just as much fun as I thought it would be.