Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I got a panicked call for help from a mate who's been tinkering with a Raspberry Pi. Turns out it auto-updated his install of Raspbmc (RPi-build Debian with XBMC over the top, for non-RPi-fanatics) when he turned it on, and it wasn't until it'd finished that he realised he'd left his external hard drive plugged into it. He didn't think much of it at the time, not knowing (as most sysadmins should) that drives left connected during a Linux OS install are liable to be overwritten with the distro's filesystem. When the drive wouldn't read, he called his technically-minded friend... me. I'm not much of a Linux user, though (I dabble, but nothing advanced) and this is a little beyond my experience. Can anything be done, or is his data lost?

share|improve this question

closed as off topic by Michael Hampton, ewwhite, Chris S Oct 3 '12 at 14:26

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

Well, this happens with Debian installs, anyway. It is by no means a Linux thing. – Michael Hampton Oct 3 '12 at 13:22
possible duplicate of Recover overwritten filesystem – Michael Hampton Oct 3 '12 at 13:26
While Michael's suggestion may help, this question is essentially Off-Topic for Server Fault as we only work with Professional System Administrators in the course of their Job. If you need more help with this than the Answer below, please take a look at Unix & Linux. Thank you! – Chris S Oct 3 '12 at 14:27

It would be difficult to recover as any automated recovery will discover the new fs. However the data is there and because ext4 is using extents the data of the same file would tend to be in the same extent.

I would first make an image of the drive and use a VM that will mount that image with discard option (when you shutdown the VM the image will remain unchanged). Recover to a network drive, FTP... You will need some infrastructure for all of this, but is the safest way.

Some tools to consider:

See also:

share|improve this answer
Was just writing almost this exact thing, and you beat me to it :D – Steve Oct 3 '12 at 13:24
You can create an answer with more details or better ways to do it. – Mircea Vutcovici Oct 3 '12 at 13:33
you have it pretty much covered – Steve Oct 3 '12 at 13:36

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