- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Difference between soft and hard links
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2005 09:44 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2005 09:49 PM
12-26-2005 09:49 PM
Re: Difference between soft and hard links
Here is a very good resource about the differences between hard and soft links,
http://linuxgazette.net/105/pitcher.html
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2005 10:04 PM
12-26-2005 10:04 PM
Re: Difference between soft and hard links
"man ln" for more info.
refer to this discussion as well:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=605109
regards.
(p.s. please remember to assign points.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2005 11:36 PM
12-26-2005 11:36 PM
Re: Difference between soft and hard links
The most important.-
Soft links:
They are different files (different inodes).
- If you delete the link, the original file is intact
- If you delete the original file, the link will reference to an unexistant file.
They can transverse file systems.
Hard links:
They are the same file (same inode).
- If you delete any of the files, the remaining file will still point to the data.
They can be created only on the same file system that the file that references.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2005 01:11 AM
12-27-2005 01:11 AM
Re: Difference between soft and hard links
Dear Sathya,
1. The Soft links are different files having different inodes. You can check this by
#ls -li
note the INODE number of the files.
The link(ed) file's content will be have the PATH to the original file. So even if you delete the link, the original file is intact.
2. Hard links are the same file, which has the the same inode( check it with #ls -li).
And one more difference is,
softlink ---> can be made across the filesystems
Hardlink ---> can be made ONLY within a filesystem
With Regards,
Siva.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2005 05:30 AM
12-29-2005 05:30 AM
Re: Difference between soft and hard links
A hard link is basically duplicate entry on the same filesystem. Generally files have one name associated with a inode entry. A hard link is a directory entry with ANOTHER NAME associated with the same inode entry. With a hard link you directly go to the INODE to read/write/execute a file.
make a link do an ls -li on both names and you will find they have same inode entry.
A soft link is also called a symoblic link. A symbolic link points to the real file name location. Since the entry is a pointer, It can point to entries on any filesystem. When accessing a file via a soft link, the system sends you to the real file name, which then directs you to the INODE location to read/write/execute a file.
Rory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2005 04:25 PM
12-29-2005 04:25 PM
Re: Difference between soft and hard links
Can any one of you explain it with the help of a real example which really makes use of this distinction in hard and soft links?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2005 04:32 PM
12-29-2005 04:32 PM
Re: Difference between soft and hard links
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2005 07:09 PM
12-29-2005 07:09 PM
SolutionYou can not link a directory to a another using a hard link
you can link a directory with a soft link.
Traditionally hard
On my system /usr/sbin has the following hardlinks associated with inod 22596
ls -li |grep 22596
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 lvchange
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 lvcreate
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 lvdisplay
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 lvextend
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 lvlnboot
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 lvmerge
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 lvreduce
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 lvremove
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 lvrmboot
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 lvsplit
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 lvsync
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 nomwcsyncd
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 pvchange
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 pvck
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 pvcreate
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 pvdisplay
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 pvmove
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 pvremove
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 vgcfgbackup
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 vgcfgrestore
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 vgchange
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 vgchgid
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 vgcreate
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 vgdisplay
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 vgexport
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 vgextend
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 vgimport
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 vgreduce
22596 -r-sr-xr-x 31 root sys 557056 Nov 14 2000 vgremove
Note that this is the same executable with a different name. This arangement save physical space, because there are not 31 seperate copies of the same same file, but 1 copy with 31 entries. this save space and reduces the type and number of options you need to invoke the using the same name. Traditionally hard links let you put the same file name in different directories, the above example is more common.
ls -ld /opt/java*
lrwxr-xr-x 1 root sys 12 Nov 16 12:26 /opt/java -> /opt/java1.3
lrwxr-xr-x 1 root sys 16
dr-xr-xr-x 4 bin bin 96 Mar 9 2004 /opt/java1.2
dr-xr-xr-x 3 bin bin 96 Mar 9 2004 /opt/java1.3
dr-xr-xr-x 3 bin bin 96 Mar 10 2004 /opt/java1.4
On one of my systems I have 3 version of Java
java1.2, java1.3 java1.4.
We have application that requires java1.3
The applaciation path points to /opt/java which is a soft link to /opt/java1.3.
When the application is upgraded and needs java1.4, I will not have to install java1.4, I only have to change the /opt/java soft link to point ot /opt/java1.4
Hope this helps
rory