Search code examples
unixinodelsof

lsof showing unlinked file for more than one process


can anyone explain how unlinked file can be held by more than one process? currently I see four processes for the same inode 1543

# /usr/local/bin/lsof +aL1 /dev/vg00/lvol4

Xvnc      20622 p32adm    2u   REG 64,0x40004 4587683840     0 1543 /home (/dev/vg00/lvol4)
vncconfig 20649 p32adm    1u   REG 64,0x40004 4587683840     0 1543 /home (/dev/vg00/lvol4)
vncconfig 20649 p32adm    2u   REG 64,0x40004 4587683840     0 1543 /home (/dev/vg00/lvol4)
xterm     20650 p32adm    1u   REG 64,0x40004 4587683840     0 1543 /home (/dev/vg00/lvol4)
xterm     20650 p32adm    2u   REG 64,0x40004 4587683840     0 1543 /home (/dev/vg00/lvol4)
twm       20651 p32adm    1u   REG 64,0x40004 4587683840     0 1543 /home (/dev/vg00/lvol4)
twm       20651 p32adm    2u   REG 64,0x40004 4587683840     0 1543 /home (/dev/vg00/lvol4)

Solution

  • While there is no particular reason to expect different processes not to share an unlinked file as already answered by Marcus Müller, in your case these files are the processes stdout and stderr.

    I guess these processes all inherited these file descriptors from an original command launched this way:

    Xvnc ... > someLogFile 2>&1
    

    and later, someLogFile was removed to (unsuccessfully) recover space.