https://access.redhat.com/solutions/2954831
SOLUTION UNVERIFIED - 已更新 2017年十一月15日03:16 -
环境
Red Hat Enterprise Linux 5
Red Hat Enterprise Linux 6
Red Hat Enterprise Linux 7
问题
How to create Hardlinks in Red Hat Enterprise Linux?
How to identify Hard Links?
Difference between soft link and hard link.
决议
- How to identify Hard Links
In case two files displaying the same inode, then these are hard links.
- Find below as an example to create a hard link:
# ln file1 file2
# ls -li
total 20
9962464 -rw-r--r-- 2 guru users 8 Mar 9 file1
9962464 -rw-r--r-- 2 guru users 8 Mar 9 file2
- Difference between soft and hard links:
Soft Links:
Soft Links can be created across file systems.
Soft link has a different inode number than the original file.
On deleting the original file, soft link cannot be accessed.
Soft link needs extra memory to store the original file name as its data.
Source file need not exist for soft link creation.
Can be created on a file or on a directory.
Access to the file is slower due to the overhead to access file.
Hard Links:
Hard links can be created only within the file system.
Hard links have the same inode number as the original file.
On deleting the original file, hard linked file can still be accessed.
Hard links do not need any extra data memory to save since it uses links
Source file should exist.
Can be created only on files, not on directories.
Access to the file is faster compared to soft link.