Hard Link versus Symbolic Link

Connotation

link: a named connection between a directory and an object.A user or a program can tell the server where to find an object by specifying the name of a link to the object.

Hard Link:记录inode of target 的 一种文件(a separate directory entry in directory)。因此有“the first hard link is established between the directory and the object(IBM).Users and application programs can add other hard links”。应该不能跨文件系统的记录inode吧

Symbolic Link:a soft link,记录path of target(a path name contained in a file)。因此有“when the system encounters a symbolic link, it follows the path name provided by the symbolic and then continues on any remaining path that follows the symbolic link”。考虑如果没有encounter。

Copy:复制与Hard Link不同,它要拷贝inode指向的数据,当然inode就不同了。


Comparsion

ItemHard LinkSymbolic Link
Name resolutionFaster.A hard link contains a
direct reference to the object.
Slower. A symbolic link contains a
path name to the object, which
must be resolved to find the object.
Object existenceRequired.An object must exist in
order to create a hard link to it.
Optional. A symbolic link can be
created when the object it refers to does not exist.呼应上面本质
Object deletionRestricted. All hard links to an
object must be unlinked(removed)
to delete the object
Unrestricting.An object can be
deleted even if there are symbolic
links referring to it.呼应上面存在无影响
Dynamic objects
(attributes change)
Slower. Many of the attributes of an object are stored in each hard link. Changes to a dynamic object, therefore, are slower as the number of hard links to the object increases.Faster.no affect
Static objects
(attributes do not
change)
Faster. (equals to Name resolution)Slower(equals to Name resolution)
Scope严格,不能跨文件系统可以跨文件系统


Linux command about link

ls –i #查看inode

ln    #默认创建hard link,目标不可以是目录,可以是文件列表,目的可以是目录,这样没有指定名字的话,就原名。

ln -s #创建 symbolic link

unlink #remove

rm    #remove

touch #change file timestamp


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值