File compression options. The effect of ntfs compression on file reading speed


More capacity with NTFS compression

As enthusiasts, we often encounter various obstacles in maintaining a balance between performance and cost. New processors, graphics cards, memory sets, power supplies and storage performance are potentially bottlenecks in this balance. Fortunately, the capacity is not the same a big problem. Even hard disks 2.5" offers more than 750 GB, which is more than enough for most users. Despite Microsoft's attempts to increase the size Windows installations, you still have mass left free space for music, movies, games and photos. Of course, if we talk about breaking barriers, you can always use 3.5" drives, the capacity of which today can reach several terabytes.

Until the recent floods in Thailand, which greatly affected the supply of hard drives, you could purchase 2 TB hard drives for about $80 (depending on the model and manufacturer). Regular users such a volume may seem excessive, although those who have large collection movies will fill it up pretty quickly. Be that as it may, the issue of lack of space for users with large drives rarely arises.

However, for fans of solid-state technology the situation is somewhat different. Such drives are much easier to fill with data. Compared to mechanical drives, they offer much less capacity, making every gigabyte valuable. Essentially, every gigabyte of an SSD literally costs more because you'll have to pay more than $1 for it, and the cost per gigabyte regular drive measured in cents.

Little ones SSD capacity less than 60 GB fills up almost immediately after installing Windows, Office suite and important programs. The problem of low capacity is complicated by the fact that the wear leveling algorithm does not work as effectively when the drive is completely full. This is why we often recommend using SSDs for performance-sensitive information and HDDs for other data.

Today our attention will be drawn to the pros and cons of the solution that Microsoft offers in its OS: the file compression function NTFS systems. To work, you only need to turn it on, which is quite convenient. But what else is worth knowing about this feature?

Our test laboratory will try to answer the following questions: how to enable data compression, what exactly is compressed and how this function affects SSD performance?

The NTFS system is 19 years old

Instead of the previously used FAT systems(FileAllocationTable), the developer introduced the NT file system, which had several notable advantages. For example, Microsoft company raised the 8+3 character limit for a file name, left over from the DOS days. Unlike FAT, which only allowed you to enter latin characters for file names, NTFS allowed up to 256 Unicode characters. This was also supported by the FAT32 system, which replaced FAT and was introduced in Windows 95b in 1997. However, the update also had a hard time competing with NTFS.

In the end, NTFS gave others useful features, such as journaling, which recorded all pending file changes in a so-called journal, in a reserved space before they were actually executed. This allowed data to be quickly recovered from NTFS partitions if write operations were interrupted by a system crash or power outage. NTFS also uses file and folder access control, quotas, encrypted disk areas and user quotas, and data compression capabilities will be tested today. Before you enable it, we want to warn you about how this feature works and how it will affect your system.

NTFS compression

NTFS uses the LZNT1 algorithm (version LZ77) for lossless data compression and 4096-byte clusters for data storage. The system compresses the output data in blocks of 16 clusters with a step of 64 KB. If the system cannot compress the output of 16 clusters into a smaller size, NTFS leaves it unchanged. If the LZNT1 algorithm can compress a 64 KB data block into 60 KB or less while freeing at least one cluster, that freed cluster is considered a "sparse" file. NTFS ignores those parts of the file that contain no information or have a size of 0 bytes. Therefore, a compressed file can consist of compressed and uncompressed clusters, as well as "sparse" clusters.

Any file is included in the compression scheme, but like any other type of file compression, the LZNT1 algorithm is not effective when compressing files that are already compressed, such as JPG, AVI and ZIP. Compression is performed at the level file system, so it is not visible at the application level. The longer Windows and its applications run, the smaller the difference between compressed and uncompressed files.

Advantages: Obviously, the biggest advantage of NTFS compression is saving free space. Owners small SSDs They will be especially glad for every additional megabyte. Increasing compression and decreasing file size should increase read and write speeds (by at least in theory, since less data is written and read).

Flaws: According to Microsoft, NTFS compression is CPU intensive and is not recommended for use on servers containing large read/write volumes. There are prohibitions even for home use. Compression should be used for folders with relatively infrequent writing and reading. More importantly, don't squeeze system folder Windows. Also, in theory, copy operations should be slower because the file system decompresses first required file, copies or moves it and then compresses it again. If you send such files over the network, they will also be unpacked first and, as a result, will not save traffic.

Another factor worth noting is that NTFS compression in 64 KB segments greatly fragments data, especially easily compressed files, since they will be associated with “sparse” clusters. This is easy to show with an example: by according to Microsoft On average, NTFS compression in 64 KB data blocks generates one "sparse" cluster. Dividing a 20 GB file system into 64 KB segments generates 327,680 “sparse” clusters. This is especially true for hard drives, solid state drives suffer less because their access times are so low that fragmentation is not a big problem for them.

Configuration and tests

How much does NTFS compression affect the performance of a system equipped with an SSD? We already know that SandForce technology uses compression to get great results, so we want to try out a drive that doesn't rely on compression. We took one of the new drives Samsung 830 series and compared its performance with compression on and off.


Test configuration
CPU Intel Core i5-2500K (32nm, Sandy Bridge, D2), 4C/4T, 3.3 GHz, 4 x 256 KB L2 cache, 6 MB shared L3 cache, w/ HD Graphics 3000, 95 W TDP, 3.7 GHz max. Turbo Boost
Motherboard (LGA 1155) Gigabyte Z68X-UD7-B3, revision: 1.0, Intel chipset Z68, BIOS: F9C
Memory 2 x 4 GB DDR3-1333, Kingston KHX1600C9D3K2/8GX
System SSD Samsung SSD 830, 256 GB, SATA 6 Gb/s
Controller Intel PCH Z68 SATA 6 Gb/s
power unit Seasonic X-760 760 W, SS-760KM
Tests
performance measurement SYSmark 2012
PCMark 7 1.0.4
Software and drivers
operating system Windows 7 x64 Ultimate SP1
Intel Rapid Storage 10.6.0.1002
Intel Inf 9.2.0.1030
AMD Catalyst 11.8

NTFS compression in practice

NTFS compression is enabled with just a few clicks. IN Windows Explorer open context menu for any drive or folder, select properties and in the next window select the option “Compress this drive to save disk space” or “Compress contents to save disk” space"). Everything can be returned simply by canceling the option.

After selecting a volume or folder, the compression process will begin automatically in background. Windows will report an error when the file cannot be compressed. Then you will have to choose: try to compress the file again (which will again lead to the same error), cancel, or ignore the message. Due to the large number of errors when compressing the partition, we decided to choose the fourth option: ignore all subsequent errors. The frequency of such messages depends on the selected folder. For Windows folders and its subfolders they appear very often, showing that system files are not subject to NTFS compression.

After NTFS compression is complete, the compressed file appears in blue, making it easy to distinguish from uncompressed files and folders.

Uncompressed applications installed on our test SSD took up 70.9 GB disk space. Instead of choosing separate folders, we compressed the entire partition at once, thus reducing the occupied space to 58.4 GB (minus 17.8%), freeing up 12.5 GB in just a couple of mouse clicks.

If we compare the NTFS compression density with other tools, it turns out to be quite low, which, in turn, has a positive effect on the processor load. Tools like 7-Zip are more aggressive in achieving high compression ratios. For example, the table below shows the compression ratio three folders using 7-Zip.

Compression tool Folder Original size Size after compression Percentage difference
7-Zip Program Files (x86) 17.4 GB 10.2 GB 40.30%
7-Zip Program Files 8.5 GB 3.1 GB 63.50%
7-Zip Windows 15.1 GB 3.2 GB 78.80%
NTFS compression Whole drive 70.9 GB 58.4 GB 17.60%

Test results

Sequential Read/Write (CrystalDiskMark)

With NTFS compression enabled, the Samsung drive's sequential reading performance degrades slightly. However, the loss in the recording is obvious. As a result, fragmentation during compression due to "sparse" clusters did not have a significant impact on performance, although the difference was noticeable.


Random read/write 4 KB (CrystalDiskMark)

Switching to NTFS compression does not affect this process in any way.




Random read/write 512 KB (CrystalDiskMark)

NTFS compression provides a significant increase in performance when writing random 512 KB blocks. However, in read operations the improvement is barely noticeable.


Launching applications, starting and shutting down Windows

On average, NTFS compression adds one second to the startup time of programs.


PCMark 7

PCMark 7 confirms that enabling NTFS compression leads to increased performance in games and when loading applications, but in almost all other disciplines the lead is either small compared to an uncompressed system drive, or the results are lower. Hence, overall result does not give the full picture.














SYSmark 2012

The BAPCo SYSmark 2012 application test suite also shows a neutral effect of NTFS compression, although the results point slightly in favor of the uncompressed configuration.







Should you compress the data on your SSD?

Activating NTFS compression gives results on high-performance computers with fast multi-core processor, because this way you can squeeze out more space on the SSD without a significant loss in performance. Comparison with powerful tools, such as 7-Zip, showed that NTFS compression behaves less aggressively and excludes important Windows system files. Thus, it is not designed to compress as much as possible any available information.

But this approach causes moderate CPU load. Users of modern dual- and quad-core CPUs will most likely not notice any additional load from the compression function enabled. But due to the low-performance nature of laptops, we cannot promise that this will also be the case on mobile systems. Depending on the hardware, compression can affect both system speed and battery drain due to increased load per processor.

Recovery tools should have no problem with compression since the feature has been available in NTFS for over a decade and is therefore well known to software developers. We can't give you comprehensive information, but we backed up compressed partitions using Acronis TrueImage Home 2011 without any problems.

Despite its moderate speed, NTFS compression does free up a bit free space, so necessary on an SSD. On our test system it gave us a whopping 12.5 GB. And this is a lot, especially for small SSDs. If we talk only about 60 and 100 GB SSDs, 10 GB is a lot. Owners of large SSDs should also think about NTFS compression. Moreover, if you have a fast enough processor, there is no reason not to enable it.

The amount of space freed depends on the type of data you are compressing. Most media files are already compressed, so you won't get much out of them. However, compression of files such as server logs and Excel files will free up a lot of space on the drive.

There's one more thing worth noting. Information that is compressed on the fly requires more write cycles to the SSD than uncompressed information. This may negatively affect the longevity of the drive. We are not talking about large SSDs; on the contrary, models with smaller volume memory have more low level durability. Thus, NTFS compression can significantly affect their lifespan.

In this article I would like to talk about Windows features, which allows you to significantly save space on your hard drive - compression functions. For the first time, built-in compression functions appeared in Windows XP, in subsequent Windows versions this function is always present. Two types of compression are supported:

  • NTFS compression at the file system level
  • Compressed Folders

CompressionNTFS– this is archiving at the NTFS file system level, it is performed transparently by the file system driver. NTFS compression can be applied to entire files, folders and drives. To do this, each compressed object is assigned a special compression attribute (compression state), which indicates whether the file is compressed or not. This type of compression has its own characteristics:

  • NTFS compression is only possible on partitions with the NTFS file system
  • When accessing a compressed file or folder, transparent decompression is performed, i.e. the user does not see the differences between compressed and regular files in Windows, and can easily copy, add or delete files in compressed folder.
  • To display objects compressed on NTFS, a special color scheme(by default, the names of compressed files are displayed in blue in Explorer)
  • The access speed of a compressed file is lower because... systems require some time to unpack it (for modern systems this operation does not create any difficulties, so the delay is practically invisible to the naked eye).
  • Compression is weaker than using ZIP folders or other archivers, but it is much faster

CompressedZIP folders imply archiving files using the system’s built-in creation function zip archives. Compressed folders are very similar to regular folders, sometimes you can even forget that you are actually working with a ZIP archive. Features of ZIP folders in Windows:

  • Compressed ZIP folders can be created on both NTFS and FAT volumes.
  • You can open files and even run some applications from a compressed Zip folder
  • The zip folder can be transferred to another computer, where it can be decompressed with any other compression program.
  • To compress a file, you just need to move it into a compressed Zip folder. When a file is moved from such a Zip folder to a regular one, it is automatically unpacked.

How to compress a folder in Windows

To enable NTFS compression on a directory, you need to click on it in Windows Explorer right click mouse and select properties.

Then click on the button Advanced(Others) and check the option Compresscontentstosavediskspace (Compress content to save disk space) and click OK twice.

The system may ask: do you want to apply changes only to the folder or also to all subdirectories (usually item 2 is selected, Applychangestothisfolder,subfoldersandfiles)

As a result, the name of the compressed directory and its contents will be displayed in blue in Explorer, which means that NTFS compression has been applied to the object.

Let's compare the compression ratio using built-in Windows tools

Let's compare the compression level using different tools, for which from the same folder (in my case the folder contains Excel documents and Word), first create a zip archive (right-click on the directory Send to->Compressed (zipped) folder), then enable NTFS compression on the same directory.

Original folder size – 145 M b

Zip folder size 27.4 MB

Folder size with NTFS compression enabled – 51 MB(field value Sizeondisk in the properties of the compressed folder)

Those. in my case compression in ZIP folder most efficient and reduced the size of the directory it occupied on disk on 81% (while NTFS compression is only 65% ).

However, you need to be careful with compression; it can lead to the error described in the article. In addition, if you enable compression on a directory with a large (very large) number of files, then checking such a disk (chkdsk) may take a VERY long period of time, and if so, then hold on, the desktop will not appear soon..

Before you begin the process of compressing a file or folder, it is very important to understand all the benefits obtained from this, and to understand the compression methods available in Windows 7:

  • NTFS file compression
  • Compressing (zip) a folder.

Data compression reduces the file size by minimizing redundant data. IN text file Redundant data often includes certain characters, such as the space character or common vowels (e and a), as well as character strings. Data compression creates a compressed version of the file, minimizing this redundant data.

These two compression methods will be compared below. In addition, the impact will be considered various files and folders on the effect of compressed files and folders.


The NTFS file system supports file compression based on separate file. The file compression algorithm here is lossless compression algorithm, which means that no data is lost when compressing and decompressing the file. In other algorithms, during compression and subsequent decompression, part of the data is lost.

NTFS compression available on those using the NTFS file system hard drives, has the following limitations and features:

  • Compression is an attribute for a file or folder.
  • Folders and files on an NTFS volume are either compressed or not.
  • New files created in a compressed folder are compressed by default.
  • The status of a compressed folder does not necessarily reflect the compression status of the files in that folder. For example, folders can be compressed without compressing its contents, and some or all of the files in the compressed folder can be decompressed.
  • Work with NTFS-compressed files without decompressing them, since they are decompressed and compressed again without user intervention.
  • If a compressed file is opened, the system automatically decompresses it.
  • When you close the file, Windows compresses it again.
  • To make it easier to recognize, NTFS compressed file and folder names are displayed in a different color.
  • NTFS- compressed files and the folders remain compressed, only on the NTFS volume.
  • NTFS compressed files cannot be encrypted.
  • The compressed bytes of the file are not accessible to applications; they only see uncompressed data.
  • Applications that open compressed files can work with them as if they were uncompressed.
  • Compressed files cannot be copied to another file system.

Note: You can use a compact tool to manage NTFS compression command line.

Move and copy compressed files and folders.


Moved or copied compressed files and folders may change their compression status. Below are five situations that examine the impact of copying and moving on compressed files and folders.

Copying within a partition of an NTFS partition.

How does the state of a compressed file or folder change if you copy it inside an NTFS partition? When you copy a file or folder inside an NTFS file system, the partition, file, or folder inherits the compression state of the target folder. For example, if you copy a compressed file or folder to an unzipped folder, the file or folder will be automatically unzipped.

Moving inside an NTFS partition.

What happens to the compression state of a file or folder when it is moved within an NTFS partition?

When you move a file or folder within an NTFS partition, the file or folder retains its original compression state. For example, if you move a compressed file or folder to an uncompressed folder, the file remains compressed.

Copying or moving between NTFS partitions.

What happens to a compressed file or folder when you copy or move it between NTFS partitions?

When you move a file or folder between NTFS partitions, the file or folder inherits the compression state of the target folder. Because Windows 7 treats movement between partitions as a copy followed by a delete operation, files inherit the compression state of the target folder.

When you copy a file to a folder that already contains a file with the same name, the copied file takes on the target file's compression attribute, regardless of the folder's compression state.

Copy or move between FAT and NTFS volumes.

What happens to the compression of a file that is copied or moved between FAT and NTFS volumes?

Compressed files copied to a FAT partition become uncompressed because FAT volumes do not support compression. However, if you copy or move files from a FAT partition to NTFS partition, they inherit the compression attribute of the folder you copy them to.

When copying files, the NTFS file system calculates disk space based on the size of the uncompressed file. This is important because the files are not compressed during the copy process and the system must ensure sufficient space. If you try to copy a compressed file to an NTFS partition and there is no free space for the uncompressed file, you will be presented with an error message notifying you that there is not enough disk space for the file.

Another quite interesting and promising, but for some reason poorly advertised, Windows capability 10, is support LZX data compression algorithm at the file system level NTFS. Compared to the one we are already familiar with, the compression ratio of LZX in Windows 10 is much higher (the compression level is almost at the zip level). Achieved compression ratio average 40-60% .

Compressing files using the LZX algorithm in Windows 10 is done only manually using a utility already familiar to us compact(we looked at it in the article about). When accessing compressed files, their decompression in memory is completely transparent to the user.

Disadvantages of using LZX compression:

  • Compression is performed manually, and if the compressed file is overwritten/updated/changed, compression must be performed again. Therefore, this type of compression is not practical for permanent modified files and temporary folders.
  • Decompressing compressed files in memory consumes additional CPU and memory resources. This, in general, is not critical for modern multi-core processors.
  • Compressed files are not highlighted in Explorer in any way (files compressed with standard NTFS compression are highlighted in blue)

Important. Files compressed in Windows 10 using the LZX algorithm cannot be opened in previous versions of Windows.

Ideal candidates for compression using the LZX algorithm are static files that are read/executed only. These criteria usually include directories with installed programs, games, distribution repositories, a number of system directories.

For example, when compressing a directory with installed game Far Cry 4, the directory size decreased from 27 to 17 GB. For Counter-Strike: GO, the savings in disk space turned out to be more modest: 10 versus 7.5 GB.

Note. Naturally, survive multimedia files(photos, videos, music) and archives make no sense, because... they are already compressed using proprietary algorithms.

The compression operation is performed only from the command line launched with administrator rights. For example, to compress one file, let's use the command:

compact /c /a /exe:lzx "C:\Program Files (x86)\mirkes.de\Tiny Hexer\mpth.exe"

The size of the disk occupied by these executable files has decreased from 1.54 MB to 0.7 MB.

Let's compress the contents all files and subdirectories in a specific directory:

compact /c /s /a /i /exe:lzx "C:\Program Files (x86)\*"


In our example, the size of the C:\Program Files (x86)\ directory on the disk has almost halved.

Important! Under no circumstances should you compress the entire system drive or the C:\Windows directory. The system may simply stop booting (the case of bootloader compression was discussed in the article).

In general, the following system folders can be safely compressed:

  • C:\Windows\Installer
  • C:\Windows\assembly
  • C:\Windows\Microsoft.NET
  • C:\Windows\Fonts
  • C:\Windows\Inf
  • C:\Windows\infused apps

To unpack compressed files, use the commands:

compact /u /a /exe “C:\Program Files (x86)\mirkes.de\Tiny Hexer\mpth.exe"
compact /u /a /s /exe "C:\Program Files (x86)\*"

Despite the constant growth of media capacities, problems with the exhaustion of free space remain as relevant, and this problem is especially often faced by owners SSD drives, the cost of GB of space is still quite high. Using LZX file compression in Windows 10 will help save disk space at the expense of a small loss of performance (virtually not noticeable on modern systems). There is one more nuance: on slow disks, by using compression, you can reduce the time it takes to read large files, because unpacking files in memory will take less time than reading large file from disk.

Like previous versions operating system Windows 10 supports NTFS file compression to save disk space. Unlike ZIP archiving, NTFS compression does not require the user to invest necessary files into a separate archive and then extract them for use. The system compresses files, reduces the space occupied, but the objects are ready for use at any time and do not require additional actions.

NTFS file compression works using tools built into the system and does not require the user to download or install additional software. You can compress files in Windows 10 using both Explorer and the Command Line. The latter method is more complex due to the need to remember commands and Extra options. You will find both methods here.

The efficiency of file compression is directly proportional to the size of the object. In other words, the larger the file, the more disk space the system can save through compression. In this case, the compression time will also be directly proportional to the size of the compressed file. This one is simple, but quite effective method compression will be useful for those who have very limited space on their computer, but at the same time need to constantly store it locally large files. If you are one of those users, then it will also be useful for you to read the instructions “”. It will help you carve out a few extra gigabytes of free disk space. Also, see the instructions for freeing up space on system disk after installing the operating system.

Please note that compressed files and folders in Windows 10 appear with an additional icon with two arrows. This will help you figure out which files are compressed and which are not.

How to compress files in Windows 10 Explorer


Once the changes are applied, you can evaluate the effectiveness of the compression. The screenshot shows that before compression the folder occupied 1.08 GB of disk space, and after compression the volume decreased to 0.99 GB of disk space. IN in this case the savings were approximately 8%, which is quite good.

How to decompress files in Windows 10

Everything is done in exactly the same way as file compression.


Compressing files via Command Line in Windows 10

Click Win+ R and enter cmd. In the command line window that opens, you need to enter the command compact/# “full path to file or folder”. Depending on the desired result, you will need to use the following commands:

  • Compact/cfullThis is the path to the file or folder"– compression of one file or folder. If you compress a folder, then the compression will not affect its subfolders.
  • Compact/ufullThis is the path to the file or folder"– recovery of one file or folder.
  • Compact/c/sfullThis is the path to the folder"– compresses a folder with all its files or folders.
  • Compact/u/sfullThis is the path to the file or folder"– restore the folder to its normal size with all its subfolders or files.

Additional commands for the utility compact.exe include:

  • /C- Compresses user-specified files or folders. Directories will be named in such a way that all new files will also be compressed. Objects with the /EXE parameter will be excluded.
  • /U- Unpacks specified files. Directories are marked so that files added later will not be compressed. If the /EXE option is specified, only files compressed as executable files will be unpacked; if this parameter is omitted, only NTFS compressed files will be unpacked.
  • /S- Performs the specified operation on files in the selected directory and all its subdirectories. The default is the current directory.
  • /A- Displays files with the attributes "hidden" and "system". By default, these files are skipped.
  • /I- Continues to perform the specified operation even after errors occur. By default, the COMPACT program is aborted when an error occurs.
  • /F- Forces compression of all specified files, even if some of them are already compressed. By default, compressed files are skipped.
  • /Q- Displays only the most essential information.
  • /EXE- Uses compression optimized for executable files, which are read frequently and do not change. Supported algorithms: XPRESS4K (fastest, default), XPRESS8K, XPRESS16K and LZX (fastest high degree compression).

There is also a large number of third party applications to compress files and save space, but here we only looked at the tools built into Windows 10.







2024 gtavrl.ru.