LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-06-2007, 11:53 AM   #1
EnderX
Member
 
Registered: Nov 2006
Posts: 64

Rep: Reputation: 15
How do you restore a file that has been removed via the rm command?


By mistake, I accidentally deleted a set of postgresql .conf files from a linux server I work with. The server is running SuSE 9.2 linux. The textbook I am trying to work with, The Linux Book by David Elboth, does not say how to restore a file that has been removed via rm, although the rm man page does indicate that it is possible. I have copies of the .conf files from another installation of postgres that I might be able to use, but I am not certain that they have the exact same details as the original files; if possible, I would greatly prefer to restore the old ones I accidentally got rid of. Would someone please let me know what command or commands I need to try to do so, or else let me know of another website where I can search for those commands?

Thank you for your consideration,
EnderX
 
Old 02-06-2007, 01:02 PM   #2
kdrlx
Member
 
Registered: Feb 2006
Distribution: Ubuntu Hardy Heron
Posts: 130

Rep: Reputation: 16
Google says -
http://www.ccl.net/cca/software/UNIX...rm/index.shtml
http://servers.linux.com/article.pl?...58230&from=rss
 
Old 02-08-2007, 02:21 AM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by EnderX
By mistake, I accidentally deleted a set of postgresql .conf files from a linux server I work with. The server is running SuSE 9.2 linux. The textbook I am trying to work with, The Linux Book by David Elboth, does not say how to restore a file that has been removed via rm, although the rm man page does indicate that it is possible. I have copies of the .conf files from another installation of postgres that I might be able to use, but I am not certain that they have the exact same details as the original files; if possible, I would greatly prefer to restore the old ones I accidentally got rid of. Would someone please let me know what command or commands I need to try to do so, or else let me know of another website where I can search for those commands?

Thank you for your consideration,
EnderX
If you didn't modify them from what they were like
you could just take the originals from wherever you
installed from. Most linux-filesystems per se do not
provide an undelete facility. For ext2 there are some
tools, for others grep and knowing the files content
may be able to locate and manually restore them.


Cheers,
Tink
 
Old 02-08-2007, 09:50 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by EnderX
The textbook I am trying to work with, The Linux Book by David Elboth, does not say how to restore a file that has been removed via rm, although the rm man page does indicate that it is possible.
Perhaps you are referring to this--from man rm:
Quote:
Note that if you use rm to remove a file, it is usually possible to recover the contents of that file. If you want more assurance that the contents are truly unrecoverable, consider using shred.
In this context, "recoverable" means using special-purpose tools and a moderate dose of patience.
The intent of the message in man rm is that rm is not a secure erase.
 
Old 02-08-2007, 11:48 AM   #5
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
First thing you should do is take the server off-line to prevent the system from overwriting the disk areas that contain the files you wish to recover.. or unmount the volumes containing that data. Those volumes should only be mounted as read only until the data is recovered, or images of the partitions have been made. it's usually not a bad idea to make TWO copies of the partition using dd. One copy to use for doing the restore work, and one copy in case you mess up the image you are working on the restore from.. it's best not to do your recovery work directly on the live system..

You would then need to use some of the Linux forensics tools to locate and recover the data.

Some of the LIVE forensics CD's would be a good place to start..
FIRE, HELIX or a similar forensic distribution.
http://www.livecdlist.com/?pick=All&...ics&sort=&sm=1


Alternately you can pull out your backup tape and restore the files from backup..........
Server in a commercial environment you must have backups right ?
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C: stdio.h mistakenly removed, how to restore ? Darwish Programming 3 10-17-2005 01:56 AM
I accidentally removed the netstat command ! markraem Solaris / OpenSolaris 6 10-03-2005 11:18 AM
Bloated file which can't be removed... Imerion Linux - General 5 09-16-2005 10:44 AM
$#!% passwd file removed, how do I log in as root? BrianK Linux - General 6 08-19-2004 03:23 PM
Restore command chuck77 Linux - General 2 03-26-2002 08:37 PM


All times are GMT -5. The time now is 08:44 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration