Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We are running Ubuntu server on VPS. Some files were removed accidentally by placing unnecessary space this command:

rm -r /usr/local <directory to be deleted>

I know, that in most cases this directory is used by packages to place some part of their content.

Is there any where to recover deleted files and directories?

I suppose, that theoretically it should be possible. Some software can look through the list of installed packages, check presence of files in file system and recover or reinstall corrupted packages if their files are missing in /usr/local.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Per Debian (and therefore Ubuntu) policy packages should never use /usr/local/ for anything.

If a package did use it you could find out by using debsums -s to find missing files.

If you don't want to install debsums you could simply do:

grep '/usr/local/' /var/lib/dpkg/info/*.list

On my Debian laptop (with plenty of stuff installed) this shows no results, exactly as you'd expect.

/usr/local is used for locally installed binaries and scripts, and for those you should have backups.

share|improve this answer
    
Thanks for encouraging answer! There were no any errors since then. So I should say that nothing important was deleted. And as for you advise. Yes, *.list files don`t contain records about files in /usr/local. Your reply answered my question: packages do not use /usr/local, so there is no way to recover anything using package management utilities if something was deleted in this folder. Make backups! –  Ilya Apr 2 '10 at 10:39

Check out ext3grep. It's not as easy as MS-DOS undelete used to be in the old days, but it has helped me out once.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.