LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 07-12-2006, 12:16 PM   #1
blames
LQ Newbie
 
Registered: Oct 2004
Location: Boulder, Co
Distribution: Redhat WS4
Posts: 17

Rep: Reputation: 0
Unhappy accidentally 'rm -rf' on /


Ok.. this was a silly mistake but I caught it quickly and stopped it before deleting my entire system. I was having hard drive issues and went into linux rescue mode to try and use fsck. I was following some instructions online in which I created a directory "rootpartition" and I was in the process of mounting my system under this dir. About half way through I remembered that my system was already mounted under "sysimage" so, insted of unmounting all of my partitons from "rootpartition" dir I proceeded to use "rm -rf" to remove the dir and realized within about 5 seconds that I was actually deleting my root partition. I then looked into "sysimage" to see what I deleted it appeared that the "rm -rf" command had only begun deleting files in "/etc" (so I think). When rebooting into linux rescue it could no longer find any linux partitions. As well, I tried reinstalling linux but it did not find any linux distros on my machine. When I use qtparted within the "system rescueCD" it does not recognize my harddrive. Is there anyway to rebuild the system without losing any data?

Thanks in advance for any solutions.

blaine
 
Old 07-12-2006, 12:45 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,118
Blog Entries: 54

Rep: Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785
Is there anyway to rebuild the system without losing any data?
You mean any *more* data ;-p If you run a distro that can verify package contents (md5/sha1sum) and your package database is still complete then yes, you can selectively restore much of the system to a default state. Else you still can but that looks more like a reinstall. What distro do you run (fill in your user profile)?
 
Old 07-12-2006, 12:52 PM   #3
blames
LQ Newbie
 
Registered: Oct 2004
Location: Boulder, Co
Distribution: Redhat WS4
Posts: 17

Original Poster
Rep: Reputation: 0
What distro do you run (fill in your user profile)?
Thanks for the reply. I am currently running Redhat WS4 on this machine. Can this distro verify package contents? and if so How do I go about selectively restoring the system?
thanks
 
Old 07-12-2006, 01:35 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,118
Blog Entries: 54

Rep: Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785
Can this distro verify package contents?
Yes. Try "rpm -Va --noscripts 2>&1 > /tmp/rpmva.log".
It may run for a while so either use "screen" or background it.


How do I go about selectively restoring the system?
We'll script that around the output in /tmp/rpmva.log. Best not post that file because it will be HUGE: upload it to a webspace we can browse to to get it. * If you really really can't (free webspace is easy to find) then bzip2 the file. If the bzipped result is LESS than 3000kB you're invited to attach it in an email to me.
 
Old 07-12-2006, 01:44 PM   #5
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 1,995

Rep: Reputation: 292Reputation: 292Reputation: 292
You might be able to restore some stuff to it's default state using methods described above, but that's the kicker. "Restore to DEFAULT states." If you have made customizations, and certainly you have (think "/etc/password", etc.), most all of that will be under /etc and that's what you said you determined was wiped out. Unfortunately, /etc is basically your system's "identity" - i.e., what makes it different from every other Linux system out there. That's a bad thing to wipe out.

I'm afraid without backups to restore from, you're in for a large amount of major brain-bashing work that will ultimately end in failure. Maybe you got lucky and you only deleted one or two inconsequential files, but I sure wouldn't count on that. 5 seconds of "rm -rf /" doesn't sound like something that would only hit one or two files to me. I would expect hundreds if not thousands of files and directories to potentially be affected.

I would go for a complete reinstall and reconfiguration of the OS if I were you. And I'd tightly integrate a backup/restore plan into the new installation. It may be a bit late now, but before reinstalling, backup everything you still have left. You may be able to use some of this to reconfigure your OS after the reinstall.
 
Old 07-12-2006, 03:40 PM   #6
blames
LQ Newbie
 
Registered: Oct 2004
Location: Boulder, Co
Distribution: Redhat WS4
Posts: 17

Original Poster
Rep: Reputation: 0
RE: UnSpawn
i'm not really sure where to begin any of this. The current issue is that linux rescue does not find any linux partitions, nor does qtparted. When I put disc 1 of the isntallation in the drive it as well does not recognize any linux OS installed. After a few more steps I select to partition manually and I can see the different partitions as they were, but they contain no labels. I am unable to name them accordingly.
Other notes: When attempting to boot normally I get the following:

Uncompressing Linux.. OK, booting the kernel.
Red Hat nash version 4.2.1.6 starting
ata2: disabling port
Reading all physical volumes. This may take awhile...
Found volume goup "VolGroup00" using metadata type lvm2
8 logical volume(s) in volume group "VolGroup00" now active
INIT: version 2.85 booting
INIT: No inittab file found

Enter runlevel:


My keyboard is not recognized so I cannot enter in a runlevel to continue. I just have to shutdown the machine.

Thanks
 
Old 07-12-2006, 04:11 PM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,118
Blog Entries: 54

Rep: Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785
The current issue is that linux rescue does not find any linux partitions
It appears I misread your OP where you already said the partitions aren't recognisable which is bad. Before giving in and going with haertig's reinstall advice, have a look at the directions given in the RHEL4 SAG Basic System Recovery because it also handles situations where partitions aren't automagically mounted. Start halfway down the page at "If you selected Skip, you can still try to mount a partition".
 
  


Reply

Tags
deleted, etc


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accidentally deleted GRUB oryhara Linux - General 3 06-09-2006 05:23 PM
accidentally formatted drive jb1390 Linux - Hardware 8 12-31-2005 01:47 PM
help: accidentally overwrote on crontab auden Slackware 1 02-14-2005 06:40 AM
Accidentally deleted /etc/init.d .. what do i do? :| waste Linux - General 5 03-04-2004 03:39 AM
accidentally deleted /etc/profile tanbetien Fedora 2 11-21-2003 09:42 PM


All times are GMT -5. The time now is 11:49 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration