Re: Finding Hard Links??
Posted in 1998
On Mon, 6 Jul 1998 rbruenin@my-dejanews.com wrote: > [...] I am running on-line on Dec Alpha with > unix v4.0. I need a way to programatically via shell script to identify the > existing hard links on the system. Ls only shows the soft links and my > limited understanding of the raw devices is that they are created by > establishing a hard link to a disk partition.. So aside from some paper > documentation and existing DB spaces currently used by informix I am looking > for a way via unix that I can identify all the existing hard links. find / ! -type d -links +1 -print Directories always have a link count of 2 plus the number of sub-directories they contain and are unlikely to be interesting. To find related files: find / ! -type d -links +1 -print | xargs ls -li | sort -n If you don't include the '! -type d' condition, use 'ls -lid' to list directories as directories, rather than as their contents. However, you are more likely to use symlinks to the devices than hard links; hard links are tied to a single file system but symlinks can make a connection between two different file systems. Generally, you'll find your links fairly close to the Informix software, but there is no requirement that this is what happens. A single OnLine instance could be set up with one chunk in /file/system/A, another in /B.file.system, and both of these chunks are actually symlinks to two different raw devices in two different logical volumes handled by the logical volume manager, and other more bizarre setups. Yours, Jonathan Leffler (jleffler@informix.com) #include <witticism.h> Guardian of DBD::Informix -- see http://www.perl.com/CPAN