Thanks,
SHiju
KM wrote:
Shiju,
I don't understand how you could take out parts of the solid code from
the article, call the parts differently and expect it to work the same
way?!
Please read about the Lock here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/fsctl_lock_volume.asp
Basically you Lock the volume from your code (just before the
dismounting) for two purposes:
- to know whether any file is open on the volume (lock would fails
if any file open)
- to have an exclusive access to a volume for a period of time while
you do the dismount and hibernate until unlock.
Please keep in mind that as soon as you application exists (even if you
didn't do the Unlock explicelty) the handle to the device (the
unprotected volume) would be closed and no exclusive access to it would
be maintatined (basically, auto unlock). This is why it is important to
maintain the the procedure in one applicaiton code as follows:
- Lock
- Dismount
- Hibernate
Does this make a sense?
KM
PS. Unfortunately, the important links to FSCTL codes on MSDN are broken
in that article you mentioned and this probably makes it "buggy" from
the presenting the idea point of view.
3. Closes the explorer and in command prompt, I do lock and dismount
the D: volume
Would you mind showing us how you do the disamount and unlock here?
[Shiju] I use the sample code from
http://msdn.microsoft.com/library/d...mesInHibernateOnceResumeManyConfiguration.asp
I removed the hibernation and unlock section from this samsple code.
4. Do hibernation
The same here, how do you do the hibernation?
[Shiju] From Start->Turn off computer->Hibernate
5. Press the power button to boot the system. Unlock D:. Open
explorer to verify the directory and file created at step2 is
present. I could find it is present.
The same here, unlock?
[Shiju] The same sample code from
http://msdn.microsoft.com/library/d...mesInHibernateOnceResumeManyConfiguration.asp
Here I removed the locking, dismount and hibernation from the code and
kept only the unlocking code in the program.
The reason we need that info is that it would be important on how you
do that.
It should be implemented within your application code:
- Lock
- Dismount
- Hibernate
- Unlock (optional but good to have in your app code anyway)
6. I created two more directories and files in d:
7. Close the explorer. Lock and dismount the d: volume from command
prompt.
Since the next step is Shutdown, you don't need to explicetly lock and
dismount volume here.
But this step of yours leads me to believe you don't do the
Lock/Dismount from your app code that does the hibernation.
[Shiju] Same as in step 3.
8. Gracefully shutdown.
9. Boot to system. The system picks up the hibernation file created
at step4 to boot.
10. Unlock d:. Open explorer to verify the directories and files
created at step6 are present. I could find that the files and
directories created at step6 were not present.
But if I had done hibernation at step 8, then the data is
preserved.So
This obviously would work since you just always update the hibernated
RAM image.
But you lose HORM features.
RF
I am doing hibernation every time to maintain data integrity. I use
the sample code in the site mentioned in my previous mail for doing
locking, dismount and unlocking of filesystem.
Is there anything wrong in the above procedure?
Most likely. But please provide us a little bit more info(see above).
KM
Thanks,
Shiju
Slobodan Brcin (eMVP) wrote:
Shiju,
What part of HORM do you not understand exactly?
Hibernate Once Resume Many.
After each resume you can do regular shutdown or restart and data
integrity will be ok as long as you have unmounted volumes before
you hibernated. Only this is important.
So just gracefully reboot and you will see that all your data are
there and ok.
Regards,
Slobodan
Hi,
I asked a similar question before. But I still have some doubts on
"Protecting Multiple Volumes in a Hibernate Once/Resume Many
Configuration" mentioned in the site
http://msdn.microsoft.com/library/d...mesInHibernateOnceResumeManyConfiguration.asp.
I have a similar XPE system configuration with two partitions with
HORM setup, one ewf protected and the other not protected. I have
an application that always writes to the unprotected volume.At
shutdown of the system I have to lock and dismount the unprotected
filesystem and hibernate. Next time on booting to the system, I
unlock the unprotected filesystem and do write again to the
unprotected partition. As before, at the time of shutdown I have to
lock and dismount the unprotected filesystem and then do
hibernation. If I don't follow this I will lose the data written on
to the unprotected volume. Is there anyway to protect the data in
unprotected partition without hibernating all the time? I mean to
flush the data to the unprotected fileystem by just locking and
dismounting or by any method other than hibernating each and every
time ?
Could someone help me on this.
Thanks & Regards,
Shiju