chris@umcp-cs.UUCP (Chris Torek) (01/15/85)
-- How to Find Links: A Brief Look at the Unix File System From the User's Viewpoint Suppose you are given the following: % ls -li /usr/foo 2076 -rw-r--r-- 3 chris 326 Sep 16 03:23 /usr/foo (In other words, there are three links, and it's inode # 2076). Then you can find out what the full name of those other links are by using /etc/ncheck and/or find. However, just knowing the inode number doesn't tell you everything. The whole truth is that there is another number hiding away in there. It's the ``device number,'' and it tells which disk drive (or whatever) holds the file. There can be any number of inode #2076's, as long as each one is on a different drive (or different piece of a drive, but let's just ignore that for now). You can find out which file system /usr/foo is in by running df or /etc/mount. Let's suppose it's on /dev/rp0g. If /dev/rp0g shows up as % df Filesystem kbytes used avail capacity Mounted on /dev/rp0g 179423 152202 9278 94% /usr % ls -l /dev/rp0g brw------- 1 root 2, 6 Dec 27 07:17 /dev/rp0g when you do ``df'' and then ``ls -l,'' then it's device number is 2*256+6, or 518. (Another way to find out this same bit of information is to use the ``stat'' system call on the original file /usr/foo.) So if you do a ``find / -inum 2076 -print'' to find every file with inode number 2076, you may find more than three files here. Only three of them will be on rp06, though. If you use /etc/ncheck, then you must give the name of the disk drive, so it will only find the three files for which you are searching. But one of them will be ``/foo,'' because part of the file name is kept elsewhere, and ncheck doesn't look for it. In fact, ncheck does much less work than find, and is therefore much faster. The catch is that you usually need special privileges to run it. -- Tomorrow: The User's Guide to Chewing Gum Disposal :-) -- (This line accidently left nonblank.) In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) UUCP: {seismo,allegra,brl-bmd}!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@maryland