[CentOS] Re: Reboots -- everything's a file

Fri Jun 3 01:37:12 UTC 2005
James Olin Oden <james.oden at gmail.com>

On 6/2/05, Bryan J. Smith <b.j.smith at ieee.org> <thebs413 at earthlink.net> wrote:
> From: Rodrigo Barbosa <rodrigob at suespammers.org>
> > Actually, there is another neat trick for rpm based systems.
> > You see, rpm, prior to removing anything, will rename that to ${NAME}.OLD.
> > So, libc.so.6 becomes libc.so.6.OLD, and then removed.
> > As we all know, if that library is currently open by any running process,
> > it won't be imediately removed (even tho you can't see it with a 'ls').
> > The trick is pretty simple: lsof | grep OLD
> > That, of course, only aplies if you are doing everything using RPM
> > (yum, redhat-update, apt-get).
> 
> That's because open file handles work in inode number, not filename.
> So you can rename things out-of-the-way for existing file handles,
> while creating a new file that will be opened for any new ones.
> 
You can also remove them, and the kernel won't reclaim the files
blocks until all filehandles to that inode are closed.  RPM mainly
does this to provide some saftey net in the case of power outages and
unforseen kernel panics/hangs (they happen) that might occur during an
upgrade.  No guarantees here, just some bread crumbs (read rpm does
not provide ACID concerning the upgrade of your system [or its
rollbacks if you use that feature]).
 
Cheers...james