Re: disaster recovery - did I do the right thing?

2007-05-08 Thread Ray
On Monday 07 May 2007 11:16 pm, Ian Smith wrote:
snip
 Ray, I've been watching this thread, and you've had some good advice
 about backups etc, but if you really did 'rm -f *' in /usr/local (NOT
 'rm -rf *') then it's very likely that you deleted no files at all.
snip

sorry, should have said
rm -rf  *




 The only file 'rm -f *' in /usr/local would remove here is a comment I
 made for myself with 'touch moved_portsnap_from_var_db'; 'rm *' (with or
 without -f) does not remove directories (unless you also use -r).

 I can't say what was in _your_ /usr/local, but I've just checked on 4.8,
 4.10, 5.5-STABLE and 6.1-RELEASE systems, and none of them install plain
 files in /usr/local at all, just directories.  So you may be lucky ..

This was a postmortem question, by the time I'd posted, I'd already 
reinstalled from scratch. The machine wasn't in production yet and I had made 
good notes on paper, so It wasn't the end of the world.
Ray


 Cheers, Ian

 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to
 [EMAIL PROTECTED]
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: disaster recovery - did I do the right thing?

2007-05-08 Thread Bernd Trippel
Martin Tournoij typed on 06/05/07 05:23:
 On Sat 05 May 2007 18:05, Garrett Cooper wrote:
 Martin Tournoij wrote:
 On Sat 05 May 2007 17:05, Ray wrote:
 Hello all,
 I did something stupid the other day (sleep deprivation combined with a 
 clever hack were the main reasons), and I'm just curious if I did 
 the right thing afterwards.

 The mistake:
 /usr/local/# rm -f *
 note that root was running bash as a shell at the time, found in 
 /usr/local/bin or something.

 What I did was to start over, reinstall from scratch.
 my question, was there an easier way?
 thanks,
 Ray 
 You can use pkg_info -ga to check for missing files in your packages.
 For (t)csh:
 alias rm rm -i

 For (ba)sh:
 alias rm=rm -i

 Now that you've learned :).

 Martin's suggestion is good though -- would have done that considering that 
 all that lived in /usr/local were ports.

 -Garrett
 
 The problem with this is that it will ask confirmation for every file it
 deleted.
 Which is gets pretty annoying after a while, also, if you delete a
 directory containing a 100 files, you will have to press 'y' a 100
 times.
 This will probably lead to the habit of using 'rm -f', and/or simply
 pressing y all the time without actually looking at the confirmation
 message.
 In any case, it's not likely to prevent any such accidents.
 
For the sake of it: You could use rm -I:
quoting the rm man page:
-I  Request confirmation once if more than three files are being
removed or if a directory is being recursively removed.
This is a far less intrusive option than -i yet provides almost
the same level of protection against mistakes.

Output looks like this:
# rm -fI *
remove 10 files?

Would even be better if it would list e.g. 2 or 3 files.

 A better solution would be to write a script that would move files
 instead of deleting them.
 You should name this script to something else than rm, when you're
 working with a new or foreign system, you will expect rm to move
 files, instead of deleting them ... and we can all see another
 disaster coming there...

true, sometimes fingers have a memory of their own ;)
 
 Another hint would be the 'rmstar' option in tcsh, when set, tcsh will
 ask confirmation before executing 'rm *'.
 
 Note that aliasing 'cp' and 'mv' to 'cp -i' and 'mv -i' is an
 *extremely* wise idea, in the past I have often accidentally overwritten
 files that should not have been overwritten, leading to various
 problems.
 

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: disaster recovery - did I do the right thing?

2007-05-07 Thread Wojciech Puchar


The mistake:
/usr/local/# rm -f *
note that root was running bash as a shell at the time, found
in /usr/local/bin or something.

What I did was to start over, reinstall from scratch.
my question, was there an easier way?


yes.

do

rm -rf /var/db/ports

and then install all needed ports, as base system was untouched
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: disaster recovery - did I do the right thing?

2007-05-07 Thread Wojciech Puchar

What I did was to start over, reinstall from scratch.
my question, was there an easier way?


Sure, just restore what you need from those backups you have
so diligently been making --- :-)


the best solution :)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: disaster recovery - did I do the right thing?

2007-05-07 Thread Jeff Palmer

At 07:05 PM 5/5/2007, Ray wrote:

Hello all,
I did something stupid the other day (sleep deprivation combined with
a clever hack were the main reasons), and I'm just curious if I did the
right thing afterwards.

The mistake:
/usr/local/# rm -f *
note that root was running bash as a shell at the time, found
in /usr/local/bin or something.

What I did was to start over, reinstall from scratch.
my question, was there an easier way?
thanks,
Ray



Ray,

Good quality backups are a must.  Even a filesystem snapshot would 
have helped in the above scenario.


http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/snapshots.html
The link above has great info about creating and using filesystem 
snapshots.   If you had one,  you could have just mounted the 
snapshot,  and copied over the files/folders you accidentally removed.


Jeff

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: disaster recovery - did I do the right thing?

2007-05-07 Thread Ian Smith
On Sat, 5 May 2007 17:05:42 -0600 Ray [EMAIL PROTECTED] wrote:

  Hello all,
  I did something stupid the other day (sleep deprivation combined with 
  a clever hack were the main reasons), and I'm just curious if I did the 
  right thing afterwards.
  
  The mistake:
  /usr/local/# rm -f *
  note that root was running bash as a shell at the time, found 
  in /usr/local/bin or something.
  
  What I did was to start over, reinstall from scratch.
  my question, was there an easier way?

Ray, I've been watching this thread, and you've had some good advice
about backups etc, but if you really did 'rm -f *' in /usr/local (NOT
'rm -rf *') then it's very likely that you deleted no files at all.

paqi% ll -rt /usr/local
total 134
drwxr-xr-x3 root  wheel512 Feb  9  2006 VFS
-rw-r--r--1 root  wheel  0 Aug 27  2006 moved_portsnap_from_var_db
drwxr-xr-x3 root  wheel512 Dec  3 22:31 src
drwxr-xr-x8 root  wheel512 Dec 10 17:17 www
drwxr-xr-x7 root  wheel512 Dec 10 19:34 libdata
drwxr-xr-x2 root  wheel512 Dec 10 19:52 build-1
drwxr-xr-x9 root  wheel512 Dec 10 21:59 libexec
drwxr-xr-x2 root  wheel512 Dec 10 22:14 env
drwxr-xr-x2 root  wheel   2048 Dec 10 22:53 info
drwxr-xr-x6 root  wheel512 Dec 10 23:23 gnu-autotools
drwxr-xr-x7 root  wheel512 Dec 27 16:33 diablo-jre1.5.0
drwxr-xr-x3 root  wheel  25088 Jan 28 01:36 bin
drwxr-xr-x   83 root  wheel   1536 Feb 11 22:37 share
drwxr-xr-x  139 root  wheel  24064 Feb 12 18:35 include
drwxr-xr-x   33 root  wheel  55296 Feb 12 18:35 lib
drwxr-xr-x   27 root  wheel   1536 Feb 12 18:38 etc
drwxr-xr-x2 root  wheel   1024 Mar  3 20:53 sbin
drwxr-xr-x3 root  wheel512 Mar 29 23:20 portsnap
drwxr-xr-x   28 root  wheel   1024 May  5 04:22 man

The only file 'rm -f *' in /usr/local would remove here is a comment I
made for myself with 'touch moved_portsnap_from_var_db'; 'rm *' (with or
without -f) does not remove directories (unless you also use -r).

I can't say what was in _your_ /usr/local, but I've just checked on 4.8,
4.10, 5.5-STABLE and 6.1-RELEASE systems, and none of them install plain
files in /usr/local at all, just directories.  So you may be lucky .. 

Cheers, Ian

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: disaster recovery - did I do the right thing?

2007-05-05 Thread Martin Tournoij
On Sat 05 May 2007 17:05, Ray wrote:
 Hello all,
 I did something stupid the other day (sleep deprivation combined with 
 a clever hack were the main reasons), and I'm just curious if I did the 
 right thing afterwards.
 
 The mistake:
 /usr/local/# rm -f *
 note that root was running bash as a shell at the time, found 
 in /usr/local/bin or something.
 
 What I did was to start over, reinstall from scratch.
 my question, was there an easier way?
 thanks,
 Ray 

You can use pkg_info -ga to check for missing files in your packages.

-- 
Regards,
Martin Tournoij
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: disaster recovery - did I do the right thing?

2007-05-05 Thread Garrett Cooper

Martin Tournoij wrote:

On Sat 05 May 2007 17:05, Ray wrote:

Hello all,
I did something stupid the other day (sleep deprivation combined with 
a clever hack were the main reasons), and I'm just curious if I did the 
right thing afterwards.


The mistake:
/usr/local/# rm -f *
note that root was running bash as a shell at the time, found 
in /usr/local/bin or something.


What I did was to start over, reinstall from scratch.
my question, was there an easier way?
thanks,
Ray 


You can use pkg_info -ga to check for missing files in your packages.



For (t)csh:
alias rm rm -i

For (ba)sh:
alias rm=rm -i

Now that you've learned :).

Martin's suggestion is good though -- would have done that considering 
that all that lived in /usr/local were ports.


-Garrett
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: disaster recovery - did I do the right thing?

2007-05-05 Thread Jerry McAllister
On Sat, May 05, 2007 at 05:05:42PM -0600, Ray wrote:

 Hello all,
 I did something stupid the other day (sleep deprivation combined with 
 a clever hack were the main reasons), and I'm just curious if I did the 
 right thing afterwards.
 
 The mistake:
 /usr/local/# rm -f *
 note that root was running bash as a shell at the time, found 
 in /usr/local/bin or something.
 
 What I did was to start over, reinstall from scratch.
 my question, was there an easier way?

Sure, just restore what you need from those backups you have 
so diligently been making --- :-)

jerry

 thanks,
 Ray 
 
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: disaster recovery - did I do the right thing?

2007-05-05 Thread George
On Sat, May 05, 2007 at 06:10:36PM -0700, Garrett Cooper wrote:
 Martin Tournoij wrote:
  On Sat 05 May 2007 17:05, Ray wrote:
   The mistake:
   /usr/local/# rm -f *
   note that root was running bash as a shell at the time, found 
   in /usr/local/bin or something.
   
   What I did was to start over, reinstall from scratch.  my
   question, was there an easier way?
  
  You can use pkg_info -ga to check for missing files in your
  packages.
 
 For (t)csh:
 alias rm rm -i
 
 For (ba)sh:
 alias rm=rm -i

Or for more fun and amusement:

touch -- /usr/local/-i

Unfortunately, the OP explicitly used the -f switch, so the alias
suggestions wouldn't have helped.  

Personally, I'd recommend learning from the mistake (we've all done at
least once) and being more judicious when entering commands,
particularly any 'force' switches, and making regular use of dump(8).
That would avoid circumvent the possibility of developing the unwelcome
habit of typing 'rm -f' to compensate for the increased level of
interaction if aliasing 'rm -i'.  Which may be why the OP got into
trouble.




___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: disaster recovery - did I do the right thing?

2007-05-05 Thread Martin Tournoij
On Sat 05 May 2007 18:05, Garrett Cooper wrote:
 Martin Tournoij wrote:
 On Sat 05 May 2007 17:05, Ray wrote:
 Hello all,
 I did something stupid the other day (sleep deprivation combined with a 
 clever hack were the main reasons), and I'm just curious if I did 
 the right thing afterwards.
 
 The mistake:
 /usr/local/# rm -f *
 note that root was running bash as a shell at the time, found in 
 /usr/local/bin or something.
 
 What I did was to start over, reinstall from scratch.
 my question, was there an easier way?
 thanks,
 Ray 
 You can use pkg_info -ga to check for missing files in your packages.
 
 For (t)csh:
 alias rm rm -i
 
 For (ba)sh:
 alias rm=rm -i
 
 Now that you've learned :).
 
 Martin's suggestion is good though -- would have done that considering that 
 all that lived in /usr/local were ports.
 
 -Garrett

The problem with this is that it will ask confirmation for every file it
deleted.
Which is gets pretty annoying after a while, also, if you delete a
directory containing a 100 files, you will have to press 'y' a 100
times.
This will probably lead to the habit of using 'rm -f', and/or simply
pressing y all the time without actually looking at the confirmation
message.
In any case, it's not likely to prevent any such accidents.

A better solution would be to write a script that would move files
instead of deleting them.
You should name this script to something else than rm, when you're
working with a new or foreign system, you will expect rm to move
files, instead of deleting them ... and we can all see another
disaster coming there...

Another hint would be the 'rmstar' option in tcsh, when set, tcsh will
ask confirmation before executing 'rm *'.

Note that aliasing 'cp' and 'mv' to 'cp -i' and 'mv -i' is an
*extremely* wise idea, in the past I have often accidentally overwritten
files that should not have been overwritten, leading to various
problems.

-- 
Regards,
Martin Tournoij
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: disaster recovery - did I do the right thing?

2007-05-05 Thread Ray
On Saturday 05 May 2007 9:23 pm, Martin Tournoij wrote:
 On Sat 05 May 2007 18:05, Garrett Cooper wrote:
  Martin Tournoij wrote:
  On Sat 05 May 2007 17:05, Ray wrote:
  Hello all,
  I did something stupid the other day (sleep deprivation combined with a
   clever hack were the main reasons), and I'm just curious if I did
   the right thing afterwards.
  
  The mistake:
  /usr/local/# rm -f *
  note that root was running bash as a shell at the time, found in
   /usr/local/bin or something.
  
  What I did was to start over, reinstall from scratch.
  my question, was there an easier way?
  thanks,
  Ray
  
  You can use pkg_info -ga to check for missing files in your packages.
 
  For (t)csh:
  alias rm rm -i
 
  For (ba)sh:
  alias rm=rm -i
 
  Now that you've learned :).
 
  Martin's suggestion is good though -- would have done that considering
  that all that lived in /usr/local were ports.
 
  -Garrett


Thanks, I'll keep that in mind, but there had better not be a next time. 
(anybody have a source for one of those nice white jackets with the really 
long sleeves, just in case? ;)   )

 The problem with this is that it will ask confirmation for every file it
 deleted.
 Which is gets pretty annoying after a while, also, if you delete a
 directory containing a 100 files, you will have to press 'y' a 100
 times.
 This will probably lead to the habit of using 'rm -f', and/or simply
 pressing y all the time without actually looking at the confirmation
 message.
 In any case, it's not likely to prevent any such accidents.

 A better solution would be to write a script that would move files
 instead of deleting them.
 You should name this script to something else than rm, when you're
 working with a new or foreign system, you will expect rm to move
 files, instead of deleting them ... and we can all see another
 disaster coming there...

 Another hint would be the 'rmstar' option in tcsh, when set, tcsh will
 ask confirmation before executing 'rm *'.

 Note that aliasing 'cp' and 'mv' to 'cp -i' and 'mv -i' is an
 *extremely* wise idea, in the past I have often accidentally overwritten
 files that should not have been overwritten, leading to various
 problems.


good ideas, and I may use some of them,
but wouldn't have helped in this case. I _wanted_ to erase all the files in 
this directory (I thought). Due to a softlink and name confusion (a clever 
hack) I wasn't in the directory I thought I was.
You live, you learn.
Ray

-- 
Regards,
Martin Tournoij
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]