Link to home
Start Free TrialLog in
Avatar of Allan Hancock
Allan HancockFlag for United States of America

asked on

How to add an already created vhdx to a Virtual machine

So I have a VM running 2016 Essentials  using a vhdx drive.
In Hyper-V, I created two other vhdx drives.

With the VM 2016 Essentials off, I went to the settings for that VM and added a SCSI controller to add a hard drive. I browsed and chose one of the unused vhdx drives. Clicked apply and ok.

Now when I try to start the VM it comes up with an error:

"An error occurred while attempting to start the selected virtual machine(s).

'name of server' failed to change state
the operation cannot be performed while the object is in use


Avatar of kevinhsieh
kevinhsieh
Flag of United States of America image

How did you create the other VHDX drives? It sounds like you're following the correct steps.
FYI, CHDX can be hot added to a SCSI controller on the VM. No need to power it down. The VHDX can also be hot resized upwards with the VM running and the VHDX accessible to users.
Avatar of Allan Hancock

ASKER

Before I created the 2016 Server Essentials VM, I created three vhdx .
Then I installed the VM using one of the those drives.
So with the VM off, I went to settings for that VM, chose a SCSI Controller and then the add drive.
I browsed for one of those additional drives and selected it. Hit Apply and OK.

Tried to turn on the VM and wham I get the error.

Although I don't think it may matter, I have one other VM running (2016 Essentials as an AD)

Right now I am shutting down the vm's and rebooting the server to see if anything changes.



Well... what do ya know!
after rebooting the entire thing, I no longer get the error.

So now all I need to do is know how to make it show up now that Ive added it.
Do I need to initialize it somehow?
Under drive management it's showing offline because of policy set by administrator

ASKER CERTIFIED SOLUTION
Avatar of kevinhsieh
kevinhsieh
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What about that error?

So after a little research it's a SAN policy thing.
By opening a command prompt (administrators mode)
Then use these commands.

diskpart.exe
san
san policy=OnlineAll
list disk

find the disk # of the one offline then:
select disk 1 (or your drive #)
attributes disk clear readonly
online disk

Now the only choice I need to figure out is to format with GPT or MBR??
I always use GPT for my data disks. You never know when you may need to go beyond 2 TB.
How about allocation size (default, 4k, 64k??)
Depends on the data you will be storing.
an sql database

SQL Express database (less than 10 gig)

SQL express probably does best with 64K.
Ok great!
Thanks Kevin!