[asterisk-users] HDD FULLL

Tzafrir Cohen tzafrir.cohen at xorcom.com
Tue Feb 24 05:30:12 CST 2009


On Tue, Feb 24, 2009 at 02:40:35AM +0000, Jeff LaCoursiere wrote:
> 
> On Mon, 23 Feb 2009, David fire wrote:
> 
> [snip]
> 
> >
> > cd /<some dir>/<maybe other dir>
> > rm * -r -f
> >
> > PLEASE DONT DO THIS AT THE ROOT DIR OR YOU WILL ERASE ALL THE DISK.
> > CD TO THE TARGET DIRECTORY OR YOU WILL DESTROY YOUR SERVER.
> >
> 
> Nah, you will only get as far as some shared libraries before the system 
> crashes :)

Reminder: what rm does is actually unlink(2). That is: it doesn't remove
a file from the disk. It merely removes one link from the file system to
it. A file is removed only when its reference count is down to 0.

When a program uses a library, the copy of that library is still kept on
the disk. Even if it is unlinked from the filesystem already.

$ echo whatever >file
$ sleep 1000 <file &
[2] 9959
$ rm file

Oh no! What have I done?!

$ cat /proc/9959/fd/0
whatever
$ cp /proc/9959/fd/0 restored
$ ls -l
total 4
-rw-r--r-- 1 tzafrir tzafrir 9 2009-02-24 13:17 restored
$ cat restored
whatever

> 
> Odd syntax you have there.  Most would destroy things with rm -rf * .

The '.' in the end adds some extra power. ;-)


So the bad news are that there is nothing to stop an rm -rf //#. Not 
even when system libraries are deleted.

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir



More information about the asterisk-users mailing list