- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to identify the harlink file
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
04-22-2009 11:32 PM
04-22-2009 11:32 PM
How to identify the harlink file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2009 11:41 PM
04-22-2009 11:41 PM
Re: How to identify the harlink file
do you mean a hard link ? If so, then use ls -i and the two files should have the same inode number.
J.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2009 12:09 AM
04-23-2009 12:09 AM
Re: How to identify the harlink file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2009 12:17 AM
04-23-2009 12:17 AM
Re: How to identify the harlink file
There is no difference, except what's in your mind, if you created it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2009 12:49 AM
04-23-2009 12:49 AM
Re: How to identify the harlink file
J.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2009 01:42 AM
04-23-2009 01:42 AM
Re: How to identify the harlink file
both are having same inode number.And if you are making any changes to one of the file the other one also get changed.But if you delete one file the other one will not get deleted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2009 02:08 AM
04-23-2009 02:08 AM
Re: How to identify the harlink file
For a hard link to be created use ln and for softlink use ln -s
by looking at the inode number you can verify whether it is hardlink or softlink
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2009 02:58 AM
04-23-2009 02:58 AM
Re: How to identify the harlink file
Give "ls -l" to se the link file.
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2009 08:31 AM
04-23-2009 08:31 AM
Re: How to identify the harlink file
Hardlink is --
(1)Multiple name given to same data in same file system.
(2)eg
ln /tmp/a /tmp/b
here to check the hard link
cd /tmp
ls -l check ' l ' symbol for b
Regards,
Subodh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2009 06:58 AM
04-24-2009 06:58 AM
Re: How to identify the harlink file
# touch test
# ln test test2
# ls -li test*
98314 -rw-r--r-- 2 pranksterr users 0 2009-04-24 16:51 test
98314 -rw-r--r-- 2 pranksterr users 0 2009-04-24 16:51 test2
# rm test
# ls -li test*
98314 -rw-r--r-- 1 pranksterr users 0 2009-04-24 16:51 test2
the 3rd field right after the permissions in the output of ll/ls -l is the link count.
the -i option tells ls to show the inode numbers too. you can see that after i created a hard link (ln without -s) the link count were 2, and in the first field the inode numbers were matched. just think about it like you have the data on the disk only once, but you have a reference in two places.
after i deleted one of the link, the other remained and the link count were accordingly 1.
and a little note: hard link (without -s) are only allowed in a single filesystem, if you want to have link to another filesystem then you instead must make a symlink with 'ln -s'. (that's because the inode number is only uniqe in a single FS.)
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2009 11:35 AM
04-24-2009 11:35 AM
Re: How to identify the harlink file
In some non-Unix-like filesystems, the primary identifier of a file is its name. A file can have only one "true" name.
In Unix-style filesystems, this is not true.
The primary identifier of a file in Unix is *not* its name, but its inode number. An inode contains the important meta-data for the file, including:
- type (regular file/directory/symbolic link/block device/character device/named pipe/other...),
- owner and group,
- access permissions,
- change times,
- the pointer to the location of the file's data on the disk surface (if any).
If the inode is a device node, it contains the major & minor device numbers instead of the data pointer.
The inode does *not* contain the name of the file.
However, we humans don't like to refer to files by just numbers, so a "directory" is implemented to map the numbers to human-readable names and vice versa. A directory is just a special kind of file, which contains a simple list. Each entry in a directory file contains a filename and its associated inode number.
When a filesystem is structured like this, it allows creating multiple directory entries to one file. *This is what hard-linking is.*
Hard links are based on inode numbers, and inode numbers are guaranteed to be unique only within a single filesystem: this is why hard links cannot span multiple filesystems.
Usually a file has only one hard link pointing to it, and thus a file has only one name. But it is possible to create additional hard links using the "ln" command, or the "link()" system call. These additional links are every bit as true as the first one.
A valid way to move a file from one directory to another (or just rename it) within one filesystem is to first create a new hard link with new name and/or directory location, then remove the old link.
When a file has no hard links pointing to it and no process holding it open, the OS considers the file deleted: it will automatically free the disk space occupied by the file.
If a programmer wants to ensure that his program won't leave any temporary files lying around even if it's terminated abnormally, the programmer can have the program open a temporary file for access and immediately unlink() it. The program is free to read and write to the file, but no other program can access it (without special measures). When the program terminates for any reason, the OS will automatically remove the temporary file.
MK