8

I installed Linux Mint on a physical SSD, and ran like that for several years.

Now, for work, I need to run Windows 10 Pro on my desktop. To do that, I used a separate physical SSD, but left the old Linux SSD connected to the SATA inside the PC.

I would like to boot to the Linux Mint OS, using Hyper-V. I have set the disk to 'offline' in Windows Local Disk Manager, and attached the Physical Disk to the Virtual Machine in Hyper-V.

Attached Virtual HDD in Hyper-V

No VHD's are attached to the VM. When I Start the VM, I Hyper-V says "Start Successful" and it's now "Running".

But, the only thing I see in the Console is a flashing cursor in the top-left corner. I can hit and get it to advance, but no input/output is apparent.

One other (possible) complication: The disk is partitioned in a bit of a funky way. I can't recall at the moment the purpose for each partition, but it's in 5 different partitions -- including a Linux \Boot, \Root, \Swap, and \Home.

enter image description here

Oh, and it's EFI.

Any ideas?

Biswapriyo
  • 10,831
  • 10
  • 47
  • 78
Jon Wadsworth
  • 131
  • 1
  • 1
  • 7
  • With UEFI, dual booting is quite easy and no special settings are required even when installing Windows after Linux. You don't need a VM. –  Jan 10 '18 at 14:46
  • Thanks for answering Michael, but I don't want dual-boot. I want to run both OS's at the same time. – Jon Wadsworth Jan 10 '18 at 14:52
  • 1
    OK, not easy to transform an existing installation into a VM but it's possible. Please wait for answers, I have no experience with the virtualization you intend to use. –  Jan 10 '18 at 14:58
  • 2
    Is the virtual disk controller of the same type as when it was running on the physical machine? Same question for virtual BIOS settings regarding EFI/Legacy and disk settings such as AHCI. If nothing works, you might consider converting the disk to VHD. – harrymc Jan 12 '18 at 20:02
  • Thanks @harrymc -- this is the closest thing I've seen so far. I'm trying to dig into settings, but there doesn't seem to be much configuration available for Hyper-V's 'BIOS'. Just selecting which boot device; which I'm setting as "IDE". Seems like there should be more configurability to that BIOS... – Jon Wadsworth Jan 12 '18 at 21:51
  • 2
    Hyper-V has by intention limited access to the BIOS to what is available via Settings, and this is different for Generation 1 or 2 VMs. Generation 2 don't really have BIOS but an emulated firmware with more control than Generation 1. Most of the settings can only be accessed from the host via PowerShell. See [this article](http://techgenix.com/virtual-machine-bios/) for details. – harrymc Jan 12 '18 at 22:27
  • Have you checked if the settings via PowerShell match the old hardware? Which generation is your VM? – harrymc Jan 14 '18 at 09:52
  • Settings seem to be the same. I have tried with Gen1 and Gen2 -- Gen2 seems to be a bit more verbose at boot time, but still not actually booting. – Jon Wadsworth Jan 14 '18 at 23:40
  • 2
    How much startup RAM does the VM have? What about disabling Secure Boot? Note: To make a grub problem visible, modify `/boot/grub/grub.conf, /etc/default/grub` or equivalent to have `timeout=100000` instead of the default `timeout=5`. For panic to work, change also `crashkernel=384M-:128M` to `crashkernel=384M-:256M`. Install the packages listed under Notes [from here](https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/supported-ubuntu-virtual-machines-on-hyper-v). Try also to boot from ISO, but note only 64-bit ISOs support UEFI. Gen1 might be safer but disk must be IDE. – harrymc Jan 15 '18 at 08:12
  • Has anyone else here actually successfully taken an OS installed onto a physical machine, mapped that drive to a VM, and booted the OS in a Hypervisor? I have never seen this happen, and in past research understood this is essentially impossible with standard components and systems, and so I disagree with the primary claim of Mr Wadsworth that "it SHOULD work!" – music2myear Jan 18 '18 at 18:08
  • Hi @harrymc -- Thanks for your suggestions. I have assigned the VM 4GB RAM in Hyper-V. Have tried Secure Boot off & on both. I will try the suggestions in grub. Unfortunately I am not well versed in Grub, but I can certainly follow the instructions you sent. I'll report back once I've tried it. – Jon Wadsworth Jan 22 '18 at 18:52
  • Hey @music2myear -- I would be happy to rescind my claim that it SHOULD work -- if I were to receive an explanation of why it won't work; or some kind of proof. I realize that it's hard to 'prove a negative' -- but I can tell you why you can't install Linux on a Pumpkin -- there's no room for the boot sector :) I am admittedly weak on exactly how the boot process executes; but if someone with more knowledge that myself could explain or show how/why it doesn't work; that'd be really cool :) Thanks for the reply! – Jon Wadsworth Jan 22 '18 at 18:56
  • Well @harrymc -- maybe we're closer. I installed Mint 18.3 on a new .vhd, using Hyper-v Gen2. I then connected the phys disk to the VM, and Linux detected it as /dev/sdb. I set the timeout as you suggested in /etc/default/grub, then a ran update-grub. It found the old Mint 18.1 on /dev/sdb7! So, I rebooted and selected 18.1 in Grub -- but got 3 errors: No such device: d24b...{GUID} || hd1 cannot get C/H/S values. || You need to load the kernel first. Press any key to continue. So, I definitely feel like we made progress, but not booting still. Any other ideas? Thanks for your input!! – Jon Wadsworth Jan 22 '18 at 19:16
  • More advice: Install grub2 rather than grub. It's possible that the problem is with the BIOS, but as Hyper-V BIOS is not very configurable your options are limited. Why not stay with the VHD if it works? – harrymc Jan 22 '18 at 20:19
  • Thanks, I'll look into installing grub2. Why not stay with VHD? At this point, it's more about finding out if what I think *should* be possible, actually *is* possible. I would also be cool with having grub/boot volume reside on the VHD, but /root, /home, etc on the physical. I'm not sure if what I'm describing is 'cheating' on my initial request -- but that's where I'm at for now :) – Jon Wadsworth Jan 22 '18 at 21:34
  • ooooKAY! Now I'm getting somewhere! In another forum (https://forums.linuxmint.com/viewtopic.php?t=251235) I found a reference to a supergrub boot .iso. Booting to the SuperGrub iso, I am able to select my boot volume on the physical disk, and it boots. SUCCESS(*)! Thanks @harrymc for sticking with me! (*)Caveat -- Admittedly, this is not 100% ONLY the Physical disk; it does involve an .iso to do the initial part of the boot. I'm still convinced that it's possible without the .iso - but I don't see myself digging deeper to actually make it work. – Jon Wadsworth Jan 22 '18 at 22:08
  • 1
    I would suggest writing an answer to describe the solution, so others could benefit from your experience. – harrymc Jan 23 '18 at 07:30

4 Answers4

1

I agree with Jon Wadsworth. first I followed his method and failed . The problem is that I can not ust superGrub.iso to boot the physical disk as it can not find the devices attched to hyper-v virtual machine.

Involuntarily I found that I can use a windows installation disk(like cn_windows_10_business_edition_version_1803_updated_sep_2018_x64_dvd_07b164ed.iso) to find and boot the disk.

1 yuo should detach the physical disk from windows disk management.

2 you should ONLy attach the windows installation disk image (.iso) to the hyper-v machine. then start it(if you have both iso file and physical disk attached, there will be an err). err of attaching two disk start vm and you will find "Press any key to boot from CD or DVD." press any key FAST.

3 attach the physical disk.

4 go back to the virtual machine, now you will see the windows installation screen,press"next","repair the your computer",then you will find the boot menu including your boot options of your windows system in the physical disk attached to the virtual machine.

most time ,you should follow the steps above every time you start the virtual machne. while only one time I upgrade the system from 1809 to 1903, it reboot successfully with no err. and after that , it failed giving the err in step 2. So the 4 steps are the stable ways to boot a system.

A_A
  • 11
  • 2
1

Just wanted to point out that without any external ISOs, Windows build 2004 will boot for me when attached to a hyper-V session on a host Windows build 2004 system.

  1. disk manager -> detach (puts my secondary (non boot) volume nvme ssd offline, the one I plan to try to boot in hyperv)

  2. create vm. skip the disk creation.

  3. open vm settings. select physical disk instead of vhd.

  4. WAIT for 90 seconds ore more on first boot for it to give up on the PXE boot.

  5. Let it boot. Log in. Something happens, and it restarts immediately after login.

  6. After second boot up, and second login, system appears stable.

No other actions necessary. Easiest P2V (physical to virtual) spin up ever.

Warren P
  • 2,931
  • 8
  • 37
  • 53
  • I feel like this should work. Unfortunately, I can't find the option to detach the disk. The option just isn't there in disk manager. Tried inactivating but that wasn't the same thing. – Per Johansson Dec 23 '20 at 22:07
  • Alright, I managed to put my disk offline using diskpart (in an Administrative shell, not sure if that matters). First `select disk=1` (you number might be different, see `list disk`), then `offline disk`. Quite easy, still not sure why I couldn't do it in the GUI. – Per Johansson Dec 24 '20 at 21:30
0

I was able to boot without the use of a VHD.

The key for me was to use the SuperGrub boot .iso --- Specifically, this version of it

I attached the SuperGrubDisk iso as a DVD drive, and booted to that. From there, I am able to select my boot volume on the physical disk, and it boots. SUCCESS!

Thanks @harrymc for all of your help with this!

For posterity, I am using a Gen2 VM on Hyper-V on Win10 Pro.

PS: Admittedly, this is not 100% ONLY using the Physical disk; it does involve the .iso to do the initial part of the boot. I believe that it would be possible do this without the .iso (perhaps re-writing the boot volume on the Physical Disk? But I'm happy as it is now, and can't spend any more time on this :)

Jon Wadsworth
  • 131
  • 1
  • 1
  • 7
  • In order to pass-thru a disk, it needs to be turned of "offline", which is unfortunate if you're trying to hyper-v boot a dual-boot os from a single disk. – kfsone Oct 07 '18 at 20:50
0
  • I had an X.img file.
  • I converted it to vhd format with vboxmanage convertfromraw command.
  • I created Hyper-V VM - Gen 1 - I think this is the key point.
  • I atteched X.vhd and it runs as expected.

Before this method I got "in the Console is a flashing cursor in the top-left corner." too.