Recovering Deleted Data on Ubuntu Linux Server

Hi folks!

Got an Ubuntu Linux 12.04.3 LTS server that is acting as a network file server using Samba.

While connected from a Windows machine using a mapped network drive, I accidentally deleted a bunch of files that shouldn't have been. Too many for me to know the exact file names.

Assuming there is not an easy solution, like going to a backup, what is the best way to go about trying to recover or "undelete" these files? I'm a bit of a novice when it comes to Linux file systems.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Testdisk can undelete files in Linux. See here for step-by-step instructions.
IthizarAuthor Commented:
Would you install TestDisk on the server where the deleted files are? That's what the instructions seem to apply, but I always understood you should not do any disk writes on a drive you're trying to recover data from.
No, I would not install it on the same system - I'd run it from a LiveCD or LiveUSB.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

IthizarAuthor Commented:
This is a machine sitting in a data center about an hour away from me, so I'd like to avoid physically going there if I could. :-) Do you know of a way to install and run TestDisk from another partition/location other than a LiveCD? Or, alternatively, do you know of any other product or technique that could be accomplished without physically accessing the server?

Thanks again!
Can you mount the remote drive across the network? Testdisk can work on mounted drives, so you could just install it locally to fix the remote drive.
IthizarAuthor Commented:
Yes, I can. In fact, the machine I'm trying TestDisk from already has this particular share mounted. However, when I run TestDisk, I see nothing in the list of available disks that matches that mount point.

For example, if I run the "mount" command with no parameters, one of the entries I see is this:

//datastore02/mainwwwroot on /network/datastore02/mainwwwroot type cifs (rw,mand)

That is the network share in question. However, when I run TestDisk, I see this:

Select a media (use Arrow keys, then press Enter):
>Disk /dev/sda - 644 GB / 600 GiB - VMware Virtual disk
 Disk /dev/mapper/easynas01-root - 642 GB / 598 GiB - VMware Virtual disk
 Disk /dev/mapper/easynas01-swap_1 - 1073 MB / 1024 MiB - VMware Virtual disk
 Disk /dev/sr0 - 64 MB / 61 MiB (RO) - VMware Virtual IDE CDROM Drive
 Disk /dev/dm-0 - 642 GB / 598 GiB - VMware Virtual disk
 Disk /dev/dm-1 - 1073 MB / 1024 MiB - VMware Virtual disk

(The machine I'm running from is a virtual machine, hence all the VMware Virtual disks.)

From there, how do I get it to look at a mounted drive and do recovery on it?

Since it sees other mounted disks, I was hoping it would work for your network disk. It even sees my encrypted /home, and a mounted TrueCrypt container.

Another option is a tool called foremost. The linked article says the package manager for Ubuntu can install it. I can't test it, since foremost is not in my package manager (openSUSE.) Good luck.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.