Menu

Mounting .vdi file

2019-11-21
2019-11-24
  • Angus Mackenzie

    Angus Mackenzie - 2019-11-21

    I have created a .vdi file in virtualbox with ntfs as the underlying format. When I open the file on my windows 10 laptop via 'Mount Image file' it shows no partitions and defaults to '1' being shown. This fails if I try to mount it. I have however found that if I use the arrows to increase/decrease the partition number to zero then it mounts perfectly and performs as expected. Is there a registry setting or some other means to set the default partition to zero i.e. 0 rather than 1 ? (is this a bug or a 'feature')

     

    Last edit: Angus Mackenzie 2019-11-21
    • Wizard

      Wizard - 2019-11-24

      Hi Angus. You can use diskpart and in there type "help create vdisk" to see how to create VHDs without having Hyper-V installed. Diskpart is scriptable. To see what is locking your mounted disk you can use Process Hacker or ProcessXP from Sysinternals.

       
      • Angus Mackenzie

        Angus Mackenzie - 2019-11-24

        Wizard, v. helpful suggestions resulting in now being able to close the mounted disk with no warnings :) thank-you.

         
  • v77

    v77 - 2019-11-22

    Strange. I also use .vdi files from VirtualBox and everything works fine.

    As said in the tooltip in the GUI, partition 0 means the entire image, that is, to ignore the partition table.
    The GUI automatically selects the biggest partition found. If there is no partition found, not even a volume that uses the entire image, then the partition number stays as default, that is, 1.
    But if nothing is displayed, it usually means that there is nothing to mount...

    For now, the selected partition number is not registered. That could be an option to add.

    I'd be interested to investigate this .vdi file. How exactly do you created it (with which version of VirtualBox) ? Is it possible to upload it somewhere?

     
  • Angus Mackenzie

    Angus Mackenzie - 2019-11-22

    Thanks for the reply. The current partition is large and not really shareable so I'll make an other smaller one and will be able to share that. Thanks for the info re the use of partition '0'. I'm currently using VBox v6.0.14 with a Debian 10 image running within it and I created the .vdi using VirtualBox when setting up the Debian settinigs/ infrastructure. ImDisk is v2.0.10 running on the host PC which is a Windows 10 (10.0.18362.476) - 1903 version and fully patched.

     

    Last edit: Angus Mackenzie 2019-11-23
  • Angus Mackenzie

    Angus Mackenzie - 2019-11-23

    Attached are 2 files. 1) a screenshot of what it looks like when I load the .vdi into the mount image file software - note that Partition 1 is showing no name 2) a copy of the test .vdi file within a 7zip file.

    The vdi was created within Vbox as a 350MB fixed sized vdi and then formatted as ntfs within gnome-disks. It mounts fine in linux and I added a test file via nano. Linux was then powered down and ImDisk mount image file was then used to attempt to mount it. It would not mount using partition 1 but will mount using partition 0 however I do get an error when I try to release it. ( It doesn't appear to corrupt the .vdi though.)

    any thoughts?

     

    Last edit: Angus Mackenzie 2019-11-23
  • v77

    v77 - 2019-11-23

    Thanks for the image. I just did a quick test, and I confirm what you said, except that I got no error when unmounting.

    So I tried to use DiscUtilsDevio in command line to force the use of the partition 1, and it says:
    "Partition 1 not defined in partition table."

    This means that there is an issue with the partition table. The MBR is either not defined or of a type not recognized by the DiscUtils library.

    And so, by using 0 as partition number, we ask DiscUtils to search for the first volume it can find.
    As the file system is recognized, there should be no issue to use it like you do.

    For now, as a workaround, you could try to attach the .vdi file to a Windows virtual machine, and create the partitions from there.

     
  • Angus Mackenzie

    Angus Mackenzie - 2019-11-24

    tried creating the partitions in both Xp and Win 7 as suggested and it made no difference. Then tried to move the .vdi image between debian, xp and win 7 and found the same thing i.e. most of the time the disk was seen but not the partition details which was the same as seen in imdisk. Time to try different so decided to start with virtual disk types.

    VHD: - tried that in the hope of mounting it directlyon my pc after using it on a debian image but soon found that to do that you appear to need hyperV enabled on the PC. Unfortunatley that clashes with VirtualBox so it was a non starter.

    VMDK. this appears to be the solution for me in that I can create a fat32 partition and it moves, including writes between debian, xp and win7 images by shutting down the image, remove the vmdk then add it to the new image machine. It fires up on each with no issue othe rthan the expected re- mounting etc but fundamentally there is no loss of partition information. Using imdisk toolkit was alsoa success in that it sees partiton 1 and assigns it to the dirive wiere I can read the files with out issue.

    That now gives me a workable solution but not sure why .vdi files are not doing working in the manner expected. :)

    The challenge now is the error when unmounting the mounted vmdk file on the PC (see attachment). Is there any way to find out what is causing the lock ?

     
  • v77

    v77 - 2019-11-24

    Not an error, just a warning. In most cases, this is Explorer that keeps open some things on the volume. If all your files are saved, you can safely ignore this warning.

    By the way, please read this.
    If you use the control panel to dismount a volume, you should run it with administratives privileges (for instance with a new shortcut, or by starting it from an elevated command prompt).
    Not sure it is related to your current issue though.

     
  • Angus Mackenzie

    Angus Mackenzie - 2019-11-24

    Noted above re admin privileges. I've also installed Process Hacker and resulting in finding out what the closing issue was. I can now close the drive letter every time with no warning popups being generated. :)

    Process Hacker was indicating that DiscUtilesDevio.exe had a file handle to the vmdk file which was expected but nothing else. The penny then dropped that ImDisk Virtual Disk Driver (IDVDD) was open on the screen at the time so it must also have some connection to it (cant see it though in process hacker) as there is a clear view of the vmdk file in the open form and it must communicate with it to close it..... doh. Up till now I always had opened IDVDD to use the 'remove' button to unmount the new disk drive from the PC. I also tried right clicking in windows explorer as well at the same time IDVDD was open but it gave the same warning/error.

    The solution to work warning free is to NOT have IDVDD open and ONLY attempt to close the drive letter on the PC using the windows file explorer right click and selecting 'Unmount ImDisk Virtual Disk'. So in short, open IDVDD and click 'remove' or use the internal windows explorer shortcut = get warning. Don't open IDVDD and use the internal windows explorer shortcut = get no warning.

    I supsose that if you know its a warning and just ignore it then fair enough however to a newbie its disconserting to be told that there may be information missing on the disk. I was ofcourse assuming the issue was related to moving the virtual drives about rather than it appearing to be a 'feature' of IDVDD with the image being open in explorer.

     

    Last edit: Angus Mackenzie 2019-11-24

Log in to post a comment.