- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- creating a link file for lvm commands
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
09-05-2011 03:41 AM
09-05-2011 03:41 AM
creating a link file for lvm commands
Hi All,
In my Unix box i created a link file which is pointing to /usr/sbin/lvdisplay
# ln -s /usr/sbin/lvdisplay /tmp/test
# ll | grep -i test
lrwxrwxrwx 1 root sys 19 Sep 5 06:32 test -> /usr/sbin/lvdisplay
# ./test
test: Error, "test" is not a valid LVM command.
I created a hard link also, but then also i got the same error.
Then i tried to linka file to the path of hostname...
# ln -s /usr/bin/hostname /tmp/new
[rx260-01]/tmp
After this when i executed /tmp/new i got the hostname
# /tmp/new
rx260-01
The Unix verision is 11.23.
Can you please tell me why its behaving like this..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2011 04:43 AM - edited 09-05-2011 04:52 AM
09-05-2011 04:43 AM - edited 09-05-2011 04:52 AM
Re: creating a link file for LVM commands
>In my HP-UX box I created a link file which is pointing to /usr/sbin/lvdisplay
Why do that? Don't. What does "ll -i /usr/sbin/lvdisplay" show?
>Can you please tell me why its behaving like this?
Only the obvious, most likely there are multiple commands all hardlinked to one executable and the wrong name falls off the switch to the error case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2011 05:56 AM
09-05-2011 05:56 AM
Re: creating a link file for LVM commands
Hi,
Thanks for the reply
# ll -i /usr/sbin/lvdisplay
518 -r-sr-xr-x 33 root sys 1329404 Mar 17 2008 /usr/sbin/lvdisplay
[rx260-01]/tmp
#
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2011 06:00 AM
09-05-2011 06:00 AM
Re: creating a link file for LVM commands
># ll -i /usr/sbin/lvdisplay
> 518 -r-sr-xr-x 33 root /usr/sbin/lvdisplay
As I suspected, there are 33 different commands in that one executable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2011 06:03 AM
09-05-2011 06:03 AM
Re: creating a link file for LVM commands
Hi:
There are 33 different hard links to the executable. As Dennis said, this is a classic way of offering one executable that when it runs, evaluates the *name* by which it was called to decide what functionality to invoke. The LVM commands have long used this paradigm.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2011 06:16 AM
09-05-2011 06:16 AM
Re: creating a link file for LVM commands
Hi All,
Thank for the update, but sorry i didn t understand by "There are 33 different hard links to the executable"...
Can you please explain me ......
Thanks
Laiju
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2011 06:24 AM - edited 09-05-2011 06:38 AM
09-05-2011 06:24 AM - edited 09-05-2011 06:38 AM
Re: creating a link file for LVM commands
@223848 wrote:Thank for the update, but sorry i didn t understand by "There are 33 different hard links to the executable"...
Review the manpages for 'ls(1)' to appreciate what it is that the output you posted says.
Do you understand what a hard-link is? The LVM binaries are hard-links to a common piece of code.
http://en.wikipedia.org/wiki/Hard_link
Hard links differ from soft (symbolic links) so be sure to understand what they are:
http://en.wikipedia.org/wiki/Symbolic_link
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2011 06:25 AM - edited 09-06-2011 12:30 AM
09-05-2011 06:25 AM - edited 09-06-2011 12:30 AM
Re: creating a link file for LVM commands
>"There are 33 different hard links to the executable".
>> 518 -r-sr-xr-x 33 root /usr/sbin/lvdisplay
33 is the (hard) link count. If you look for inode with value of 518, you should find them all:
find /usr/sbin -inum 518 -exec ll -i +
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2011 12:18 AM
09-06-2011 12:18 AM
Re: creating a link file for LVM commands
Hi All,
Thanks a lot for the information
What i understood is..
I checked and found that all lv and vg related commands have same inode that means,, eventhough we are using the diffenret commands its executing a common script..
As we can wee 33 hardlinks are there ,
Eventhough if im creating an additional soft link or hard link with a new name ( in our scenario /tmp/test) then also when im executing with the new link (/tmp/test) , it will cehck whether i used any of the above 33 names ..
Whether my concept is clear .....
Regards
Laiju.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2011 12:28 AM
09-06-2011 12:28 AM
Re: creating a link file for LVM commands
>even though we are using the different commands, it's executing a common script.
This isn't a script, it's a binary executable.
(Though the same trick can be used for scripts.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2011 12:34 AM
09-06-2011 12:34 AM
Re: creating a link file for LVM commands
Hi Dennis and James,
Thanks a lot for your kind time for teaching me :)
Regards
Laiju