LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 06-21-2010, 04:32 AM   #1
ashok.g
Member
 
Registered: Dec 2009
Location: Hyderabad,India
Distribution: RHEl AS 4
Posts: 215

Rep: Reputation: 32
Retrieve deleted directory


Hi folks,
I deleted a symbolic link file. That deleted the source directory also.
Is there a way to retrieve the deleted directory?
I found a link for this. But I am unable to unmount the file system as there is only one partition /dev/hda1.

Can anyone give some good solution to getback my deleted directory?
 
Old 06-21-2010, 05:23 AM   #2
DrLove73
Senior Member
 
Registered: Sep 2009
Location: Srbobran, Serbia
Distribution: CentOS 5.5 i386 & x86_64
Posts: 1,118
Blog Entries: 1

Rep: Reputation: 129Reputation: 129
Create backup of entire partition before any attempt.

Use LiveCD to retrieve lost files, choose not to mount found filesystem when asked or unmount after automatic mount.
 
Old 06-21-2010, 05:39 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
In addition to what was said already: what did the deleted directory contain? System or user-owned files? Did you make backups? If the OS only contains one partition (your /dev/hda1) then keeping it running causes voluntary and involuntary disk reads and writes. This quickly diminishes chances for recovery. If you have not made backups and if the directory contained user-owned files then it would be best to immediately shut down the machine, attach external storage and boot from a Live CD like HELIX or KNOPPIX and work from there (photorec, testdisk). Until you are ready shut down the machine, do not let it be used in the meanwhile and use another machine to do research (searching LQ will yield threads like this) D/L and burn the ISO if needed.
 
Old 06-21-2010, 06:17 AM   #4
fruttenboel
Member
 
Registered: Jul 2008
Location: Tilburg NL
Distribution: Slackware 14.2 ciurrent, kernel 3.18.11
Posts: 270

Rep: Reputation: 48
Quote:
Originally Posted by ashok.g View Post
Hi folks,
I deleted a symbolic link file. That deleted the source directory also.
Is there a way to retrieve the deleted directory?
I found a link for this. But I am unable to unmount the file system as there is only one partition /dev/hda1.

Can anyone give some good solution to getback my deleted directory?
I hope you make regular backups... But I have the feeling you did not.

My experience with Linux is that a removed tree is hard to get back. There's no undelete like in DR-DOS.

I regularly run a simple backup script that puts all the volatile data (i.e. no photo's, films and music) in a tar file in /Backup. If I now accidentally loose a tree or a trunk, I just consult the tar file in /Backup and get back as much as I can.

This is my script:

Code:
#! /bin/sh

if (! rm /Backup/BeBackup.tar 2> /dev/null 1> /dev/null)  then
   echo No /Backup/BeBackup.tar file found.
fi
   
tar cf /Backup/BeBackup.tar /home --exclude=Keep/* --exclude=Cache/* --exclude=jpg/*
Be (short for Beryllium) is the name of the machine. BeBackup is the backup fle.

The script will include all of the /home tree except

- all files in the 'Keep/' directories,
- all files in 'Cache' directories (your webbrowsers)
- all files in 'jpg/' directories

This won't retrieve the files you lost yesterday, but it'll save your future.

I'd better learn from your experience and make a cronjob that makes daily backups towards /Backu and regularly burn a CD or DVD...
 
  


Reply



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
How to retrieve deleted files saurabh_s2 Linux - Newbie 3 08-20-2009 12:45 AM
How to retrieve deleted files kumary Linux - General 3 01-26-2006 08:45 AM
I deleted some files, how do i retrieve it? novkhan Linux - General 4 10-31-2004 02:57 PM
how to retrieve deleted file in linux? markhod Linux - Software 4 09-08-2004 10:29 AM
Acidentally deleted /var/www anyway to retrieve it? lucastic Linux - Software 1 12-28-2003 04:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 10:05 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
Open Source Consulting | Domain Registration