From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96079058316065.tru64-unix-managers.marc@archive.invalid> From: Sergio Rivera Villarreal Date: Mon, 26 Jul 1999 18:30:17 +0000 To: tru64-unix-managers Subject: SUMMARY: Files unlinked ? X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96079058316065 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary_(ID_Sts5Hqdbe8asZzQ6z3eblg)" This is a multi-part message in MIME format. --Boundary_(ID_Sts5Hqdbe8asZzQ6z3eblg) Content-type: MULTIPART/ALTERNATIVE; BOUNDARY="Boundary_(ID_gc4aANiS7Xw3naS1o+emAQ)" --Boundary_(ID_gc4aANiS7Xw3naS1o+emAQ) Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 8BIT 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 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.
 
  --Boundary_(ID_gc4aANiS7Xw3naS1o+emAQ)-- --Boundary_(ID_Sts5Hqdbe8asZzQ6z3eblg) Content-type: text/x-vcard; name=serriver.vcf; charset=us-ascii Content-description: Card for Sergio Rivera Villarreal Content-disposition: attachment; filename=serriver.vcf Content-transfer-encoding: 7BIT begin:vcard n:Rivera Villarreal;Sergio tel;pager:(151-11-11) 57458 tel;cell:n/a tel;fax:329-40-83 tel;home:384-01-61 tel;work:329-40-81 x-mozilla-html:FALSE adr:;;;;;; version:2.1 email;internet:serriver@ccr.dsi.uanl.mx fn:Sergio Rivera Villarreal end:vcard --Boundary_(ID_Sts5Hqdbe8asZzQ6z3eblg)--