Method for quick shutdown (1/2 - 1 second) or forced flush of file systems

P

psucro

I have a Windows XPE system using EWF RAM-REG on the C: partition,
using FAT32.
The system contains a 30-40 Gig drive with only C: protected.

I have several other partitions using NTFS. I've noticed once in a
while we get a
inode (file allocation table element in NTFS) corrupt with NTFS.

I've seen the information on the dirty flag, and it causing auto disk
checks on startup.
(method 1) Will this work with EWF, or is this dirty flag stored
somewhere on the boot partition,
which is write protected.

I would rather not enable the disk protection, since the device will be
disk checked on powerup and slow the startup considerably.

-------------------------

So another proposed method would be to flush on power-fail.
The power supply could provide 500-1000 mS of hold-up time to allow
this flush, on powerfail conditions.

(method 2) Is there a way to have windows lock the drives and flush the
contents.
(NOTE: I've seen the information on using HORM, with lock, and
dismount, just before hibernation file is created.)

--> I thought I could use this code to do a quick shutdown, by
locking and dismounting all the drives in the sytem, but I always get
errors (5 - Access is denied.) trying to lock the drive.

see the microsoft link -
http://msdn.microsoft.com/library/d...mesInHibernateOnceResumeManyConfiguration.asp

The code for dismount_all_in_one.cpp does not appear to work, since
some files are open on the drives being locked.
(I've tried removing system restore and other stuff, I used
sysinternals to look at open files also.)

But any way, how can I force the flush even through files are open,
then force a disconnect to prepare for power-fail condition.

Thanks in advance.
Paul Sucro.
 
M

Matt Kellner [MS]

Hi Paul. Interesting ideas in your second point below (I don't have a
direct response to your first question), but I'm afraid flushing on
power-fail would require two things that are not currently present: One,
consistent design in power supplies that would allow all (or a majority) of
them to have that .5 - 1 second uptime on power fail. Most power supplies
actually just cut out much quicker than that, and most computers fail to go
down cleanly (residual power in the system can cause a hard drive to corrupt
its data, for example, because the hard drive is still writing bits while
the head is moving to the parked position, and the CPU has gone down
already).

Two, the computer and OS have no awareness of when the system is losing
power (unless you're running a UPS with notification capability, but that's
outside the scope of your scenario). The system would have to have an
extremely low-level interrupt available to it that would notify the OS when
it's losing power. Also, with the current architecture of the OS, it's
unlikely that the OS would respond in time to do the flush, and the flush
may take longer than the allotted time anyway. In many respects, this would
be a much more dangerous operation than what happens now, where the system
just remains unflushed.
 
G

Guest

Assume I have control of the power supply.
NOTE: This is an embedded product with a custom designed power supply,
which I expect many embedded products will be.

I WILL be notified as soon as the power goes down, and I WILL have 1 second
or more hold-up time to cause windows to flush and lock the drives.

What is the method to cause this flush and shutdown to occur.
Look at my first email, where I talk about using the Microsoft method for
HORM to cause a flush, which does not work due to Windows services having
files open on the drive.

Would I need to shutdown those services, then perform the flush and
shutdown, or is their someway to force the lock (i.e. using priveledged setup
routins to allow the forced lock)

1. Shutdown the service which maintains the "pagefile.sys".
2. Shutdown any other services which have access to the drives
3. Perform the lock and flush of the drives

Thanks,
Paul.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top