Re: File Not seen but the Unused space is decreasing

From: Bill Thompson (bill.thompson@GOODYEAR.COM)
Date: Thu Sep 12 2002 - 07:31:18 EDT


Praveen,

The rm command simply removes a file's directory entry it does not actually
delete the file. If a file is open by a process and you delete the file the
process will continue to write data to the disk, you just can't get at it
anymore. You must stop the process before the disk space will be freed up.

Here's a little more technical explanation taken from "UNIX Power Tools"...

24.3 Unlinking Open Files Isn't a Good Idea

[Some programmers write programs that make temporary files, open them, then
unlink (remove) each file before they're done reading it . (45.10) This
keeps other people from deleting, reading, or overwriting a file. Because
the file is opened by a process, UNIX removes the file's directory entry
(its link) but doesn't actually free the disk space until the process is
done with the file. Here's why you shouldn't do that. (By the way, the
point Chris makes about system administrators cleaning up full filesystems
by emptying open files is a good one.)]

To give people another reason not to unlink open files (besides that it
does, er, "interesting" things under NFS (1.33)), consider the following:

multi 1000 </usr/dict/words >/tmp/file1

(multi is a program that makes n copies of its input; here n is 1000.) Now
suppose /tmp (21.2) runs out of space. You can:

rm /tmp/file1 # oops, file didn't actually go away
ps ax # find the "multi" process
kill pid # get rid of it

or you can:

/dev/null

cp /dev/null /tmp/file1 # now have some time to fix things up

Bending the example a bit, suppose that /tmp runs out of file space and
there are a bunch of unlinked but open (45.20) files. To get rid of the
space these occupy, you must kill the processes holding them open. However,
if they are ordinary files, you can just trim them down to zero bytes.

There is one good reason to unlink open temporary files: if anything goes
wrong, the temporary files will vanish. There is no other way to guarantee
this absolutely. You must balance this advantage against the disadvantages.

Bill Thompson
Sr UNIX Systems Administrator
The Goodyear Tire & Rubber Co.

Contains Confidential and/or Proprietary Information
May Not Be Copied or Disseminated Without Express Consent of The Goodyear
Tire & Rubber Company.

AIX-L Archives: http://marc.theaimsgroup.com/?l=aix-l&r=1&w=2

----- Original Message -----
From: "Praveen Kumar K (TSE-IFT-ITPL)" <praveenkumark@VYSBANK.COM>
Newsgroups: bit.listserv.aix-l
To: <aix-l@Princeton.EDU>
Sent: Thursday, September 12, 2002 5:31 AM
Subject: File Not seen but the Unused space is decreasing

> Hi,
> We have an application running on AIX. During one of the process
the
> application generates a file,which was unfortunately deleted while the
> application the file was being updated..From next moment onwards we
started
> observing that the free space in the File system is getting reduced but
the
> file is not being seen...Can someone throw some light on this and give me
> the probable reason for this...
>
> Thanx in advance
>
> Praveen.K
>
-----------------------------------DISCLAIMER------------------------------------

> This Message and any attachments (the "message") is intended solely for
the
> addressees and is confidential. If you receive this message in error,
please
> delete it and immediately notify the sender. Any use not in accord with
its
> purpose, any dissemination or disclosure, either whole or partial,
> is prohibited except formal approval. The internet cannot guarantee the
integrity
> of this message. Vysya Bank (and its subsidiaries) shall (will) not
therefore
> be liable for the message if modified.
>



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:12 EDT