Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

Forcing physical disk (not just volume) remount

Bob_KroeterBob_Kroeter Member Posts: 65
This seems to go a little beyond the file system so I thought I would try here. I am formatting a mounted disk to be blank, wiping out the MBR, GPT, everything. The following sequence doesn't work right:

FSCTL_LOCK_VOLUME
.......reformat......
FSCTL_DISMOUNT_VOLUME
FSCTL_UNLOCK_VOLUME

After the above procedure, NTFS does take some notice, but unfortunately the drive letter remains and accessing it gets an obscure message about the disk being corrupt. Disk management doesn't notice anything changed unless manually pressing the refresh button. What I want is the functionality of the refresh button in disk management. That gets everything to notice the new contents from the ground up and then the old drive letter disappears. Is there a way to do this? Either kernel mode or user mode is ok.

Comments

  • Alex_CarpAlex_Carp Member Posts: 1,016
    I'm a bit confused about the terms you're using. However, I think you can
    trigger the equivalent of a refresh programmatically by sending the
    IOCTL_DISK_UPDATE_PROPERTIES request to the disk (not the volume).

    Hope it helps.

    Thanks,
    Alex.
  • Bob_KroeterBob_Kroeter Member Posts: 65
    That ioctl does help. Unfortunately it must be sent to a volume, not the physical disk. What I mean by that is the ioctl works if sent to a device opened with a name in the form \\.\n:. It does not work if sent to a device opened with the name returned from the setup api's for GUID_DEVINTERFACE_DISK. This means it only works for devices with a drive letter assigned. It would be even better if there was a way to update physical disks without drive letters assigned.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
Developing Minifilters 29 July 2019 OSR Seminar Space
Writing WDF Drivers 23 Sept 2019 OSR Seminar Space
Kernel Debugging 21 Oct 2019 OSR Seminar Space
Internals & Software Drivers 18 Nov 2019 Dulles, VA