Hack 31 Get More Hard Disk Space by Using NTFS Compression


The quickest and easiest way to give your system more room is to use XP's built-in compression scheme for NTFS disks. Here's how to use it?and how to convert your existing disk to NTFS if it doesn't already use it.

If you need more hard disk space, don't buy another hard disk right away. First, consider using NTFS (NT File System) compression, which can give significantly more hard disk space by compressing all the files on your PC. NTFS's on-the-fly compression capabilities can shrink the size of individual files and folders, or entire drives. When you use it, the files or folders will be compressed when they're on your hard disk to save space, but they will be decompressed automatically when you use them, and then compressed again when stored on your hard disk. This means that, unlike with a compression program such as WinZip (http://www.winzip.com), you don't have to deal with decompressing as well as compressing files. You can also easily turn compression on and off.

Note that NTFS compression isn't available with a FAT32 filesystem, so if you have a FAT32 system you'll first have to convert to NTFS, as explained later in this hack. If you're not sure which filesystem your volume uses, right-click on your volume in Explorer, choose Properties General, and look for the information next to File System.

How much disk space can you save by using NTFS compression? That depends largely on the kinds of files you have on your system. Bit-mapped graphic files are very compressible, so you'll save quite a bit of hard disk space if you have many of them. Document files, such as Word files, are also reasonably compressible, while certain kinds of files, such as PDF (Adobe Acrobat) files, are barely compressible at all.

If you use NTFS compression on a file, the file can't be encrypted using XP's encrypting capabilities, so be careful not to compress any files that you want to encrypt.

In tests on my own PC, I found that bit-mapped .tif graphic files were compressed by more than 80 percent?a folder full of them shrunk from 295 MB to 57 MB. Word files shrunk by 66 percent?a folder full of them shrunk from 131 KB to 44 KB. PDF files, by way of contrast, hardly compressed at all?a group of them shrunk by just over 6 percent, from 5.59 MB to 5.27 MB.

When you use compression, you may notice a slight drop in system performance. There may be a slight lag when opening or closing files, depending on the speed of your system, because the files have to be decompressed in order for you to open them and compressed when you save them. With newer systems, though, you probably won't notice a lag. On my now-aging 1.8 GHz desktop, for example, I don't see a difference between working with files that have been compressed and working with files that haven't been compressed.

You can use NTFS compression on individual files, folders, and entire disks. To use NTFS compression on a file or folder, right-click on the file or folder in Windows Explorer and choose Properties General Advanced. You'll see the screen shown in Figure 3-24.

Figure 3-24. Enabling compression on files and folders to save hard disk space

Check the box next to "Compress contents to save disk space," click OK, and click OK again when the Properties dialog box appears.

If you want to compress an entire drive, right-click on it in Windows Explorer, and choose Properties General "Compress drive to save disk space." You'll be asked for confirmation, and then every folder and file on the drive will be compressed, one after another. Depending on the size of the drive, the procedure can take several hours. You can continue to use XP while the compression takes place. During that time, however, you may be prompted to close a file you're working on, so that XP can compress it.

By default, XP visually differentiates between compressed files and decompressed files; compressed files are shown in blue. If for some reason your compressed files aren't blue, and you want them to be, from Windows Explorer, choose Tools Folder Options View, scroll down, and select the checkbox next to "Show encrypted or compressed NTFS files in color."

Don't compress system files or .log files (files that contain logging information). If you do, your system can take a severe performance hit, because these files are in frequent background use and compressing and decompressing them constantly takes up CPU power. If these files are in folders that are compressed, you can decompress just those individual files by unchecking the "Compress contents to save disk space" box next to them. You can also decompress the folder in which they are located in the same way.

3.12.1 How Compressing Folders Affects Underlying Files

When you compress files in a folder, they are all, obviously, compressed. But things can get confusing when you mix compressed folders and decompressed folders on a hard disk, or when you have compressed files in decompressed folders and vice versa. What happens, for example, when you move a decompressed file into a compressed folder, or move a compressed file from a compressed folder into a decompressed folder? The possibilities can set your head spinning. Here are the rules that apply when you're mixing compressed and decompressed files and folders:

  • Files copied into a compressed folder are automatically compressed.

  • New files created in a compressed folder are automatically compressed.

  • Files moved into a compressed folder from a separate NTFS volume are automatically compressed.

  • Files moved into a compressed folder from the same NTFS volume retain their compression settings. So, if the file was compressed, it will remain compressed. If the file was not compressed, it will not be compressed.

  • If you move a file from a compressed folder to a decompressed folder in the same NTFS volume, the file will remain compressed.

  • If you move a file from a compressed folder to a decompressed folder on a different NTFS volume, the file will no longer be compressed.

  • Files copied or moved from a compressed folder on an NTFS volume to a FAT32 volume are decompressed.

  • Files attached to emails are decompressed.

3.12.2 Checking How Much Disk Space NTFS Compression Saves

When you compress a file or folder, it doesn't appear that you're actually saving any disk space; when you view a file listing in Windows Explorer, the size of the compressed files will remain the same as they were before compression. In fact, though, the files have been compressed and space has been saved. Explorer reports on only the decompressed file size, not the compressed file size. To see the compressed size of a file or folder, Right-click on it in Windows Explorer and choose Properties General. You'll see two listings of the file size, one titled "Size" and the other titled "Size on disk". The "Size on disk" listing reports on the compressed size of the file, while the "Size" listing reports on the decompressed size, as shown in Figure 3-25.

Figure 3-25. Viewing the true size of a compressed file

3.12.3 When to Use ZIP Files and When to Use NTFS Compression

Another way to gain extra space on your hard disk is to use XP's built-in ZIP capabilities. ZIP is an industry standard for file compression, and it compresses files much more effectively than NTFS does. In tests, I found that ZIP compression shrunk graphics files twice as effectively as NTFS compression?the resulting ZIP files were half the size of the NTFS-compressed files.

But that doesn't mean you should use ZIP compression all the time; there are times when using NTFS compression is a better bet. When files are ZIPped, for example, they can't be opened in their application by double-clicking on them. You first have to open the ZIP archive, and then double-click on the file. As a general rule, ZIPped files are not as convenient to use and handle as NTFS-compressed files. The exception is that ZIP lets you archive a group of files into a single folder, which you can then send to others via email or on disk.

What does this mean? On a day-to-day basis, NTFS compression is a better bet for files you frequently use. However, there are a number of reasons that to use ZIP files instead:

  • When you need to send a large file or files to someone via email. You can zip all the files into a single archive, and send that along.

  • For storing files that you rarely use. You can create ZIP archives to store the files, and then delete the originals.

  • For gaining the maximum amount of disk space. If hard disk space is at a premium, you'll save much more with ZIP files.

  • When you want to compress and also encrypt files. You can't encrypt files that have NTFS compression; you can encrypt files that have been ZIPped.

If you decide to use ZIP files, consider getting a copy of WinZip (http://www.winzip.com). It's easier to use than XP's built-in ZIP compression and offers many more features, including several levels of compression, built-in links to email, and much more.

3.12.4 Convert Your Hard Disk to NTFS

To use XP compression or encryption, you have to use NTFS. But if you instead have a previous filesystem, such as FAT32, you're not left out?you can convert it to NTFS. To convert a volume to NTFS, use XP's convert utility. To convert a volume to NTFS, at a command prompt, type:

convert d: /fs:ntfs

where d: is the volume you want to convert.

You can also use a number of parameters along with the utility:


This runs the utility in verbose mode, which provides information about the volume being converted.


This sets the security privileges on the converted disk so that its files and folders can be used by anyone.


Use this parameter if you're on a network and want to make sure that another user cannot disrupt the conversion process by trying to access the drive while you're converting it. This parameter dismounts the drive from the network.

3.12.5 Hacking the Hack

If you convert to NTFS, here's a Registry hack for increasing its performance. Whenever you view a directory on an NTFS volume, the filesystem updates the date and time stamp to show the last time the directory has been accessed. If you have a very large NTFS volume, this continual updating process can slow system performance. You can use the Registry to disable automatic updating. Run the Registry Editor [Hack #68] and go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentContolSet\Control\Filesystem. Look for NtfsDisableLastAccessUpdate. If it's not present, create it as a DWORD. Set the value to 1.