In this post I want to show a neat trick that allows testing of filters on other file systems with very little overhead. This is important because very often file system filters end up very dependent on the semantics of some specific file system only because it's very easy to test on just that one. For example, most filters are tested with NTFS and occasionally FAT. However, the world of windows file systems is larger and in most cases just a simple test is enough to expose bigger issues.
I'd also like to mention the little known fact that Alternate Data Streams (ADS) and hardlinks are not only available on NTFS but on UDF as well, which makes UDF quite useful for testing these features if a filter uses them. Though UDF is meant for optical media I'll show you how you can set up a local virtual volume very easily.
I'm going to use the VHD support in the OS, which means this works on Win7 (and newer OSes). I found virtual disks to be very useful for testing and they're easy to setup and automate. What follows is code that creates a dynamic VHD:
C:\Users\Me>diskpart Microsoft DiskPart version 6.1.7600 Copyright (C) 1999-2008 Microsoft Corporation. On computer: xxxxxxx DISKPART> create vdisk file=c:\testUDFS.vhd maximum=10000 type=expandable 100 percent completed DiskPart successfully created the virtual disk file. DISKPART> attach vdisk 100 percent completed DiskPart successfully attached the virtual disk file.
Now that we have a VHD, the next step is to partition and format it:
DISKPART> create partition primary DiskPart succeeded in creating the specified partition. DISKPART> format fs=UDF label="UDFSVol" quick 100 percent completed DiskPart successfully formatted the volume. DISKPART> assign DiskPart successfully assigned the drive letter or mount point. DISKPART> exit Leaving DiskPart...
And that's all it takes, you now have the 10GB writable UDFS volume that can be used for testing filters in unusual setups:
C:\Users\Me>fsutil fsinfo volumeinfo I: Volume Name : UDFSVol Volume Serial Number : 0x96b7dca5 Max Component Length : 254 File System Name : UDF Supports Case-sensitive filenames Preserves Case of filenames Supports Unicode in filenames Supports Named Streams Supports Hard Links
Finally, exactly the same approach can be used to create an NTFS volume or an ExFAT volume, all that needs to change is the line to format the disk:
DISKPART> format fs=UDF label="UDFSVol" quick or DISKPART> format fs=ExFAT label="ExFATVol" quick or DISKPART> format fs=NTFS label="NTFSVol" quick
No comments:
Post a Comment