Jump to content











Photo
- - - - -

Force unmount option for imdisk


  • Please log in to reply
3 replies to this topic

#1 slothman

slothman

    Newbie

  • Members
  • 29 posts
  •  
    United States

Posted 02 July 2007 - 10:25 PM

Hello Olof,

I was wondering if you would consider adding a force unmount option to the command line imdisk. The control panel lets you do this if it tries to unmount and is not successful. The problem is the control panel only seems to pop up with the force unmount for certain errors. For drive not ready, it doesn't pop up.

#2 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 02 July 2007 - 11:04 PM

I was wondering if you would consider adding a force unmount option to the command line imdisk. The control panel lets you do this if it tries to unmount and is not successful.

You can download my devioctl tool: http://www.ltr-data....es/devioctl.zip
It will let you dismount any drive forcefully, example:
devioctl forcedismount F:

imdisk -d -m F:
This will be exactly equivalent to selecting force dismount in the Control Panel applet.

The problem is the control panel only seems to pop up with the force unmount for certain errors. For drive not ready, it doesn't pop up.

The only case an ImDisk drive is "not ready" is when it has been deleted and there are still references to it, for example it may be waiting for another driver to release the last reference to the drive. This means that if the drive is "not ready" it is already dismounted so in that case it must be some other problem.

In which case do you see not-ready ImDisk drives? Do you really see them in the Control Panel applet in this case (even if you click Refresh)? Can you give me a hint on how to reproduce this scenario so that I can check what is really happening?

#3 slothman

slothman

    Newbie

  • Members
  • 29 posts
  •  
    United States

Posted 03 July 2007 - 01:05 AM

You can download my devioctl tool: http://www.ltr-data....es/devioctl.zip
It will let you dismount any drive forcefully, example:

devioctl forcedismount F:

imdisk -d -m F:

This will be exactly equivalent to selecting force dismount in the Control Panel applet.


Ahh, I didn't think I could do this with imdisk because I thought imdisk had to do that itself. Otherwise it wouldn't be able to free the drive properly. Apparently I was mistaken.

The only case an ImDisk drive is "not ready" is when it has been deleted and there are still references to it, for example it may be waiting for another driver to release the last reference to the drive. This means that if the drive is "not ready" it is already dismounted so in that case it must be some other problem.

In which case do you see not-ready ImDisk drives? Do you really see them in the Control Panel applet in this case (even if you click Refresh)? Can you give me a hint on how to reproduce this scenario so that I can check what is really happening?


Well the only case I was able to make it happen was when I was using devio to remotely mount a small (10mb) ntfs partition. The connection was thru a virtual machine, and it dropped while I was in the middle of something. Can't remember exactly what I was doing when it happened. And yes I still see it in the control panel.

When I try to forcedismount with devioctl it says incorrect function. I think I see why though. The netstat table shows a CLOSE_WAIT on the connection. So the OS is waiting for imdisksvc to close the connection, but for some reason imdisksvc it is holding it open. I could dump the memory of imdisksvc with windbg if you want.

#4 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 03 July 2007 - 09:29 AM

Ahh, I didn't think I could do this with imdisk because I thought imdisk had to do that itself. Otherwise it wouldn't be able to free the drive properly. Apparently I was mistaken.

I think the confusing thing is the difference between dismounting a filesystem on a drive and deleting the drive itself. Filesystems are dismounted by the filesystem driver (for example NTFS), not the disk driver (in this case imdisk.sys). In order to delete a drive the filesystem must be dismounted first, basically all other kind of references to the drive also need to be freed as well. So "devioctl forcedismount" will dismount the filesystem so that ImDisk later can remove the drive.

Well the only case I was able to make it happen was when I was using devio to remotely mount a small (10mb) ntfs partition. The connection was thru a virtual machine, and it dropped while I was in the middle of something. Can't remember exactly what I was doing when it happened. And yes I still see it in the control panel.

When I try to forcedismount with devioctl it says incorrect function.

Yes that is correct, you cannot dismount the filesystem of a drive that is "not ready" as there by definition is no filesystem mounted on a drive that is "not ready"... That is also the reason why the "force dismount" box does not show in the Control Panel applet, there is no filesystem to dismount on the drive. The reason the drive does not go away but is left in "not-ready" state is that there is something else holding a reference to it somewhere. I don't know what that could be though, the only thing we can know for sure is that it is not the filesystem driver in this case.

I think I see why though. The netstat table shows a CLOSE_WAIT on the connection. So the OS is waiting for imdisksvc to close the connection, but for some reason imdisksvc it is holding it open. I could dump the memory of imdisksvc with windbg if you want.

Thanks a lot for trying to help but I don't think this would help because of the communication technique behind this. The connections are initialized and kept up by the service but the communication itself is done directly by the driver. If any communication is hung somewhere it must be in the driver code.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users