how to flush the file system's cache to disk

Hi All,

i have to backup the system partition data when the system is running,
so before i can do that, i must flush the file system cache to disk,
such as files, directories, fat, etc.

but how can i to do that?

Any information is helpful.

Thanks.

You must lock and unmount the volume.
Somewhere in MSDN, there is exact description how
do to it, try to search topics related to
FSCTL_DISMOUNT_VOLUME.

L.

Thank you, Ladislav

but how to do with the normal partition (not system, in use or not in use),
if i lock and unmount the volume, the volume may be really unmounted.
but this is not my original intention.

i searched the list and find this :
http://www.osronline.com/lists_archive/ntfsd/thread622.html
it said IRP_MJ_FLUSH_BUFFERS can do this, is it right ?
anyway, i’ll try it

Thanks!

“Ladislav Zezula” ???:xxxxx@ntfsd…
> You must lock and unmount the volume.
> Somewhere in MSDN, there is exact description how
> do to it, try to search topics related to FSCTL_DISMOUNT_VOLUME.
>
> L.
>

> but how to do with the normal partition (not system, in use or not in

use),
if i lock and unmount the volume, the volume may be really unmounted.
but this is not my original intention.

I’m not sure if I understand this … Just follow the instructions
in the MSDN, it will work.

http://www.osronline.com/lists_archive/ntfsd/thread622.html
it said IRP_MJ_FLUSH_BUFFERS can do this, is it right ?
anyway, i’ll try it

If you need to unmount the volume from user mode application,
the IRP_MJ_FLUSH_BUFFERS is not what you seek.

L.

Hello,
IRP_MJ_FLUSH_BUFFERS will flush all the data from the cache to disk. But it
is not guaranteed that by the time IRP_MJ_FLUSH_BUFFERS returns to you,
there wont be any more dirty data in cache. Or even for that matter, the
data on the disk is not half updated. Flush will just ensure that whatever
dirty data exists in cache goes to disk.

-Kiran

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Xu Ge
Sent: Tuesday, June 14, 2005 11:56 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] how to flush the file system’s cache to disk

Hi All,

i have to backup the system partition data when the system is running, so
before i can do that, i must flush the file system cache to disk, such as
files, directories, fat, etc.

but how can i to do that?

Any information is helpful.

Thanks.


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@calsoftinc.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

thanks, Kiran

“Kiran Joshi” ???:xxxxx@ntfsd…
> Hello,
> IRP_MJ_FLUSH_BUFFERS will flush all the data from the cache to disk. But
> it
> is not guaranteed that by the time IRP_MJ_FLUSH_BUFFERS returns to you,
> there wont be any more dirty data in cache. Or even for that matter, the
> data on the disk is not half updated. Flush will just ensure that whatever
> dirty data exists in cache goes to disk.
>
> -Kiran
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Xu Ge
> Sent: Tuesday, June 14, 2005 11:56 AM
> To: Windows File Systems Devs Interest List
> Subject: [ntfsd] how to flush the file system’s cache to disk
>
> Hi All,
>
> i have to backup the system partition data when the system is running, so
> before i can do that, i must flush the file system cache to disk, such as
> files, directories, fat, etc.
>
> but how can i to do that?
>
> Any information is helpful.
>
> Thanks.
>
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@calsoftinc.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com
>
>