NTFS compression enables you to compress files and folders. Compressed files and folders occupy less space on an NTFS-formatted volume than do regular files and folders, which means you can store more data on them. Each file and folder on an NTFS volume has a compression state of either compressed or uncompressed.
After this lesson, you will be able to
Estimated lesson time: 10 minutes
Compressed files can be read by and written to any Microsoft Windows-based or MS-DOS-based application without first being uncompressed by another program. When an application, such as Microsoft Word for Windows, or an operating system command, such as Copy, requests access to a compressed file, NTFS automatically uncompresses the file before making it available. When you close or explicitly save a file, NTFS compresses it again.
NTFS allocates disk space based on the uncompressed file size. If you copy a compressed file to an NTFS volume with enough space for the compressed file but not enough space for the uncompressed file, you might get an error message stating that there is not enough disk space for the file. The file will not be copied to the volume.
You can set the compression state of folders and files, and you can change the color that is used to display compressed files and folders in Windows Explorer.
If you want to set the compression state of a folder or file, right-click the folder or file in Windows Explorer, click Properties, and then click the Advanced button. In the Advanced Attributes dialog box, select the Compress Contents To Save Disk Space check box, as shown in Figure 3.5. Click OK, and then click Apply in the Properties dialog box.
NOTE
NTFS encryption and compression are mutually exclusive. Therefore, if you select the Encrypt Contents To Secure Data check box, you can't compress the folder or file.
Figure 3.5 The Advanced Attributes dialog box
IMPORTANT
To change the compression state for a file or folder, you must have Write permission for that file or folder.
The compression state for a folder doesn't reflect the compression state of the files and subfolders in that folder. A folder can be compressed, yet all of the files in that folder can be uncompressed. Alternatively, an uncompressed folder can contain compressed files. When you compress a folder, Windows 2000 displays the Confirm Attribute Changes dialog box, which has the two options that are described in Table 3.8.
Table 3.8 Confirm Attribute Changes Dialog Box Options
Option | Description |
---|---|
Apply Changes To This Folder Only | Compresses only the folder that you have selected |
Apply Changes To This Folder, Subfolder, And Files | Compresses the folder and all subfolders and files contained in it now as well as any others that might be added to it in the future |
NOTE
Windows 2000 doesn't support NTFS compression for cluster sizes larger than 4 KB because compression on large clusters causes performance degradation. If you select a larger cluster size when you format an NTFS volume, compression isn't available for that volume.
Windows Explorer makes it easy for you to determine quickly whether a file or folder is compressed by allowing you to select a different display color for compressed files and folders. This allows you to distinguish them from uncompressed files and folders.
Follow these steps to set an alternative display color for compressed files and folders:
Specific rules determine whether the compression state of files and folders is retained when you copy or move them within and between NTFS and FAT volumes.
Figure 3.6 The effects of copying and moving compressed folders and files
The following list describes how Windows 2000 treats the compression state of a file or folder when you copy or move a compressed file or folder within or between NTFS volumes or between NTFS and FAT volumes.
NOTE
When you copy a compressed NTFS file, Windows 2000 uncompresses the file, copies the file, and then compresses the file again as a new file. This might cause system performance degradation.
The following is a list of best practices for using compression on NTFS volumes:
In this lesson, you learned how to compress and uncompress files and folders on an NTFS volume. You learned that compressed files can be read by and written to any Microsoft Windows-based or MS-DOS-based application without first being uncompressed by another program. The Windows NTFS file system automatically uncompresses the file before making it available, and when you close or explicitly save a file, NTFS compresses it again.
You also learned how to change the color used to display compressed files and folders in Windows Explorer to distinguish them from uncompressed files and folders. You learned too that NTFS encryption and compression are mutually exclusive.
Finally, you learned about copying and moving compressed files. When you copy a file within an NTFS volume, the file inherits the compression state of the target folder. When you move a file or folder within an NTFS volume, the file or folder retains its original compression state. When you copy or move a file or folder between NTFS volumes, the file or folder inherits the compression state of the target folder. Finally, when you move or copy a compressed NTFS file or folder to a FAT volume or a floppy disk, Windows 2000 automatically uncompresses the file or folder.