Forcing physical disk (not just volume) remount

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.

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.

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.