ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Linux下源文件创建硬链接后压缩源文件的问题

Linux下源文件创建硬链接后压缩源文件的问题

原创 Linux操作系统 作者:dbasdk 时间:2015-11-27 11:23:17 0 删除 编辑
Linux下源文件创建硬链接后,压缩源文件相当于新增了源文件的压缩版本

测试:
[root@CentOS6 压缩解压测试]# ln hive_test hive_test_hardlink
[root@CentOS6 压缩解压测试]# ll
总用量 124224
-rw-r--r--. 1 root root    20307 9月  17 2014 date1.log
-rw-r--r--. 1 root root    35113 9月  19 2014 date.log
-rw-r--r--. 1 root root     1693 9月  16 2014 date.zip
-rw-r--r--  1 root root 30195232 11月 27 10:48 hive-0.9.0.tar.gz
-rw-r--r--  2 root root 30195232 11月 27 10:50 hive_test
-rw-r--r--  2 root root 30195232 11月 27 10:50 hive_test_hardlink
-rw-r--r--  1 root root   510504 11月 27 10:48 linux-xrdp.rar
-rw-r--r--  1 root root 36005278 11月 27 10:48 mysql-5.6.14.tar.gz
drwxr-xr-x. 2 root root     4096 9月  16 2014 temp
-rw-r--r--. 1 root root      160 9月  16 2014 temp1.zip
-rw-r--r--. 1 root root     1841 9月  16 2014 temp2.zip
-rw-r--r--. 1 root root    20480 9月  16 2014 temp3.tar
-rw-r--r--. 1 root root     3877 9月  19 2014 temp4.tar.gz
[root@CentOS6 压缩解压测试]# du -sh
93M .
[root@CentOS6 压缩解压测试]# gzip -9f hive_test
[root@CentOS6 压缩解压测试]# ll
总用量 124016
-rw-r--r--. 1 root root    20307 9月  17 2014 date1.log
-rw-r--r--. 1 root root    35113 9月  19 2014 date.log
-rw-r--r--. 1 root root     1693 9月  16 2014 date.zip
-rw-r--r--  1 root root 30195232 11月 27 10:48 hive-0.9.0.tar.gz
-rw-r--r--  1 root root 29981818 11月 27 10:50 hive_test.gz
-rw-r--r--  1 root root 30195232 11月 27 10:50 hive_test_hardlink
-rw-r--r--  1 root root   510504 11月 27 10:48 linux-xrdp.rar
-rw-r--r--  1 root root 36005278 11月 27 10:48 mysql-5.6.14.tar.gz
drwxr-xr-x. 2 root root     4096 9月  16 2014 temp
-rw-r--r--. 1 root root      160 9月  16 2014 temp1.zip
-rw-r--r--. 1 root root     1841 9月  16 2014 temp2.zip
-rw-r--r--. 1 root root    20480 9月  16 2014 temp3.tar
-rw-r--r--. 1 root root     3877 9月  19 2014 temp4.tar.gz
[root@CentOS6 压缩解压测试]# du -sh
122M .
[root@CentOS6 压缩解压测试]# ll hive_test_hardlink
-rw-r--r-- 1 root root 30195232 11月 27 10:50 hive_test_hardlink
[root@CentOS6 压缩解压测试]# 

可以看到,压缩后空间占用反而新增了29M,硬链接文件的inode也由2变为1了。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29734436/viewspace-1847767/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-07-02

  • 博文量
    490
  • 访问量
    1388156