system partition shrink and filesystem filter driver

I am using diskpart.exe to shrink the system partition and create an small primary NTFS partition in the freed space. The OS is Windows 7.

Script is something like this:

select volume c
shrink minimum=20
create partition primary size=20
format fs=ntfs label=“My new partition” quick
assign letter=Y
exit

Somehow my filter driver is meddling in the shrink process causing Windows to hang. I have not a bug check code to figure out what I’m doing wrong.

Initially the filter just do some simple checks on pre create to block access to several files from usermode. I disabled all blocking functionality and didn’t help. Even returning STATUS_FLT_DO_NOT_ATTACH in all instace setup callback invocations does not “solve” the problem.

Any suggestions on how to continue investigating this issue?

Thanks

>Somehow my filter driver is meddling in the shrink process

causing Windows to hang. I have not a bug check code to
figure out what I’m doing wrong.

You need to start digging and figure out what exactly is hanging. You can
start with the classics:

!locks
!stacks 2

And go from there. Until you narrow down the thread(s) involved you’re
probably not going to get much help.

-scott
OSR

wrote in message news:xxxxx@ntfsd…

I am using diskpart.exe to shrink the system partition and create an small
primary NTFS partition in the freed space. The OS is Windows 7.

Script is something like this:

select volume c
shrink minimum=20
create partition primary size=20
format fs=ntfs label=“My new partition” quick
assign letter=Y
exit

Somehow my filter driver is meddling in the shrink process causing Windows
to hang. I have not a bug check code to figure out what I’m doing wrong.

Initially the filter just do some simple checks on pre create to block
access to several files from usermode. I disabled all blocking functionality
and didn’t help. Even returning STATUS_FLT_DO_NOT_ATTACH in all instace
setup callback invocations does not “solve” the problem.

Any suggestions on how to continue investigating this issue?

Thanks

Thanks Scott, I’m restarting this issue.

I was wrong. Shrinking and partitioning work if I don’t attach to volumes with FLT_FSTYPE_RAW filesystem type.

I have been reading about raw mode and it seems that works at block level instead of file level. So I suppose it is a common practice in fs filters to ignore raw I/O… am I right? or totally wrong?

Regards,

Julian

Sure, filters may choose to ignore the Raw FileSystem.

However, Raw *is* a valid file system, it is just special in that it only
supports volume opens. In general your filter should, “just work” as volume
opens are valid for all file systems. If this filter is for something other
than your own personal amusement (in which case you’re twisted :)), I’d want
to get to the bottom of why it’s not working. Otherwise there’s surely some
underlying issue that will come back to bite you eventually.

-scott
OSR

wrote in message news:xxxxx@ntfsd…

Thanks Scott, I’m restarting this issue.

I was wrong. Shrinking and partitioning work if I don’t attach to volumes
with FLT_FSTYPE_RAW filesystem type.

I have been reading about raw mode and it seems that works at block level
instead of file level. So I suppose it is a common practice in fs filters to
ignore raw I/O… am I right? or totally wrong?

Regards,

Julian

I’m not so twisted! I don’t like fires so I will follow your advice :slight_smile:

In fact I think I have taken the first step because the diskpart script works well now. I was treating the volumen opens as a normal file operation, using FltXxxFile API to calculate its hash and bsoding due to an access violation. Furthermore my first mail was also wrong about the Windows hang because of a missconfiguration issue with WinDbg+VirtualKD. My fault.

Fixed the bug, I also attach the filter to every volume without taking into account the filesystem type and when I detect a volumen opening I ignore it.

Thanks!

> However, Raw *is* a valid file system, it is just special in that it only

supports volume opens.

It only supports volume opens and only provides FsQueryInformationFile (aka GetDiskFreeSpace(Ex))


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com