|
willsort
元老会员
         Batchinger
积分 4432
发帖 1512
注册 2002-10-18
状态 离线
|
『楼 主』:
[讨论]关于系统的文件夹压缩
使用 LLM 解释/回答一下
To All:
很早就注意到,在Windows系统目录下,类似“$NtUninstallKB885835$”的更新程序卸载备份文件夹的名字是蓝色的,只是一直无暇追究其中的缘由,想来不过是彰显文件夹的某些特殊属性而已。
最近,开始清理系统盘空间,偶然发现在这些蓝色名字的目录有个奇怪的特性,即在右键属性菜单中的常规选项卡中,文件的<占用空间>总是小于文件的<实际大小>,而这与我脑中的占用空间比不小于文件大小的常规知识向矛盾。
因为在FAT和NTFS文件系统中,文件以簇的形式占用磁盘空间,文件大小的不规则导致它很可能无法将所使用的簇恰好占满,而某些簇中的剩余空间因为无法收集而被废弃,因此文件的占用即为文件所用簇的占用空间,它必然是1024或其他大小(XP为4096)的整数倍,也因此它必然大于等于文件的实际大小。
不解之余,上百度搜索答案,不久即赧然一笑,却原来是压缩后的文件夹,使用的乃是属性菜单常规选项卡“高级”选项对话框中的“压缩”功能。所有使用“压缩”的文件或文件夹名字均为蓝色,既已压缩,占用空间小于实际大小的谜底也就揭开了。
但是不久,新的疑惑就接踵而来,我做了一些简单的测试:如果将这个压缩文件(夹)复制到其它目录下,则不再具有压缩特性;如果将这个压缩文件(夹)移动到其它目录下,则压缩特性保留;而如果将这个压缩文件(夹)复制后再移动的相同的目录下,则移动特性消失。由此移动结果推断,“压缩”应属于文件或文件夹自有的一种“属性”,但它却为何无法通过复制进行传递?
另外的一些测试表明,此种压缩的压缩率很低,一个2M的文本文件压缩后还有1.8M,而使用WinRAR可以压到0.8M,而它对使用WinRAR压缩过的文件会自动选择不再压缩,依此推测系统的压缩算法是牺牲压缩率来换取压缩速率。
还有的一点发现,或者说“未发现”,就是系统的解压过程对于我所测试的任何测试都是透明的,即使是在CMD或者COMMAND环境下,也可以正确无误的浏览压缩后的文本文件。没有在DOS下测试,因为是NTFS卷,若使用外部驱动支持,就无法真正得知其是否完全透明了,因为我无法断定,NTFS的DOS驱动是否也会透明的解压。而且在Windows下找到它的压缩后的“原始状态”似乎更有意义。
Last edited by willsort on 2006-3-23 at 21:06 ]
To All:
I've long noticed that in the Windows system directory, the names of update program uninstall backup folders like "$NtUninstallKB885835$" are blue. I just never had time to find out why, thinking it was just to highlight some special properties of the folder.
Recently, when I started cleaning up space on the system drive, I accidentally noticed a strange feature in these blue-named directories: in the General tab of the right-click Properties menu, the <Occupied Space> of the file is always smaller than the <Actual Size>, which contradicts my usual knowledge that occupied space is not smaller than file size.
Because in FAT and NTFS file systems, files occupy disk space in clusters. The irregular file size means it may not exactly fill the used clusters, and some remaining space in clusters is discarded because it can't be collected. So the occupied space of a file is the occupied space of the clusters it uses, which must be an integer multiple of 1024 or other sizes (4096 for XP), so it must be greater than or equal to the actual size of the file.
After being confused, I searched on Baidu and soon smiled in embarrassment. It turned out to be a compressed folder, using the "Compress" function in the Advanced option dialog of the General tab in the Properties menu. All files or folders using "Compress" have blue names, and the mystery that occupied space is smaller than actual size is solved.
But soon, new doubts followed: I did some simple tests: if I copy this compressed file (folder) to another directory, it no longer has the compressed feature; if I move this compressed file (folder) to another directory, the compressed feature is retained; and if I copy and then move this compressed file (folder) to the same directory, the moved feature disappears. From the movement results, "Compress" should be a kind of "attribute" of the file or folder, but why can't it be transferred through copying?
Other tests show that this kind of compression has a very low compression ratio. A 2M text file is still 1.8M after compression, while WinRAR can compress it to 0.8M, and it will automatically choose not to compress files compressed with WinRAR. This suggests that the system's compression algorithm sacrifices compression ratio for compression speed.
Another discovery, or "non-discovery", is that the system's decompression process is transparent to any tests I did. Even in the CMD or COMMAND environment, I can correctly browse the compressed text file. I didn't test it under DOS because it's an NTFS volume. If external drive support is used, I can't really know if it's completely transparent because I can't be sure if the NTFS DOS driver will also decompress transparently. And it seems more meaningful to find its "original state" after compression under Windows.
Last edited by willsort on 2006-3-23 at 21:06 ]
|

※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得! |
|
2006-3-23 20:51 |
|
|
Wengier
系统支持
             “新DOS时代”站长
积分 27736
发帖 10521
注册 2002-10-9
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
复制后无法保留压缩属性应该类似Unix下的iNode的特点,如果当复制后就相当于产生了新的数据,与以前的iNode不再相关,所以原有的压缩属性不复存在;而移动则仅仅是将链接指向改变,而iNode仍为原状,所以其压缩属性保持不变。
Copying does not retain the compression attribute, which is similar to the characteristics of the inode under Unix. If after copying, it is equivalent to generating new data, which is no longer related to the previous inode, so the original compression attribute no longer exists; while moving only changes the link pointer, and the inode remains the same, so its compression attribute remains unchanged.
|

Wengier - 新DOS时代
欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/
E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)
 |
|
2006-3-24 00:55 |
|
|
fujianabc
金牌会员
     
积分 3467
发帖 1616
注册 2004-6-21
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
这个压缩功能是伴随着ntfs的出现而产生的,已经有很长的时间了。
ntfs压缩是一种追求速度而不是追求压缩率压缩算法。
记得dos下面的ntfsdos加载时可以选择不支持ntfs压缩。
对于一个ntfs卷,除了ntldr之外的所有文件都可以压缩,但是压了ntldr后则系统无法启动。
如果想看到ntfs压缩之后的“原始状态”,可以用一些磁盘编辑软件察看。
This compression function emerged with the appearance of NTFS and has been around for a long time.
NTFS compression is a compression algorithm that pursues speed rather than compression ratio.
I remember that when NTFSdos is loaded under DOS, you can choose not to support NTFS compression.
For an NTFS volume, all files except ntldr can be compressed, but if ntldr is compressed, the system cannot boot.
If you want to see the "original state" after NTFS compression, you can use some disk editing software to view.
|
|
2006-3-24 11:22 |
|
|
6622186
高级用户
   
积分 894
发帖 411
注册 2007-2-17
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
开始, 我压缩过, 但是发现文件本身并没有变小只是颜色变了, 并且访问透明, 我始终不解, 后来到网上搜索了下, 再右击文件属性, 发现占用空间确实变小了, 才明白其中原委.
At first, I compressed it, but found that the file itself didn't get smaller, only the color changed and it was transparent when accessed. I was always puzzled. Later, I searched online and then right-clicked the file properties and found that the occupied space did become smaller, then I understood the reason.
|

@set c= 不知则觉多,知则觉少,越知越多,便觉越来越少. --- 知多少.
@for,/l,%%i,in,(1,1,55)do,@call,set/p=%%c:~%%i,1%%<nul&ping/n 1 127.1>nul
|
|
2007-4-24 05:27 |
|
|
6622186
高级用户
   
积分 894
发帖 411
注册 2007-2-17
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
NTFS 代表着 NT 的新特性
NTFS stands for the new features of NT
|

@set c= 不知则觉多,知则觉少,越知越多,便觉越来越少. --- 知多少.
@for,/l,%%i,in,(1,1,55)do,@call,set/p=%%c:~%%i,1%%<nul&ping/n 1 127.1>nul
|
|
2007-4-24 05:29 |
|
|
lpk130
初级用户
 
积分 80
发帖 30
注册 2007-4-19
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
NTFS的新特性还包括EFS加密
这些操作对用户来说都是透明的
The new features of NTFS also include EFS encryption. These operations are all transparent to users.
|
|
2007-4-24 05:55 |
|
|
06403213
初级用户
 
积分 42
发帖 21
注册 2007-10-3
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
今天我也发现了这个问题,并且上DOS联盟搜了一下找到了这个帖子,和我理解的也差不多。。压缩是透明的是不是说,压缩以后不用解压还能用啊。。这种磁盘压缩文件的分配单位还是以簇为单位了,及是4096的整数倍。只有压缩文件不遵守。不知道有高手能不能说一下磁盘压缩的技术是什么?实在是不解。
Today I also discovered this problem, and I went to the DOS Union forum to search and found this post, which is also similar to my understanding. Does "compression is transparent" mean that after compression, it can be used without decompression? The allocation unit of such disk compressed files is still based on clusters, that is, multiples of 4096. Only compressed files do not abide by this. I don't really understand. Is there any expert who can explain the technology of disk compression? I'm really confused.
|
|
2007-10-7 02:09 |
|
|