Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Recover directory structure after "rm -rf *"

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
lego
Posts: 56
Joined: 2008-01-09 09:43

Recover directory structure after "rm -rf *"

#1 Post by lego »

Hi,

Unfortunately, I deleted my /home/ directory by running "rm -rf *" accidentally. The partition (/dev/sda3/) has an ext3 filesystem. After deleting the /home directory, I shutted down the PC and rebooted from a RIPLinux liveUSB, which has some tools that allowed me to recover some files. However, what I would like to do is to recover the directory tree structure, rather than the files, in order to see which files I deleted.

What I exactly want is the following:
I would like to have the output of "ls -lR /home/" before deleting all the files, but the problem is that now the /home directory is empty.

I hope I have explained clearly what I would like to do, I still have to improve my english.

Any help would be much appreciated!!

User avatar
Telemachus
Posts: 4574
Joined: 2006-12-25 15:53
Been thanked: 2 times

Re: Recover directory structure after "rm -rf *"

#2 Post by Telemachus »

lego wrote:Hi,

Unfortunately, I deleted my /home/ directory by running "rm -rf *" accidentally. The partition (/dev/sda3/) has an ext3 filesystem. After deleting the /home directory, I shutted down the PC and rebooted from a RIPLinux liveUSB, which has some tools that allowed me to recover some files. However, what I would like to do is to recover the directory tree structure, rather than the files, in order to see which files I deleted.

What I exactly want is the following:
I would like to have the output of "ls -lR /home/" before deleting all the files, but the problem is that now the /home directory is empty.

I hope I have explained clearly what I would like to do, I still have to improve my english.

Any help would be much appreciated!!
If I understand you correctly, you can't get what you want.

You seem to want a directory listing for your home directory before you deleted everything. Since none of us (?!) have a home directory that looks exactly like yours, I don't think we can help. (If you wanted to know, say, the basic layout of /etc in Debian, someone could help with that, as a counter-example.)

Home directories begin life empty (or very nearly so - a few Bash configuration files are probably there by default), so I think only you can determine what it looked like - from memory or backups (if you have any).
"We have not been faced with the need to satisfy someone else's requirements, and for this freedom we are grateful."
Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System

lego
Posts: 56
Joined: 2008-01-09 09:43

Re: Recover directory structure after "rm -rf *"

#3 Post by lego »

So you say it is impossible? I hope it isn't, I am searching for recovery tools and I am trying them. I can recover some files, but what I want is the directory listing.

I also thought that recover deleted files after "rm -rf *" was impossible, but in fact it IS possible!
I hope that recover the directory list is possible.

Any ideas?

User avatar
frostschutz
Posts: 68
Joined: 2010-05-10 22:56

Re: Recover directory structure after "rm -rf *"

#4 Post by frostschutz »

If you were using slocate / updatedb on that system, 'locate /home' could give you a listing of the files it found in the last iteration. The only other thing you could try would be backup superblocks but most likely they'll already be updated to the new situation (home deleted)... especially if you did a clean shutdown and, later, another readwrite mount, so that's grasping at straws that are not there...

Rethink your backup strategy...

lego
Posts: 56
Joined: 2008-01-09 09:43

Re: Recover directory structure after "rm -rf *"

#5 Post by lego »

frostschutz wrote:If you were using slocate / updatedb on that system, 'locate /home' could give you a listing of the files it found in the last iteration. The only other thing you could try would be backup superblocks but most likely they'll already be updated to the new situation (home deleted)... especially if you did a clean shutdown and, later, another readwrite mount, so that's grasping at straws that are not there...

Rethink your backup strategy...
That's exactly what I need!!
I have mounted the partition in read-only mode (though its better to have a backup copy of the partition before mountion it, p.ex. with dd), and "locate /home/ > list.txt" gave me the list which I was loking for.
However, this list may be quite outdated.
I'll play with dbugfs and try to improve the output that I need..

Thank you frostschutz!

Post Reply