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

Home NTDEV

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Before Posting...

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

How to Re-mount a dismounted drive.

OSR_Community_UserOSR_Community_User Member Posts: 110,217
Hi Everybody,

I have successfully dismounted various drives on my system
programmatically. However, remounting them programmatically has been more
of a challenge. I must being doing something wrong and/or invalid. Here
are my procedures and observations. Any comments or suggestions would be
appreciated.

What I am trying to accomplish is this. I have a single disk drive in a
SCSI-RAID enclosure connected to a RAID controller. The drive is currently
formatted for NTFS. What I would like to accomplish is:
1 - Dismount the drive (Open \\.\x:; Lock Volume; Dismount Volume, Unlock
Volume)
2 - Physically remove the drive.
3 - Replace it with an identical drive.
4 - Remount the drive. (Open \\.\x:; Lock Volume; Load Storage Media,
Unlock Volume)
5 - Format new drive if necessary.

The drive I am dismounting only contains data files (no executables or
paging files will ever be stored on this disk).

The observations I have made are as follows:

1 - If I only dismount the drive programmatically (Step 1), then NT appears
to automatically remount the drive if I try to view it with explorer or any
other tool. Is this correct behavior? I think I read somewhere that it is,
but I forget where it might have been.

2 - If I dismount the drive, then remove it, and try to view it with
explorer, I get a "The device is not available" error (Naturally). I then
re-insert the same drive back in it's slot. From this point on, I can not
get NT to recognize the drive.
If I use the raid configuration utility, and I rescan the SCSI bus, the
drive appears. I can blink the drive and all, so I assume that as far as
SCSI is concerned, the drive is fine. Afterall, that is what RAID is
supposed to do. Anyways, using different ASPI programs, It appears that
the device is present, however, whenever INQUIREY information is requested
from the device, it reports a "Host Adapter Status" error 17
(HBASTAT_SEL_TO?).


Questions I have:
1 - Is what I am attempting to do reasonable?
2 - Should what I am attempting to do be possible?
3 - Are my steps to programatically remount a drive correct?

TIA,
Joe

Comments

  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    Under NT 4.0-, if you dismount, it will remount as soon as the device is
    touched (i.e. unlocking and closing). This has been resolved unfer 2000.

    I suspect you are going to need some specialized disk filter driver to
    accomplish what you want. I did the same sort oof thing for Compat Flash
    disk for NT 4.0.

    Jamey

    > -----Original Message-----
    > From: [email protected]
    > [mailto:[email protected]]On Behalf Of Joe Derham
    > Sent: Friday, April 07, 2000 8:09 AM
    > To: NT Developers Interest List
    > Subject: [ntdev] How to Re-mount a dismounted drive.
    >
    >
    > Hi Everybody,
    >
    > I have successfully dismounted various drives on my system
    > programmatically. However, remounting them programmatically has been more
    > of a challenge. I must being doing something wrong and/or invalid. Here
    > are my procedures and observations. Any comments or suggestions would be
    > appreciated.
    >
    > What I am trying to accomplish is this. I have a single
    > disk drive in a
    > SCSI-RAID enclosure connected to a RAID controller. The drive is
    > currently
    > formatted for NTFS. What I would like to accomplish is:
    > 1 - Dismount the drive (Open \\.\x:; Lock Volume; Dismount
    > Volume, Unlock
    > Volume)
    > 2 - Physically remove the drive.
    > 3 - Replace it with an identical drive.
    > 4 - Remount the drive. (Open \\.\x:; Lock Volume; Load
    > Storage Media,
    > Unlock Volume)
    > 5 - Format new drive if necessary.
    >
    > The drive I am dismounting only contains data files (no
    > executables or
    > paging files will ever be stored on this disk).
    >
    > The observations I have made are as follows:
    >
    > 1 - If I only dismount the drive programmatically (Step 1),
    > then NT appears
    > to automatically remount the drive if I try to view it with
    > explorer or any
    > other tool. Is this correct behavior? I think I read somewhere
    > that it is,
    > but I forget where it might have been.
    >
    > 2 - If I dismount the drive, then remove it, and try to view it with
    > explorer, I get a "The device is not available" error (Naturally). I then
    > re-insert the same drive back in it's slot. From this point on, I can not
    > get NT to recognize the drive.
    > If I use the raid configuration utility, and I rescan the
    > SCSI bus, the
    > drive appears. I can blink the drive and all, so I assume that as far as
    > SCSI is concerned, the drive is fine. Afterall, that is what RAID is
    > supposed to do. Anyways, using different ASPI programs, It appears that
    > the device is present, however, whenever INQUIREY information is requested
    > from the device, it reports a "Host Adapter Status" error 17
    > (HBASTAT_SEL_TO?).
    >
    >
    > Questions I have:
    > 1 - Is what I am attempting to do reasonable?
    > 2 - Should what I am attempting to do be possible?
    > 3 - Are my steps to programatically remount a drive correct?
    >
    > TIA,
    > Joe
    >
    >
    > ---
    > You are currently subscribed to ntdev as: [email protected]
    > To unsubscribe send a blank email to $subst('Email.Unsub')
    >
    >
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    Maybe you could also try issuing an IOCTL_DISK_FIND_NEW_DEVICES.

    > -----Original Message-----
    > From: [email protected]
    > [mailto:[email protected]]On Behalf Of Joe Derham
    > Sent: Friday, April 07, 2000 8:09 AM
    > To: NT Developers Interest List
    > Subject: [ntdev] How to Re-mount a dismounted drive.
    >
    >
    > Hi Everybody,
    >
    > I have successfully dismounted various drives on my system
    > programmatically. However, remounting them programmatically has been more
    > of a challenge. I must being doing something wrong and/or invalid. Here
    > are my procedures and observations. Any comments or suggestions would be
    > appreciated.
    >
    > What I am trying to accomplish is this. I have a single
    > disk drive in a
    > SCSI-RAID enclosure connected to a RAID controller. The drive is
    > currently
    > formatted for NTFS. What I would like to accomplish is:
    > 1 - Dismount the drive (Open \\.\x:; Lock Volume; Dismount
    > Volume, Unlock
    > Volume)
    > 2 - Physically remove the drive.
    > 3 - Replace it with an identical drive.
    > 4 - Remount the drive. (Open \\.\x:; Lock Volume; Load
    > Storage Media,
    > Unlock Volume)
    > 5 - Format new drive if necessary.
    >
    > The drive I am dismounting only contains data files (no
    > executables or
    > paging files will ever be stored on this disk).
    >
    > The observations I have made are as follows:
    >
    > 1 - If I only dismount the drive programmatically (Step 1),
    > then NT appears
    > to automatically remount the drive if I try to view it with
    > explorer or any
    > other tool. Is this correct behavior? I think I read somewhere
    > that it is,
    > but I forget where it might have been.
    >
    > 2 - If I dismount the drive, then remove it, and try to view it with
    > explorer, I get a "The device is not available" error (Naturally). I then
    > re-insert the same drive back in it's slot. From this point on, I can not
    > get NT to recognize the drive.
    > If I use the raid configuration utility, and I rescan the
    > SCSI bus, the
    > drive appears. I can blink the drive and all, so I assume that as far as
    > SCSI is concerned, the drive is fine. Afterall, that is what RAID is
    > supposed to do. Anyways, using different ASPI programs, It appears that
    > the device is present, however, whenever INQUIREY information is requested
    > from the device, it reports a "Host Adapter Status" error 17
    > (HBASTAT_SEL_TO?).
    >
    >
    > Questions I have:
    > 1 - Is what I am attempting to do reasonable?
    > 2 - Should what I am attempting to do be possible?
    > 3 - Are my steps to programatically remount a drive correct?
    >
    > TIA,
    > Joe
    >
    >
    > ---
    > You are currently subscribed to ntdev as: [email protected]
    > To unsubscribe send a blank email to $subst('Email.Unsub')
    >
    >
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    Hi Everybody,

    Jamey, thanks for the info.

    What would I do with IOCTL_DISK_FIND_NEW_DEVICES? To what device/driver
    would I send this to? Would it be the NTFS driver?

    What would be some the key operations you had in mind for this "specialized
    disk filter driver"? I am comfortable with device drivers, but not so much
    with filter drivers. Anyone?

    I forgot to mention that I am using NT4.0 SP6a & MSVC 6.0.

    TIA,
    Joe


    -----Original Message-----
    From: [email protected]
    [mailto:[email protected]]On Behalf Of Jamey Kirby
    Sent: Friday, April 07, 2000 12:51 PM
    To: NT Developers Interest List
    Subject: [ntdev] RE: How to Re-mount a dismounted drive.


    Under NT 4.0-, if you dismount, it will remount as soon as the device is
    touched (i.e. unlocking and closing). This has been resolved unfer 2000.

    I suspect you are going to need some specialized disk filter driver to
    accomplish what you want. I did the same sort oof thing for Compat Flash
    disk for NT 4.0.

    Jamey

    > -----Original Message-----
    > From: [email protected]
    > [mailto:[email protected]]On Behalf Of Joe Derham
    > Sent: Friday, April 07, 2000 8:09 AM
    > To: NT Developers Interest List
    > Subject: [ntdev] How to Re-mount a dismounted drive.
    >
    >
    > Hi Everybody,
    >
    > I have successfully dismounted various drives on my system
    > programmatically. However, remounting them programmatically has been more
    > of a challenge. I must being doing something wrong and/or invalid. Here
    > are my procedures and observations. Any comments or suggestions would be
    > appreciated.
    >
    > What I am trying to accomplish is this. I have a single
    > disk drive in a
    > SCSI-RAID enclosure connected to a RAID controller. The drive is
    > currently
    > formatted for NTFS. What I would like to accomplish is:
    > 1 - Dismount the drive (Open \\.\x:; Lock Volume; Dismount
    > Volume, Unlock
    > Volume)
    > 2 - Physically remove the drive.
    > 3 - Replace it with an identical drive.
    > 4 - Remount the drive. (Open \\.\x:; Lock Volume; Load
    > Storage Media,
    > Unlock Volume)
    > 5 - Format new drive if necessary.
    >
    > The drive I am dismounting only contains data files (no
    > executables or
    > paging files will ever be stored on this disk).
    >
    > The observations I have made are as follows:
    >
    > 1 - If I only dismount the drive programmatically (Step 1),
    > then NT appears
    > to automatically remount the drive if I try to view it with
    > explorer or any
    > other tool. Is this correct behavior? I think I read somewhere
    > that it is,
    > but I forget where it might have been.
    >
    > 2 - If I dismount the drive, then remove it, and try to view it with
    > explorer, I get a "The device is not available" error (Naturally). I then
    > re-insert the same drive back in it's slot. From this point on, I can not
    > get NT to recognize the drive.
    > If I use the raid configuration utility, and I rescan the
    > SCSI bus, the
    > drive appears. I can blink the drive and all, so I assume that as far as
    > SCSI is concerned, the drive is fine. Afterall, that is what RAID is
    > supposed to do. Anyways, using different ASPI programs, It appears that
    > the device is present, however, whenever INQUIREY information is requested
    > from the device, it reports a "Host Adapter Status" error 17
    > (HBASTAT_SEL_TO?).
    >
    >
    > Questions I have:
    > 1 - Is what I am attempting to do reasonable?
    > 2 - Should what I am attempting to do be possible?
    > 3 - Are my steps to programatically remount a drive correct?
    >
    > TIA,
    > Joe
    >
    >
    > ---
    > You are currently subscribed to ntdev as: [email protected]
    > To unsubscribe send a blank email to $subst('Email.Unsub')
    >
    >


    ---
    You are currently subscribed to ntdev as: [email protected]
    To unsubscribe send a blank email to $subst('Email.Unsub')
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Internals & Software Drivers 15 November 2021 Live, Online
Writing WDF Drivers 24 January 2022 Live, Online
Developing Minifilters 7 February 2022 Live, Online
Kernel Debugging 21 March 2022 Live, Online