SUMMARY: Files unlinked ?

From: Sergio Rivera Villarreal <serriver_at_ccr.dsi.uanl.mx>
Date: Mon, 26 Jul 1999 12:30:17 -0600

Many thanks to Mr. Lars Bro for his advices ...
The original message :

          We have an AS-800, DU4.0D with PK 3
     Somebody knows a way to identify a unlinked file in D-Unix, we
     tried with the fuser and the lsof commands but we didnīt get
     nothing...

Conclusion:
     lsof and fuser can tell you that anonumous resources are in use on
that
filesystem.
     Not the name it had - which - I'm afraid would be against the very
definition.

When I enter these commands, I open file "fil" for read on descriptor 7:

$ exec 7<fil
$ echo $$
6584
$

lsof shows the following:

#lsof | grep 6584
sh 6584 lbr cwd VDIR 2506, 707405 8192 14751
/usr/users/lbr
sh 6584 lbr txt VREG 2506, 707405 131072 370
/usr/bin/sh
sh 6584 lbr txt VREG 8, 0 131072 10987
/sbin/loader
sh 6584 lbr txt VREG 8, 0 1634400 28505
/shlib/libc.so
sh 6584 lbr 0u VCHR 6, 3 0t128 6548
/dev/pts/3
sh 6584 lbr 1u VCHR 6, 3 0t128 6548
/dev/pts/3
sh 6584 lbr 2u VCHR 6, 3 0t128 6548
/dev/pts/3
sh 6584 lbr 7r VREG 2506, 707405 0 14351
/usr/users/lbr/fil

When I remove the file:

# lsof | grep 6584
sh 6584 lbr cwd VDIR 2506, 707405 8192 14751
/usr/users/lbr
sh 6584 lbr txt VREG 2506, 707405 131072 370
/usr/bin/sh
sh 6584 lbr txt VREG 8, 0 131072 10987
/sbin/loader
sh 6584 lbr txt VREG 8, 0 1634400 28505
/shlib/libc.so
sh 6584 lbr 0u VCHR 6, 3 0t140 6548
/dev/pts/3
sh 6584 lbr 1u VCHR 6, 3 0t140 6548
/dev/pts/3
sh 6584 lbr 2u VCHR 6, 3 0t140 6548
/dev/pts/3
sh 6584 lbr 7r VREG 2506, 707405 0 14351
/usr
(usr_domain#usr)

lsof shows that the process still has something and that something is
allocated by fileset usr on domain usr_domain.

The command fuser(8) is also able to find the process.

# fuser -c /usr

"unlink a file" is exactly to "remove the relation between the inode and
the
file name". So it would be against the definition if we could find the
name
after unlink. I tried with tag2name, the advfs command that converts an
advfs-inode to a filename:

# /sbin/advfs/tag2name /usr/.tags/14351
/usr/users/lbr/fil

$ rm fil

# /sbin/advfs/tag2name /usr/.tags/14351
tag2name: statfs(/usr/.tags/14351) error; [2] No such file or directory
#

Which correctly tells you that there is no name for that tag any more.

Note that there is a change in fuser(2) between 4.0E and 4.0F

man 2 fuser From 4.0E:

PARAMETERS
  file Specifies the file name.
  flag Specifies one of the following values. If none of the
following
are
            values are specified, the default is to match open files.
            F_FILE_ONLY Matches only file ids.
            F_CONTAINED Provides mount point matching.

fuser_array Specifies the array.

man 2 fuser from 4.0F:

PARAMETERS
  file Specifies the file name.
  flag Specifies one of the following values. If none of the
following
are
            values are specified, the default is to match open files.
            F_FILE_ONLY Matches only file ids.
            F_CONTAINED Provides mount point matching.
*** F_NOLINK Matches deleted files on the mount point
specified by file.
fuser_array Specifies the array.

Whatever F_NOLINK actually means, I think that this option will give you
the
ID's of processes that have done the 'delete' trick.



Received on Mon Jul 26 1999 - 17:35:14 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:39 NZDT