Hard link and Soft link Difference Hard Link, Soft Link inode

What is link?
Link is connection between two file
Here there are two links are there Soft link and hard link
Hard link syntax
#ln /absolute-path/original-file /hard-link-file
 [root@localhost /]# ln rhelfile /var/

Soft Link syntax
#ln -s /absolute-path/original-file  soft-link-file

#ln –s
Soft link is also called symbolic link, sym link

Difference between hard link soft link inode link
Difference between Hard link and Soft link
Hard link
1)Links have the original source content.
2)If we delete original file we can get back the data
3)Link inode values are same (what is inode)
[root@localhost /]# ls -i rhelfile
32771 rhelfile

[root@localhost var]# ls -i rhelfile
32771 rhelfile

4)Hard link we can link only file
Link the directory is not possible
[root@localhost ~]# ln rhel/ /var/
ln: `rhel/': hard link not allowed for directory
5)We cat not use hard link in Network File service
6) if the original file is edited it will reflected in the linked file


Soft Link
1) Link has the path of the source file.
2) If we delete the original file of link we can not get it back
#ls –i it will list out list of inode value of file

3) Soft link inode value is different ( what is inode)
4) Soft link we can create the link file and folder
5) Soft link we can use the Network file service
6) it is same like hard link if file is edited it will be reflected


SOFT LINK
HARD LINK
original file is delete(broken), it will show in RED color.
It will present without unchanged
Create the soft link between partition. We were getting lot of advantage production server, if the /opt partition is 100% , then there is no need to worry alert that particular partition. From the another free partition just create the SOFT-LINK.
NOT EFFICIENT
PERMISSION: If we change the permission in original file or soft link it will reflect only to the original file only. soft link remain unchanged with full permission 777.
When we change the permission original file
it 'll automatically reflect to the Hard-link (because i nodes are same between original file and hard link).
Possible for Directory.
Not possible for Directory.


Related post