10 Feb 8
Fsutil is a command-line utility for performing file system related tasks, such as displaying/managing file or drive properties, dismounting or extending a volume etc. Fsutil is a very powerful tool and is meant to be used by system administrator to perform advance operations. In this post, i will try to share my knowledge on fsutil to perform some simple yet useful tasks.
(*Do learn about what you are doing before executing a command.)
1. Creating a file of a specific size instantly, e.g. 1GB
# fsutil file createnew <filename> <filesize> fsutil file createnew testfile 1073741824
2. Disabling short file names. Default windows will create 8.3 character length file name for every file/folder you create. This is to provide compatibility to some program which based on DOS. Often, this is not needed, and can be set to true, which in turns speed up windows.
# fsutil behavior set disable8dot3 {1|0}
fsutil behavior set disable8dot3 1
3. Disabling timestamp for last access to a file. You might disable to function where windows keep track of the last access timestamp for files.
# fsutil behavior set disablelastaccess {1|0}
fsutil behavior set disablelastaccess 1
4. Disabling Vista’s Encryption File System. If security is not a concern, and your system is in need of extra resources, you might choose to disable to EFS that vista provides.
# fsutil behavior set disableencryption {1|0}
fsutil behavior set disableencryption 1
* 2 & 3 & 4, in fact behavior got another sub-command in addition to “set” — “query”. You may use it to query the current setting for a specific property.
# The following command can be used to query the current setting of disable8dot3 fsutil behavior query disable8dot3
5. List all drives in a computer. This could easily retrieve and echo all the drives connected on this computer including remote drives.
fsutil fsinfo drives
6. Check a drive’s type e.g. CD-ROM. Sometimes, in script, you might use it to determine which drive is a CD-ROM.
# fsutil fsinfo drivetype <volume name> fsutil fsinfo drivetype C:
7. List information for the specified drive. This shall show a list of supported properties such as “Case-sensitive File Name”, “Sparse Files” etc.
# fsutil fsinfo volumeinfo <full volume path> fsutil fsinfo volumeinfo C:\
8. Query the free space of a drive. To identify how much free space is left exactly for a specific drive.
# fsutil volume diskfree <volume name> fsutil volume diskfree C:
9. Dismount a volume. *Use it carefully*
# fsutil volume dismount <full volume path> fsutil volume dismount C:\
Above only listed some useful command for your reference, and it’s not complete. For further information, you can refer to here.