Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.


Recover deleted files on Linux server


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Recover deleted files on Linux server

Hi Guys,


Greetings!.




I have executed the cronjob that runs the shell script which is in directory.When the cronjob was executed , I found that the directory where the script resides has got deleted.



Note: The directory was deleted with other use not root user.



The issue is files were not been taken any backup before running cronjob and those are important files .


For the files which need recovery, I followed some links that suggested some steps to find out the files which were lost and recovery process without a need of open source data recovery tools.


In one of the youtube link ,the admin provided some steps to get back the lost files.


As first step, below command needs to be executed :
ps -aux | grep <filename>
Please find the ps command attachment for reference

As an output, I could find the file and process id .



When i go for next step, with the process id and run this: cd /proc/<pid>
I got an error as file not found as shown in proc command attachment:

Can you please suggest the steps to recover the files.




Thank you,
Reminisce
Recover deleted files on Linux server-ps-aux-commandpng
Recover deleted files on Linux server-proc-commandpng
# 2  
Sorry you deleted your directory.

There is no really easy way to recover deleted files on Linux; but some have had success with:

Code:
debugfs

Linux 2.6 - man page for debugfs (linux section 8)
# 3  
Hi Neo,




The files which are deleted on the server is used for testing the applications. So I need to be careful before performing any unmounting process.




As I am new to do these steps to recover the files.


Can you help me with this?



Thanks,
Reminisce
# 4  
The trick is to use a tool to find the inode of the deleted file and then recover it.

So, maybe you should first create a file and note the inode number:

Code:
linux:/tmp# echo 'This is a test' > file.txt
linux:/tmp# ls -li file.txt
8259623 -rw-r--r-- 1 root root 15 Nov 10 06:27 file.txt

Now you have the inode number of file.txt

Next, you need to know what is the name of your filesystem where your file was deleted, perhaps using df -Th or
Code:
mount

if you do not know.

Try the above in the /tmp directory, post back your output and also post back your results and the name of your filesystem (/dev/md2 /dev/sda1 etc)

We will go from there.
# 5  
Thanks Neo.


I have followed the steps one by one as mentioned below:

i. Created the file in /tmp directory
ii. listed inode number of the created file : testk.txt
iii. Used the df -h <deleted dir path>


Code:
[root@ip-XX-XX-XX-XX tmp]# echo "test" > testk.txt
[root@ip-XX-XX-XX-XX tmp]# ls -li testk.txt
12876576 -rw-r--r--. 1 root root 5 Nov 10 12:47 testk.txt
[root@ip-XX-XX-XX-XX tmp]# df -h /home/user
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda2       50G   19G   32G  37% /



Done with the steps. Please suggest the next steps to perform.




Thanks,
Reminisce
# 6  
Before we proceed, we need to know what filesystem you are using.

So, please let us know the filesystem (ext2, ext2, etc) you are using on /dev/xvda2
# 7  
This is the filesystem that is mounted on:
/dev/xvda2 on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota)


I could not see any extension file system in the server .may be its because it is remote server.




Thanks,
Mounika M
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to recover the deleted file in Linux?

hi, i deleted one file from linux please let me know, if we can recover it ? if yes, pls let me know the steps to do.. (3 Replies)
Discussion started by: raghur77
3 Replies

2. Red Hat

Recover deleted files from linux server machine..

Hi, I am working Linux server machine. Somebody by mistake(or may be knowingly) deleted few folders and files from the machine. How is this possible to recover those files and folders????:confused: I normally logged in through Putty and winscp only. And don't have any history for putty... (8 Replies)
Discussion started by: pamu
8 Replies

3. Shell Programming and Scripting

Need to Recover Deleted Files

Hi, By mistake, executed the following command : rm -rf * and ALL files got deleted. But I need to get back these files as they are very very important. Please help me how to recover this file. Its Urgent for me please. Thanks in advance. (6 Replies)
Discussion started by: unx100
6 Replies

4. UNIX for Dummies Questions & Answers

how to recover deleted files in unix

Hi Experts, by mistake i deleted some files that are very important to the project. is there any way that i can recover those files,there is no backup for that but the details of the file we know. This will be a great help. Thanks (5 Replies)
Discussion started by: namishtiwari
5 Replies

5. Shell Programming and Scripting

Is there a way to recover files deleted using rm command???

Hi All, I just mistakingly deleted some files using rm command.Is there a way to get it back?i work on Solaris 10 Thanks, Kumar (1 Reply)
Discussion started by: kumarsaravana_s
1 Replies

6. Linux

recover deleted files from memory stick

I'm running Fedora Core4. I deleted images off of my Sony DSC-P73 digital camera's memory stick. I'm looking for a *nix tool to recover the photos from the memory stick. Does anyone know of such a tool? (2 Replies)
Discussion started by: dangral
2 Replies

7. AIX

recover deleted files

How to recover deleted files in AIX ? (1 Reply)
Discussion started by: vjm
1 Replies

8. UNIX for Dummies Questions & Answers

Recover deleted files

Is there a Unix tool, like in Novell, to recover accidentally deleted files? (2 Replies)
Discussion started by: kuultak
2 Replies

Featured Tech Videos