-
-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mount and unmount issue #13
Comments
The commands look correct from what I can see. Maybe some other driver or application keeps the virtual disk in use? Are you sure that you are running as administrator (elevated command prompt etc)? |
Yes, scripts is properly elevated. The problem might be in how your driver try to create the device object, because in some cases it does not print the name. So the next allocation looks like |
It uses the next available number automatically. You can run |
The vdi file is not used by anyone, but there is too many objects is allocated. |
Yes, that means that the device was in use when you dismounted them and the driver could therefore not delete the device directly. The driver continues in background to attempt to delete the device at certain intervals. |
And can not delete it while not used? |
The device objects are in use and that is why they cannot be deleted. It can be an application or another kernel component that keeps a handle or reference to the device objects active. As long as there are references to a device object, the device object cannot be deleted. |
I've created a second drive: And create another pair of scripts. The mount script executed the same way and reported: Now the unmount script can not remove the drive, because of a file not found error: The path |
You can check with Process Explorer and see what is holding a reference to ImDisk0, ImDisk1 and so on. The problem is that if it reports that system process is the process that holds a reference you do not actually see which drivers have created the references. The only safe way to know that would be to run under a kernel debugger and check owners of references. I would recommend that you try to disable as many other drivers and filter drivers as possible and see when it makes a difference. In most cases it is filter drivers for antimalware products that cause things like this. |
I've tried Windows 7 x64 on VirtualBox and result almost the same. The difference is it could report some details:
There is no any other drivers that could interfere with the ImDisk except .NET Framework 4.8. |
Thanks for more details! The directory mount point needs to exist before you run the mount command and it needs to be empty. Because it does not exist, the mounted device does not get a mount point and you can therefore not remove it by specifying a mount point. You need to remove it using the device number in that case, such as: Make sure that you first create the directory you want to use as mount point. Also, if you mount a vhd, you need to specify which partition to mount. ImDisk works at disk volume level, it does not emulate full disks with partition tables etc. Also, since it only supports raw format image files, you can only use fixed size vhd files in this way, not dynamically allocated or differencing.
This mounts partition 1 in If you need to mount dynamically allocated vhd images, there are ways to do that using |
Yes, it works.
Another problem: I could not open it in case of vdi drive. It has mounted but is not accessible. Unmount has worked as expected. |
I have never tried vdi image files with ImDisk without using any third-party libraries for parsing the vdi format. If it is a fixed size image, no sparse, dynamic allocation etc it could of course work anyway but you need to be careful to identify whether there are file format headers that need to be skipped over. If you see that the actual disk data begins at a certain offset in the image file, you can use the |
Some interesting links to mount vdi:
|
That is about 15 years old information. Lots of things have happened since. In most cases nowadays I recommend people to use Arsenal Image Mounter instead when mounting forensics image formats and virtual machine image formats in Windows. That will give you a full disk emulation with partition tables and everything. You can mount vdi images like this: You will get a device number in the console output, something like device Hope this helps! |
There is |
Okay. Yes, the command line version of Arsenal Image Mounter is also free and can convert between vdi and many other formats. In any case, ImDisk is somewhat old and outdated when it comes to tasks like this. There are lots of better alternatives nowadays. |
Is there a way to mount single partition vdi to a specific drive letter? |
No, not in this way. This mounts the entire disk. If you are preparing scripts etc where you know partitions in the image, you can assign drive letters or mount points using |
I wrote 2 scripts to mount/unmount:
mount.bat:
unmount.bat:
imdisk -d -m "d:\a\shared-store"
The problem is that it can not mount nor unmount.
Some time ago it has mount/dismount correctly. But after that is something did happen and mounting now is broken.
The
ProcessHacker
shows that the System holds the vdi file:shared-store.vdi
The
mount.bat
reportsaccess denied
on mount. Theunmount.bat
reports that the file is not found. All scripts does execute under Administrator privileges.If try to change the parameter from path
d:\a\shared-store
to drivee:
, then the scripts reports almost the same.If try to run
MountImg.exe
it shows nothing mounted.The same vdi file mounts correctly by the VirtualBox Guest instance. If try to stop the VM instance with the vdi file attached and run scripts again, then the issue happens again.
I read this issue but did't found a solution: #10
There is questions:
The text was updated successfully, but these errors were encountered: