Jump to content











Photo
- - - - -

Mounting dynamically expanding VHD


  • Please log in to reply
62 replies to this topic

#26 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 07 December 2011 - 06:21 PM

Kind of strange. I got:


devio 9999 N:\VirtualMachines\VirtualPC\vpc3.vhd 1 1

detected VHD...waiting...

imdisk -a -t proxy -o ip -f 127.0.0.1:9999 -m L: -S 512



Got connection from 127.0.0.1:50906 (instead of :9999 - reported by devio)


That is expected, to and from normally have different numbers. The incoming call comes from port 50906 to port 9999. Nothing wrong there. It also shows that devio actually receives connection request so there is most probably not a firewall problem or in any other way related to tcp/ip. But just to be sure you could always try shared memory communication instead.


devio shm:vpc3 N:\VirtualMachines\VirtualPC\vpc3.vhd 1 1

detected VHD...waiting...

imdisk -a -t proxy -o shm -f vpc3 -m L: -S 512


...but I don't think there will be any difference.


Error creating virtual disk: The handle is invalid. (reported by ImDisk)




What can cause the problem? Firewall is OFF, latest versions, letter L: available...


Sounds strange. I just tested similar here and it works. Does it work with other vhd files?

#27 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 08 December 2011 - 12:22 PM

I rebooted the system, and... tried a different and this time a fixed VHD located on a different drive:

Got connection from 127.0.0.1:52760.

>imdisk -a -t proxy -o ip -f 127.0.0.1:9999 -m L: -S 512

The ImDisk Virtual Disk Driver was loaded into the kernel.

The ImDisk Virtual Disk Driver Helper Service was started.

Creating device...

Error creating virtual disk: The handle is invalid.

Then tried to mount a dynamic locked VHD:

Got connection from 127.0.0.1:52760.

>imdisk -a -t proxy -o ip -f 127.0.0.1:9999 -m L: -S 512

Creating device...

Error creating virtual disk: The handle is invalid.

Then tried to mount a Differencing VHD:

Creating device...

The remote computer refused the network connection.

So, the error seems to depend on the VHD type, but...no cigar... Note, ImDisk on its own is able to mount and read the above fixed VHD. The above "shm" trick doesn't work at all:

Posted Image

#28 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 08 December 2011 - 12:42 PM

Have you tried shared memory communication I suggested?

#29 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 08 December 2011 - 12:59 PM

See above. How about asking the author of the right syntax? :)

#30 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 08 December 2011 - 01:12 PM

See above. How about asking the author of the right syntax? :)


Okay, so you are running an old version then. Please upgrade both ImDisk and devio to latest versions and try again.
http://www.ltr-data..../imdiskinst.exe
http://www.ltr-data.se/files/devio.exe

#31 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 09 December 2011 - 05:19 PM

Yes I was. :) I updated both, and now get this:

Got connection from 127.0.0.1:52295

....................

Error creating virtual disk:

The request could not be performed because of an I/O device error.




This is happening in Win7 64-bit, while I reported earlier having a dynamic VHD mounted the same way OK (possibly using previous devio and ImDisk versions). Tried other dynamic VHDs, including an empty one - the same thing. Do you test this combo in Win7 64-bit - expected to... ImDisk mounts and reads a fixed VHD with the same OS on it normally.

The shm method mounts the VHD, but unreadable, and then locks Win Explorer requiring OS reboot.

Just checked using a previous devio version of Jan. 2011 that worked before - current ImDisk still gives the same error. :argue:

#32 sfinktah

sfinktah

    Frequent Member

  • Advanced user
  • 217 posts
  • Location:Der Äther
  • Interests:/(C(++|#)|P(HP|XE)|(OS|Linu)X|8051)/
  •  
    Australia

Posted 12 December 2011 - 05:49 AM

Same here, I am not the right person to answer a question like that but I suspect that a person with some more geometry/mbr/etc knowledge should be able to write such a tool reasonably easy. You just have to know what to avoid and what to make sure, but once you know that I don't thinks it would be too complicated


Damn, I was rather hoping to steal your working and tested geometry code to finish off my VHD resizer.

For whom-ever asked, there is no disk geometry stored in a VHD file apart from the CHS specification that all physical hard drives maintain, and a total byte count. Unlike the MBR, the VHD version is simply 2 bytes for the cylinder count, and 1 byte each for the heads and sectors.


C:UsersAdministratorDocumentsVisual Studio 2010ProjectsVHD DirectorVHD DirectorDiscUtilsBin>VHDDump.exe z:VhdDirectorTest.vhd
VHDDump v0.9.0, available from http://discutils.codeplex.com
Copyright © Kenneth Bell, 2008-2010
Free software issued under the MIT License, see LICENSE.TXT for details.

File Info
---------
File Name: Z:VHDsVhdDirectorTest.vhd
File Size: 29371392 bytes
File Creation Time: 12/4/2011 1:07:16 PM (UTC)
File Write Time: 12/4/2011 1:28:27 PM (UTC)

Common Disk Info
-----------------
Cookie: conectix
Features: 00000002
File Format Version: 1.0
Creation Time: 12/4/2011 1:07:17 PM (UTC)
Creator App: win
Creator Version: 6.1
Creator Host OS: Wi2k
Original Size: 1073741824 bytes
Current Size: 1073741824 bytes
Geometry (C/H/S): (2080/16/63)
Disk Type: Dynamic
Checksum: ffffefcd
Unique Id: c01a13a6-926d-6947-b391-91aefc67cb5b
Saved State: 0


Dynamic Disk Info
-----------------
Cookie: cxsparse
Header Version: 1.0
Block Count: 512
Block Size: 2097152 bytes
Checksum: fffff475
Parent Unique Id: 00000000-0000-0000-0000-000000000000
Parent Write Time: 1/1/2000 12:00:00 AM (UTC)
Parent Name:
Parent Locations:

C:UsersAdministratorDocumentsVisual Studio 2010ProjectsVHD DirectorVHD DirectorDiscUtilsBin>


#33 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 12 December 2011 - 07:06 AM

For whom-ever asked, there is no disk geometry stored in a VHD file apart from the CHS specification that all physical hard drives maintain, and a total byte count. Unlike the MBR, the VHD version is simply 2 bytes for the cylinder count, and 1 byte each for the heads and sectors.


A dynamically resizing VHD file has a virtual disk geometry stored in four bytes in the VHD footer.
http://www.microsoft...s.aspx?id=23850 (page 5-6)
But that could of course be what you mean with "apart from the CHS specification that all physical hard drives maintain".

#34 sfinktah

sfinktah

    Frequent Member

  • Advanced user
  • 217 posts
  • Location:Der Äther
  • Interests:/(C(++|#)|P(HP|XE)|(OS|Linu)X|8051)/
  •  
    Australia

Posted 12 December 2011 - 12:36 PM

Yup, I probably should have said "The only geometry is the CHS..." I think what I might have been trying to imply, was that there's no information you have to actually have to take any notice of. :)

#35 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 12 December 2011 - 01:07 PM

Hi Olof,

I was able to mount a dynamic VHD with Devio and ImDisk in newly tested WES7 64-bit. Guess, Win 7 has some issues, not sure about the cause. Btw, ImDisk seems to have no uninstaller, so may be a newer version doesn't override older registry settings if any? How to uninstall it properly? Or, what to troubleshoot in Win7 64-bit to make Devio - ImDisk work in-pair? :dubbio:

Another issue is, when a disk is mounted in Windows by regular means, the check is performed that there is no Disk Signature collision, and if there is, the later disk remains Offline to prevent its Sig change by Windows that will block OS boot from it next time. Does ImDisk perform similar check, and block disk mount in case of such collision? If not, would it make sense to add such feature, which is quite important for unsuspecting users... :confused1:

#36 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 12 December 2011 - 02:27 PM

Hi Olof,

I was able to mount a dynamic VHD with Devio and ImDisk in newly tested WES7 64-bit. Guess, Win 7 has some issues, not sure about the cause. Btw, ImDisk seems to have no uninstaller, so may be a newer version doesn't override older registry settings if any? How to uninstall it properly?


You should not need to uninstall first if you are upgrading to a newer version. There are no registry settings or similar that need to be changed so the most important thing is that driver/service/control application files get updated. This works as long as you remove any virtual devices before upgrading. If you want to uninstall you just use the uninstaller in Control Panel - Add/Remove Programs/Application Settings etc (depending on Windows version).

Or, what to troubleshoot in Win7 64-bit to make Devio - ImDisk work in-pair? :dubbio:


Sorry, I cannot say. It seems you have hit a really strange problem here but it could be an easy thing to fix once we find out what it is.

Another issue is, when a disk is mounted in Windows by regular means, the check is performed that there is no Disk Signature collision, and if there is, the later disk remains Offline to prevent its Sig change by Windows that will block OS boot from it next time. Does ImDisk perform similar check, and block disk mount in case of such collision? If not, would it make sense to add such feature, which is quite important for unsuspecting users... :confused1:


ImDisk does not provide any similar checks and I doubt it could be done in any reasonable way in a driver like ImDisk. It looks at volumes, not disks, so it is somewhat beyond the scope of it to perform tasks (important or not) that belong to disk management.

#37 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 12 December 2011 - 02:36 PM

This might be that final argument for a rework to make ImDisk comply with MS rules of engagement, so that mounted with ImDisk drives would appear in Disk Management Console. :) Especially given the fact, how many people just love to run their OS in and out of VMs, and generally off all kind of virtual disks, and in need to mount them offline for some Registry and other edits.

#38 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 12 December 2011 - 02:44 PM

This might be that final argument for a rework to make ImDisk comply with MS rules of engagement, so that mounted with ImDisk drives would appear in Disk Management Console. :) Especially given the fact, how many people just love to run their OS in and out of VMs, and generally off all kind of virtual disks, and in need to mount them offline for some Registry and other edits.


Like I have said before, that means a completely different driver. It is probably not worth it to try to rewrite the current ImDisk source to that design. So, lets keep ImDisk the small plain simple volume driver it is today and let anyone who wants a Mount Manager compatible driver write such a one.

#39 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 12 December 2011 - 03:13 PM

It looks like MS wants to do just that in Win8, but only for ISO & VHD. :) They will be mounted in Win Explorer from RMC.

#40 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 12 December 2011 - 03:17 PM

It looks like MS wants to do just that in Win8, but only for ISO & VHD. :)


Microsoft has provided free "vhdmount" for VHD mounting (for example as part of Virtual Server 2005) and a virtual CD driver for a long time. So there is probably nothing surprising about that.

#41 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 12 December 2011 - 05:34 PM

Virtual CloneDrive and some other packages seems to show up in Disk Management Console and are controllable from there. I wonder if such package exists with the range of image types similar to supported by ImDisk?

#42 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 15 January 2012 - 02:32 PM

See what default value HKEY_CLASSES_ROOT.vhd points to. It could for example be Virtual.Machine.HD. Then, find HKEY_CLASSES_ROOTVirtual.Machine.HDshell and continue from there instead (adding shell commands).

Thanks Olof,

And how (where) to add Detach VHD Disk command to a Disk Context Menu (not file), that can be open once the VHD is attached as disk? :) Ideally, it should only be seen in RMC, when pointing mouse to the attached VHD Disk, but not visible when pointing to a regular disk.

#43 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 15 January 2012 - 02:36 PM

Thanks Olof,

And how (where) to add Detach VHD Disk command to a Disk Context Menu (not file), that can be open once the VHD is attached as disk? :) Ideally, it should only be seen in RMC, when pointing mouse to the attached VHD Disk.


Just use the "Unmount ImDisk Virtual Disk" menu option to detach any ImDisk virtual disk, even of this kind.

#44 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 15 January 2012 - 02:39 PM

OK, but could you give some insight, how to add such a command, which is helpful when using a specific VHD tool or batch instead of ImDisk? Just want to tap into your knowledge base a little... :)

#45 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 15 January 2012 - 02:42 PM

OK, but could you give some insight, how to add such a command, which is helpful when using a specific VHD tool or batch instead of ImDisk? Just want to tap into your knowledge base a little... :)


Look under registry key HKEY_CLASSES_ROOTDriveshell on a machine where ImDisk is installed. There are some ImDisk related subkeys there. You can create similar keys with related command definitions for whatever you would like to appear on context menus for disk drives.

#46 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 15 January 2012 - 03:02 PM

Thanks Olof,

I checked it and get the idea. The next step is to be able to see such option in Disk Context Menu only when pointing to a mounted VHD disk, and don't have it listed or selectable, when pointing to a regular drive. Any idea? Btw I wanted to suggest this improvement for some time for ImDisk mounted disks too. :dubbio:

Another improvement for ImDisk along these lines would be to identify if a selected Virtual Disk was in fact mounted by ImDisk, and show "Unmount" option only in this case. Otherwise I often click on it only to get the error "This is not ImDisk mounted drive". If generating this error is possible, then checking or marking it upfront, and making the Unmount option (un)available when a user opens a Disk Context Menu on a selected drive should also be possible.

#47 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 15 January 2012 - 04:35 PM

Thanks Olof,

I checked it and get the idea. The next step is to be able to see such option in Disk Context Menu only when pointing to a mounted VHD disk, and don't have it listed or selectable, when pointing to a regular drive. Any idea? Btw I wanted to suggest this improvement for some time for ImDisk mounted disks too. :dubbio:


As far as I know it is not possible to do that with just scripts and registry settings. You need to write a Shell Extension and register it to extend the disk context menu and handle events to check for drive type.

Another improvement for ImDisk along these lines would be to identify if a selected Virtual Disk was in fact mounted by ImDisk, and show "Unmount" option only in this case. Otherwise I often click on it only to get the error "This is not ImDisk mounted drive". If generating this error is possible, then checking or marking it upfront, and making the Unmount option (un)available when a user opens a Disk Context Menu on a selected drive should also be possible.


Explorer.exe does not call anything before user clicks the menu item. So when the command defined in the registry setting is called, ImDisk can check whether or not it is an ImDisk drive but at that time the user has already clicked the menu item.

To solve this we would need a Shell Extension and register that with Explorer.exe so that it keeps a DLL loaded in explorer.exe process. That is a quite different approach.

#48 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 15 January 2012 - 06:26 PM

OK, it seems to be a long shot. :) Returning to the 1st task, I added

cmd /c start /min %SystemRoot%system32vhd_mnt.cmd "%1"

to HKEY_CLASSES_ROOTDriveshell. What parameter should I use instead of %1 to indicate that the mounted VHD disk was selected instead of its file? Or, how to process a selected by mouse disk in a batch?

#49 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 15 January 2012 - 06:54 PM

OK, it seems to be a long shot. :) Returning to the 1st task, I added

cmd /c start /min %SystemRoot%\system32\vhd_mnt.cmd "%1"

to HKEY_CLASSES_ROOT\Drive\shell. What parameter should I use instead of %1 to indicate that the mounted VHD disk was selected instead of its file? Or, how to process a selected by mouse disk in a batch?

Have you checked contents of:
HKEY_CLASSES_ROOT\Drive
(on a machine with IMDISK installed) ? :dubbio:
In mine there is:
HKEY_CLASSES_ROOT\Drive\shell\ImDiskUnmount\command
with default:

rundll32.exe imdisk.cpl,RunDLL_RemoveDevice %L


What could %L mean? ;)

:cheers:
Wonko

#50 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 15 January 2012 - 07:00 PM

Now we're batching with Wonko DrBatcher® - will try that. :) Btw, what was the last batch you wrote - when was it? :victory:

I'm almost done with tasks set for VHD_MNT, but will test it for a few days. :rolleyes:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users