Re: [OT] Hardlinks and directories



From: "Patrick O'Callaghan" <pocallaghan@xxxxxxxxx>
Sent: Friday, 2010/February/12 16:07


On Fri, 2010-02-12 at 15:40 -0800, Suvayu Ali wrote:
On Friday 12 February 2010 09:19 AM, Mikkel wrote:
On 02/12/2010 09:29 AM, Bruno Wolff III wrote:

lsof would allow you to find the processes that have the files open.
And then
you could kill those processes to release the space. It looks like you
should
be able to get size infomation of these files from lsof as well. So
one
could script looking for processes that have large files open.

You might want to try using the +L1 and the -s options. It will
display the sizes of unlinked (deleted) files.

lsof +L1 -s

I am not entirely clear about this part, how does one end up with an
un-named open file. To simulate the situation I tried to open a text
file with an editor and then removed it with rm. But it doesn't show up
in `lsof +L1' as I was expecting it to. Am I understanding this the
wrong way?

Editors can do funny things with backup files in the interests of
preserving your work. An easier test would be:

cat > foo &
rm foo
lsof +L1 -s

When I do this the "cat" process shows up (and foo is marked as
deleted). You can then reconnect to "cat" (using fg) and write stuff
into the "non-existent" file.

Now name your test file, "kjournald" instead of "foo". It becomes VERY
interesting to delete the process unless you look at the process number
rather than the process name that has the file open.

{^_-}

--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines



Relevant Pages

  • Re: [OT] Hardlinks and directories
    ... An easier test would be: ... cat> foo& ... lsof +L1 -s ... When I do this the "cat" process shows up (and foo is marked as ...
    (Fedora)
  • Re: [OT] Hardlinks and directories
    ... lsof would allow you to find the processes that have the files open. ... file with an editor and then removed it with rm. ... cat> foo & ... When I do this the "cat" process shows up (and foo is marked as ...
    (Fedora)
  • Re: [OT] Hardlinks and directories
    ... cat> foo& ... When I do this the "cat" process shows up (and foo is marked as ... $ lsof +L1 -s ... COMMAND PID USER FD TYPE DEVICE SIZE NLINK NODE NAME ...
    (Fedora)
  • Re: How to grep directories larger than 100 meg?
    ... is getting bigger and bigger, which I do not believe du would find. ... lsof -c cat will list that the /tmp/test is owned by cat but is deleted. ... killing the process owning the file will finally remove the file. ...
    (comp.os.linux.misc)
  • Re: [OT] Hardlinks and directories
    ... cat> foo& ... When I do this the "cat" process shows up (and foo is marked as ... How do you know it doesn't have the edits if you can't open it? ... $ lsof +L1 -s ...
    (Fedora)