一些命令

Linux硬连接

zhibo posted @ Nov 12, 2010 04:29:08 AM in LinuxNote with tags linux hard-link symbolic-link , 1533 readers

连接分为两种形式:一种是类似于Windows中的快捷方式,一个文件名指向另外一个文件名;一种就是硬连接(也叫实际连接),是两个文件名同时连接到一个实际文件。

一般情况下使用硬连接创建连接文件时,磁盘空间与inode数量都不会变。因为硬连接只是在某个目录的block下添加一个关联数据而已,而一般情况下硬连接占用的数据量很小,所以不会消耗block数量。

文件的名称记录在目录的block中,文件的inode号记录在inode中,文件的实际内容记录在文件的block中。也就是说文件的访问过程是:

  • 获取目录的inode;
  • 根据inode在目录的block中查找要访问的文件名(文件名很多,估计会用到查询算法什么的),据此找到文件的实际inode号;
  • 根据这个inode号去文件的block读取文件实际内容;

文件的占用空间是指占用的block数*block大小,所以一般会比文件实际大小要大。

 

[root@localhost tmp]# ls -l
total 72
drwx------ 3 root root  4096 Nov 11 21:29 gconfd-root
drwx------ 2 root root  4096 Nov 11 21:29 keyring-naRKVA
srwxr-xr-x 1 root root     0 Nov 11 21:29 mapping-root
drwx------ 2 root root  4096 Nov 11 21:29 orbit-root
drwx------ 2 root root  4096 Nov 11 21:29 ssh-LiKLWc2832
drwxr-xr-x 2 root root  4096 Nov 11 01:15 testln
-rw-r--r-- 1 root root 13609 Nov 10 22:34 vboxguest-Module.symvers
drwx------ 2 root root  4096 Nov 11 21:29 virtual-root.0vCGLo

 

从tmp文件下来看,每个目录的大小都是4096,而文件的大小去不再是4096的倍数,可能ls命令下目录显示的都是占用空间大小,而文件显示的是实际大小。(个人猜测…囧)

© Copyright 2011-2013 by Bo Zhi.

Content licensed under the Creative Commons attribution-noncommercial-sharealike License.

Contact me via mail or twitter.

meidir said:
Sep 14, 2022 09:38:40 PM

it is definitely excellent blog site. it is realy info as well as a a really beneficial task. i adore that. Tree removal cost sacramento

 

===================

 

I merely imagined it usually is a perception to write could possibly help anybody ended up being experiencing difficulity looking into nevertheless We are somewhat doubtful only are permitted to placed labels along with details in below. Stump grinding sacramento

 

===================

 

Superb blog post. Any place strikes numerous pressing obstacles of your modern culture. People can not be uninvolved that will those obstacles. The place delivers guidelines together with thoughts. Rather interesting together with handy. Tree services

 

===================

 

Fantastic submit, Many thanks regarding revealing This kind of information. Fantasticly composed write-up, only if almost all people supplied the identical amount of articles when you, the net would have been a greater spot. You should keep writing! what to wear to a pageant as a guest

 

===================

 

I’m encouraged while using surpassing along with preachy list that you just adorn such minor timing. how much to rent a water slide

 

===================

 

This is exactly cold content and additionally i love to read this approach content. your blog is normally terrific while you experience wonderful office personnel into your web page. excellent stating continue. cost to rent inflatable obstacle course

 

===================

 

That is my first time i visit here. I discovered so many interesting stuff in your blog especially its discussion. From the a great deal of comments on your own articles, I suppose I'm not the only person having all the enjoyment here maintain the nice work Fire damage Spokane

 

===================

 

That is my first-time i visit here. I discovered so many interesting stuff in your blog especially its discussion. From the tons of comments on your own articles, I guess I'm not the only person having all the enjoyment here keep up the great work Water slide rentals

 

===================

 

This really is my first-time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments in your articles, I suppose I am not the only one having most of the enjoyment here maintain the great work Bounce house rental

 

===================

 

This really is my first-time i visit here. I found so many interesting stuff in your blog especially its discussion. From the a lot of comments on your own articles, I suppose I'm not the only one having all of the enjoyment here keep up the good work Is SEO worth it in 2022

 

===================

 

This is my very first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the a lot of comments on your articles, I guess I am not the only one having most of the enjoyment here continue the good work seattle flower delivery

 

===================

 

This really is my first time i visit here. I came across so many interesting stuff in your blog especially its discussion. From the a lot of comments in your articles, I guess I am not the only person having all the enjoyment here continue the good work window tint sacramento

 

===================

 

Well-Written article. It will be supportive to anyone who utilizes it, including me. Keep doing what you are doing – can't pause to read more posts. Thanks for the precious help. sell house fast seattle

meidir said:
Sep 15, 2022 10:11:28 PM

Websites is normally bogged off by means of untrue blog without having any substantial subject matter however, the key content was first terrific and additionally sensible all the look at. With thanks just for stating this approach by himself. Download Video tiktok Without Watermark

meidir said:
Sep 15, 2022 10:12:03 PM

I assumed it is usually a preview to post in case others appeared to be having problems getting acquainted with nonetheless We're a little bit hesitant merely i'm permitted to decide to put companies plus covers for listed here. Fiori SAP

meidir said:
Sep 19, 2022 07:01:04 PM

Great Publish, I'm a large believer within publishing remarks upon websites in order to allow weblog authors realize that they’ve additional some thing beneficial in order to the internet! Activities in agadir

meidir said:
Sep 20, 2022 12:37:22 AM

Seriously sturdy, magnificent, fact-filled information and facts listed here. A person's discussions Never need disappoint, and the unquestionably is valid listed in addition. You actually continually make a fun learn. Do you convey to I'm just happy?: )#) Keep updated the nice reports. bodyworks massage

 

========================

 

Seriously sturdy, magnificent, fact-filled information and facts listed here. A person's discussions Never need disappoint, and the unquestionably is valid listed within addition. You actually continually make a fun learn. Can you convey to I'm just happy?: )#) Keep current the nice reports. Descargar APK de apps


Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter