The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,365 other followers

Proxmox – recovering a Windows 7 machine having “Missing operating system”

Posted by jpluimers on 2018/01/12

This is not what you like when you reboot a VM in Proxmox:

Booting from Hard disk...
Missing operating system

Booting from Hard disk... Missing operating system

Booting from Hard disk… Missing operating system

This case was a Windows 7 UK Professional x64 SP1 virtual machine.

Luckily the ISO is at https://archive.org/download/en_windows_7_professional_with_sp1_x64_dvd_u_676939_201606/en_windows_7_professional_with_sp1_x64_dvd_u_676939.iso via https://archive.org/details/en_windows_7_professional_with_sp1_x64_dvd_u_676939_201606 (later I found out I had the image in my backup vault as well).

I put that one in /var/lib/vz/template/iso so proxmox will automagically provide it in the local storage of iso images.

Now for some screenshots some based on what I learned at [Archive.isHow to use System Recovery Options for repairing Windows Vista or 7 installations:

  1. Mount the Windows 7 ISO image and ensure your disk is sata  as well (as only Windows 10 and higher will understand virtio disks):

  1. Boot from the DVD into repair mode:

Boot and press any key to get into the GUI.

Press “Next” after optionally selecting your locale.

Press “Repair your computer”

Now start the recovery process:

Select “Use recovery tools”… then press “Next”

Choose “Command prompt”

Type “diskpart” followed by the “list volume” command to see which volumes have what state. In our case all non CD-ROM partitions became RAW (but should be NTFS)

With that list, find out which drive letters have corrupt NTFS partitions and try to recover them with chkdsk.

diskpart
list volume
exit

chkdsk D: /F /X
chkdsk C: /F /X

The last statement will likely fail, but it doesn’t hurt to try.

“The first NTFS boot sector is unreadable or corrupt” will be somewhere near the top of the chkdsk log, but it will scroll up soon and the the scrollback buffer is too small, then chkdsk reports it has fixed items.

With more you can get the first part (but makes you press space to continue a zillion times)

The 100 megabyte drive should not get a drive letter.

The large partition should get a drive letter and become active.

Then exit diskpart, exit the command prompt and press the Shutdown button. Wait for the VM to actually shutdown, mount another SATA drive with a good 100 megabyte System Reserved Partition in a raw file and mount a CD with Parted Magic or GParted.

(you can copy/move the raw image using ssh, not from the web UI)

Boot and start GParted, then copy the good 100 megabyte partition over the bad one:

Boot Parted Magic or another ISO having GParted installed. The 32-bit RAM version suffices for our copy action.

Select the good disk on the right and the goot System Reserved partition on the bottom, then press the “Copy” button.

Select the “bad” drive on the right and the bad 100 megabyte on the bottom, then press the “Paste” button so the “System Reserved” partition will be copied over the bad one.

Confirm scheduling the copy action by pressing  “OK”.

Press the “Apply” button to perform the actual partition copy action.

Confirm you really want to copy by pressing a different “Apply” button.

Wait (a very short time) for the operation to finish, then verify it was correctly done.

Observe the partition has actually been copied.

Logoff, shutdown, then wait for VM to actually shut down.

  • – remove second SATA disk
  • – remove CD/DVD

If you originally moved the secondary SATA disk here, then move it back using ssh before removing it below!

Finally remove the unused disk.

Boot to the Windows 7 DVD again and continue repairing the now restored System Reserved partition.

Press “Next”

Press “Repair your computer”

Choose “Use recovery tools”…

Choose “Startup Repair”

The Startup Repair will automagically recognise a Windows partition that it thinks is empty, then tries to repair to make it look non-empty again.

Boot one more time from the Windows DVD to do the final repairs.

https://www.dropbox.com/s/s7nayovja1lvtev/Screenshot%202016-12-15%2012.31.15.png?dl=0

Press “Next”

Press “Repair your coputer”

Chose “Use recovery tools” and observe we’re making progress: the partition has size. But a wrong drive letter.

Windows now has assigned drive letters that are wrong, so we need to change them again.

First check what’s changed with diskpart followed by list volume:

diskpart
list volume
select volume 1
remove letter=C
select volume 2
assign letter=C
active
list volume 

(the last active will make volume 2 active)

bcdboot C:\Windows
bootrec /fixmbr
bootrec /fixboot
bootrec /rebuildbcd
bootrec /scanos

This is one of the scenarios that “Startup Repair” fixes for us. It helps to know these commands so you can do it manually.

for MBR, this extra step is needed:

bcdboot C:\Windows /S C:

After exiting the command prompt, press “Shut down”.

Now optionally change the disk type to virtio, then mandatory verify the boot order and remove the CD

If you want to convert to virtio, then remove the sata0 disk so it becomes unused.

Ensure the boot order is correct.

And has the right disk servicing type.

Now the boot order is correct.

We have Windows!

Sometimes Windows will magically assign a drive letter to the 100 megabyte System Reserved Partition. If that happens, use diskpart to remove that drive letter again.

Here is when the disks suddenly were corrupted from NTFS to RAW:


–jeroen

[WayBackHow to transfer large ISO to ProxMox? | Proxmox Support Forum

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

 
%d bloggers like this: