[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [rm -rf *] how does recursive work?




--- "Bruce M. Walker" <bmw@borderware.com>
> wrote:
>Horacio wrote:
>> The question is: does recursive
>> start working alphabetically from the latest directory and file?
>
>In each directory it opens "." and walks through the tree in the
>order it finds files/folders in there.  See opendir(3), dir(5).
>
>To see what that order would be for a given directory, eg "/", just
>use "ls -f" (unsorted).  Eg:
>
>  $ ls -f -1 /
>  tmp
>  var
>  usr
>  home
>  altroot
>  bin
>  dev
>  etc
>  mnt
>  root
>  sbin
>  stand
>  .cshrc
>  .profile
>  bsd
>  sys
>  boot
>
>on my box.
>
>So "rm -rf /" would have nuked the contents of /tmp first...
>
>-bmw

I hate to admit that I did something so incredibly
mind-bogglingly stupid, but, I accidently did a
rm -rf on /. This was on a Alpha Unix 5.0 machine
but it is very BSD like in its behaviour. I instantly
hit Ctrl-C as fast as I could. I looked everything
over fairly well and nothing seemed to have been 
deleted. Nothing under root and definitly nothing
under tmp. The OS seemed to run fine and everything
seemed normal. However, when I rebooted, my machine
would hang and refused to boot. No big deal I thought.
I had two hard drives in the machine and I knew there
was nothing on the second one I needed. So I installed
the OS on the other drive and would just mount the
other drive after boot. No such luck. The other drive
had been using Advanced File System and not UFS.
After much pain and agony I discovered that Advfs uses
a hidden partition to store a database about the file-
system and file domains. This is what had been whacked.
I was SOL big time. This transaction log in this hidden
partition will not show up in any ls or find you care
to try, however it was the first thing destroyed.
Maybe OBSD works differently but I am not going to be
repeating this experiment any time soon. 
Good luck.

Bob Dog.
(Still kicking myself for being such a dumba**)

_____________________________________________________________
Visit these sites today
Blink 182 Fan Site - www.blink182.co.nz
NZ Skateboarding - www.nzskate.com