Jump to content











Photo
- - - - -

Mounting dynamically expanding VHD


  • Please log in to reply
62 replies to this topic

#1 morley

morley
  • Members
  • 7 posts
  •  
    Poland

Posted 22 April 2011 - 01:44 PM

Hi,
Forgive me if I am asking something obvious but I just couldn't find direct answer to my problem.

Question is:

If ImDisk supports mounting dynamically expanding VHD disks?
I found that Devio tool detects such format automatically. But when I try mount dynamic VHD directly in ImTool (for example from control panel) I always get information about not formatted disk.

Regards.

Edited by morley, 22 April 2011 - 01:48 PM.


#2 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 24 April 2011 - 07:42 PM

That is correct, dynamically expanding VHD files are only supported through devio.

#3 morley

morley
  • Members
  • 7 posts
  •  
    Poland

Posted 25 April 2011 - 08:59 AM

Thank you for answer.

Could you tell me if I am doing everything in proper way using devio?
I try to access vhd with devio but I keep getting blue screens everytime when I try connect by Imdisk (client) to Devio (server).
It happens on two independent machines (Win7 x64 and Win x32 - both have UAC enabled).

This is what I do:

1) First I create vhd using win7 disk management tools - tried fixed vhd and dynamic vhd already.

2) Then I use devio to open disk by command:

devio 9999 i:\test.vhd


Devio answers that everything is ok, below I pasted output from console.

Successfully opened 'i:\test.vhd'.
Image size used: 1073742336 bytes.
Detected a master boot record at sector 0.
Using partition 1.
Total size: 1073742336 bytes. Using 1070596096 bytes from offset 65536.
Waiting for connection on port 9999. Press Ctrl+C to cancel.


3) And finally I use Imdisk to connect to devio on port 9999 on localhost - here I always get blue screen:

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


Regards.

#4 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 25 April 2011 - 10:42 AM

Thank you for answer.

Could you tell me if I am doing everything in proper way using devio?
I try to access vhd with devio but I keep getting blue screens everytime when I try connect by Imdisk (client) to Devio (server).
It happens on two independent machines (Win7 x64 and Win x32 - both have UAC enabled).

This is what I do:

1) First I create vhd using win7 disk management tools - tried fixed vhd and dynamic vhd already.

2) Then I use devio to open disk by command:

devio 9999 i:\test.vhd


Devio answers that everything is ok, below I pasted output from console.

Successfully opened 'i:\test.vhd'.
Image size used: 1073742336 bytes.
Detected a master boot record at sector 0.
Using partition 1.
Total size: 1073742336 bytes. Using 1070596096 bytes from offset 65536.
Waiting for connection on port 9999. Press Ctrl+C to cancel.


It looks like this is a fixed size vhd. You would not need devio in between in that case. You should be able to mount it directly with ImDisk.

3) And finally I use Imdisk to connect to devio on port 9999 on localhost - here I always get blue screen:


Sound really strange and seriously broken. Especially if there is no filesystem on it yet that could cause a blue screen. Could you try to mount that vhd directly with ImDisk? Do you get a bluescreen then as well? If you let ImDisk create a completely new image file with a size you specify, does it work then or will that also result in a bluescreen?

#5 morley

morley
  • Members
  • 7 posts
  •  
    Poland

Posted 25 April 2011 - 12:30 PM

It looks like this is a fixed size vhd. You would not need devio in between in that case. You should be able to mount it directly with ImDisk.

Yes, but my aim is to mount dynamic VHD and because they caused BSOD, I started trying with "simpler" flat VHD to find out where the problem lies.

Could you try to mount that vhd directly with ImDisk?

When I mount it directly to ImDisk it works perfectly, I can write to and read from it.
I have never got any blue screens when mounting directly to ImDisk.

Especially if there is no filesystem on it yet that could cause a blue screen.

I am not sure if I understand correctly.
This VHD was created with Disk Management Tool and I also initialized it and formatted to NTFS from there (partition type: MBR), and before attaching it to devio I detached it from system.
So there already was filesystem created on it when attaching to Devio.

If you let ImDisk create a completely new image file with a size you specify, does it work then or will that also result in a bluescreen?

I created IMG file from ImDisk control panel (option: Save Image) based on directly mounted VHD to Imdisk (the same fixed vhd file which casued BSOD in devio previously).
Mounting this IMG directly in ImDisk works ok, but attaching it to devio and connecting by ImDisk caused BSOD again.
But I am not sure is that what you meant.


I also analyzed mini dumps but I don't know if bug reported there is meaningful:

CUSTOMER_CRASH_COUNT:  1



DEFAULT_BUCKET_ID:  VISTA_DRIVER_FAULT



BUGCHECK_STR:  0xC1F5



(...)



SYMBOL_NAME:  CLFS!CClfsContainer::ReadSector+84



FOLLOWUP_NAME:  MachineOwner



MODULE_NAME: CLFS



IMAGE_NAME:  CLFS.SYS


Edited by morley, 25 April 2011 - 12:32 PM.


#6 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 25 April 2011 - 01:15 PM

Yes, but my aim is to mount dynamic VHD and because they caused BSOD, I started trying with "simpler" flat VHD to find out where the problem lies.


When I mount it directly to ImDisk it works perfectly, I can write to and read from it.
I have never got any blue screens when mounting directly to ImDisk.


Okay. In most cases where this has happened, i.e. works directly with ImDisk but blue screen in a filesystem when image file accessed through devio, the actual problem has been incompatible sector size or alignment size emulation. You could try to specify an alignment to devio:


devio 9999 i:\test.vhd 1 512



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


You could also try


devio 9999 i:\test.vhd 1 1



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


and see if that makes any difference.

I am not sure if I understand correctly.
This VHD was created with Disk Management Tool and I also initialized it and formatted to NTFS from there (partition type: MBR), and before attaching it to devio I detached it from system.
So there already was filesystem created on it when attaching to Devio.


Ah, okay, I thought you were only creating the vhd without a filesystem first.

I created IMG file from ImDisk control panel (option: Save Image) based on directly mounted VHD to Imdisk (the same fixed vhd file which casued BSOD in devio previously).
Mounting this IMG directly in ImDisk works ok, but attaching it to devio and connecting by ImDisk caused BSOD again.
But I am not sure is that what you meant.


Yes, this is could be useful to know because it means that the problem is not necessarily with the filesystem data structures on the disk, it could be some kind of incompatible emulation of for example disk geometry or some other problem with the devio communication.


I also analyzed mini dumps but I don't know if bug reported there is meaningful:

CUSTOMER_CRASH_COUNT:  1



DEFAULT_BUCKET_ID:  VISTA_DRIVER_FAULT



BUGCHECK_STR:  0xC1F5



(...)



SYMBOL_NAME:  CLFS!CClfsContainer::ReadSector+84



FOLLOWUP_NAME:  MachineOwner



MODULE_NAME: CLFS



IMAGE_NAME:  CLFS.SYS


Interesting here is that the filesystem driver that crashes is not ntfs.sys, but clfs.sys. That one is "Common Log Filesystem", which I have never before seen a crash report for. Strange.

#7 morley

morley
  • Members
  • 7 posts
  •  
    Poland

Posted 25 April 2011 - 02:14 PM

This still caused BSOD:

devio 9999 i:\test.vhd 1 512

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


However...

That worked !!:

devio 9999 i:\test.vhd 1 1

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


It works for fixed and dynamic vhd :dubbio:.

Thank you Olof very much for helping me with the problem :P.

BTW: Are you going to add support for dynamic vhd directly in ImDisk someday? :cheers:

#8 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 25 April 2011 - 02:23 PM

Thank you Olof very much for helping me with the problem :cheers:.


Glad it worked! :P

BTW: Are you going to add support for dynamic vhd directly in ImDisk someday? :dubbio:


No, I have no plans to add any file format logic into the driver. However, I have plans for simplifying devio mounting, both technically and for user. More specifically, plans are to add devio mounting to some GUI and also add support for high-performance communication between the ImDisk driver and devio.

#9 Sophia

Sophia

    Member

  • Members
  • 85 posts
  •  
    Netherlands

Posted 25 April 2011 - 05:37 PM

...and also add support for high-performance communication between the ImDisk driver and devio.


I am really pleased to hear that. Keep up the good work. :dubbio:

#10 morley

morley
  • Members
  • 7 posts
  •  
    Poland

Posted 27 April 2011 - 08:28 PM

I have one more question regarding dynamic VHDs.

Is there a limit in size for those disks?
Because when I try to use dynamic disk larger than 127 GB I get error in ImDisk: "Error creating Virtual Disk :The parameter is incorrect".
Devio attaches such large disks without any problems, error comes when connecting ImDisk to Devio.

However when I try the same (devio + imdisk) for fixed 150 GB vhd everything works fine.

Regards.

#11 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 28 April 2011 - 06:10 AM

I have one more question regarding dynamic VHDs.

Is there a limit in size for those disks?
Because when I try to use dynamic disk larger than 127 GB I get error in ImDisk: "Error creating Virtual Disk :The parameter is incorrect".
Devio attaches such large disks without any problems, error comes when connecting ImDisk to Devio.

However when I try the same (devio + imdisk) for fixed 150 GB vhd everything works fine.

Regards.


There is not supposed to be a size limit other than the file format specification, that is maximum 2 TB for dynamically expanding VHD files. I rather suspect I might have made some mistake when I introduced the new geometry calculation logic a couple of versions ago, or something similar to that. I will take a look at it.

#12 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 28 April 2011 - 10:35 AM

There was a bug in geometry calculation for VHD images in devio.

New version 1.02 of devio where this is fixed is available now.
Win32 version: http://www.ltr-data.se/files/devio.exe
FreeBSD version: http://www.ltr-data.se/files/devio.bz2

Thanks a lot for finding this bug! ;)

#13 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 22 November 2011 - 05:31 PM

I have no plans to add any file format logic into the driver. However, I have plans for simplifying devio mounting, both technically and for user. More specifically, plans are to add devio mounting to some GUI and also add support for high-performance communication between the ImDisk driver and devio.

Hi Olof,

When we are going to see these plans finally implemented, given a strong tendency to move to native boot VHDs and have a handy mounting tool for them in any Win OS version?

Also, could you explain a bit more about your geometry calculation logic for VHDs? How their geometry is reflected in VHD footer and MBR and bootsector of a Win system volume placed on the VHD? How such geometry miss-alignments or calc errors may affect the VHD native boot on real hardware?

What's different between a system volume geometry identificators when placed on IMG file and same bootable volume geometry marks when placed on VHD?

Is it possible to shrink an IMG file after shrinking a system volume on it, by what tool(s), and how to make sure, geometry alignment won't change, and its system volume remains bootable?

#14 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 22 November 2011 - 06:50 PM

Hi Olof,

When we are going to see these plans finally implemented, given a strong tendency to move to native boot VHDs and have a handy mounting tool for them in any Win OS version?


High-performance shared-memory based communication between ImDisk driver and devio has been implemented and used successfully for some time now. There a library functions and samples available in the source archive as well and some people working on implementing it into their various projects. So, I have done most of my parts here. I had contact with a person who were working on devio-integrated GUI so that was about what I was hoping for there, but I know he is quite busy and I suspect he has not found any time to finish it. But with all API available it should be a reasonably trivial task for someone else to build a better GUI any time.

Also, could you explain a bit more about your geometry calculation logic for VHDs? How their geometry is reflected in VHD footer and MBR and bootsector of a Win system volume placed on the VHD? How such geometry miss-alignments or calc errors may affect the VHD native boot on real hardware?

What's different between a system volume geometry identificators when placed on IMG file and same bootable volume geometry marks when placed on VHD?


Oh, you are asking questions that I am very unsure about myself. I just followed the VHD file format specification to extract the virtual geometry for use with devio/imdisk, too bad without knowing really what I was doing. :merc: :innocent:

Is it possible to shrink an IMG file after shrinking a system volume on it, by what tool(s), and how to make sure, geometry alignment won't change, and its system volume remains bootable?


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.

#15 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 22 November 2011 - 07:11 PM

devio-integrated GUI (in ImDisk) so that was about what I was hoping for there...

Who can do it better and faster then ImDisk developer - if you know him?! :suda:

#16 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 22 November 2011 - 07:21 PM

Who can do it better and faster then ImDisk developer - if you know him?! :suda:


Well, when it comes to GUI development many people are a lot better and I would say that it would not need any particular deep level knowledge about ImDisk features to design a good GUI for it. The API libraries take care of translating all of the complicated stuff down to something that the driver code understands.

My experience and favorite areas are more related to what is actually done in the background. Implementing features, integrating software etc.

#17 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 22 November 2011 - 07:24 PM

OK, can current ImDisk version coupled with Devio mount a dynamic or differencing VHD from Right Mouse Button Menu (shell integration)? If not, when... if Yes, how & what to install? :confused1:

#18 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 22 November 2011 - 07:35 PM

OK, can current ImDisk version coupled with Devio mount a dynamic or differencing VHD from Right Mouse Button Menu (shell integration)?


No.

If not, when...


When someone makes some shell integrated GUI that starts a devio and calls imdisk api to mount it. Should not be that complicated after all. If you don't actually need a GUI but just shell context menu interaction I would think that you could even write a batch script for it.

#19 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 22 November 2011 - 07:42 PM

Can you give a sample of such batch that actually works? :doh7:

#20 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 22 November 2011 - 10:06 PM

Can you give a sample of such batch that actually works? :doh7:



start /min devio "shm:%~nx1" "%1"

ping 127.0.0.1

imdisk -a -t proxy -o shm -f "shm:%~nx1" -m #:


...or something like that. (Not tested.)

#21 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 23 November 2011 - 12:21 AM

It gives "Error creating virtual disk" instead of adding RMC option "Mount VHD with ImDisk" ? Did I get it correctly? Command Line mount (post 7) works well.

#22 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 23 November 2011 - 05:49 AM

It gives "Error creating virtual disk" instead of adding RMC option "Mount VHD with ImDisk" ? Did I get it correctly? Command Line mount (post 7) works well.


This is not a script to add a menu option, this is the script that can be launched from a menu option. You just need to save it somewhere and then add a reference to it in the registry to create a menu option visible that launches it. Look under HKEY_CLASSES_ROOT*shell. Create a subkey called whatever-you-like and then a subkey under there called command and create a default value in that key. The default value should be path and name of your script followed by "%1". For example:

"C:scriptsmount_vhd.cmd" "%1"

...or something. (Not tested.)

#23 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 23 November 2011 - 11:57 AM

What OS version you're talking about? There is no HKEY_CLASSES_ROOT*shell in Win 7 64-bit.

I like "or something" part. :)

#24 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 23 November 2011 - 12:21 PM

What OS version you're talking about? There is no HKEY_CLASSES_ROOT*shell in Win 7 64-bit.


All right. Then, 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.

I like "or something" part. :)


Yes, I have not tested this, I just wanted to give you some ideas where to start.

#25 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 07 December 2011 - 03:08 PM

Kind of strange. I got:


devio 9999 N:VirtualMachinesVirtualPCvpc3.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)



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




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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users