1

have totally broken one a Linux device. I can't login in terminal try, and the GUI screen won't come on, even though there is a mouse in tty7 (though that is an unrelated problem). The device is an i386 intel atom netbook running lubuntu (newest version I believe), just one partition for only one OS. It gives long strings of incomprehensible (long and meaningless, not garbage though, actual errors, just extreme panic) error messages when I try to log in, and when I was logged in entered any command. As a result, I could not use ls, cd or so on to get an idea of where precisely it was broken, or reset tty7 to stop aforementioned unrelated problem to try in GUI. When I was logged into tty7, and tried to do anything, it gave error messages about not having a path, just like when I entered commands in terminal tty's.

I know why this happened, though. Due to extreme stupidity, and lack of experience, whilst I was using dd to update, and get working, the live usb version of lubuntu on a usb, (8GB, one partition), I sent it to sda (harddrive) not SDB(usb). I was root. It gave up halfway through. Essentially, I believe I have just partly overidden the hard drive with a live usb lubuntu, and stopped midway through so as it became too broken to run commands anymore.

It is not totally broken, though. It seems capable of giving panicky messages, and displaying the GUI screen. It is only attempts at actually doing anything that fail, for example, accessing log out and shut down options on the GUI. I could not shut down neatly (not without holding down power button), so have not yet decided to, on the grounds I probably won't be able to load it again anyway.

Thankfully, this is an expendable computer, given to me to basically experiment with and break. I've already broken it once or twice, once by catting the hard drive. This time, however, there are some c++ folders in /home/matthew with files I'd rather not use. Is there any way to recover them (the live usb still does not work, but we could get it working using another device)

Sorry about the long (and stupid) question, and losing the files wouldn't be the end of the world. Nevertheless, important lessons about not using root, checking code before running, backing up important files and recording errors aside, is there a way to get my code files back?

1 Answers1

1

There is no "simple" way to do it, and indeed depending on how long it took to get/make those files your best bet is most likely to recreate them. Even if you can do the things below - there is still a chance your data is overwritten and not recoverable.

If you really want to attempt this you need to gain a lot of expertise - to a point where its not very amenable to a SuperUser post - but the starting point would be:

  1. Get another disk and do a bitcopy of the current disk to the new disk.
  2. See if you can ascertain what the original partitioning and filesystem was on the disk (work on the copy of-course). This is often hard-impossible - although you might get a bit lucky with "testdisk" (but probably not).
  3. If you can recreate the partition and the filesystem is appropriate, you might be able to recover parts of the filesystem by rebuilding from an alternative superblock - again, not likely, and depends on the filesystem.

A work-arround, depending on the type of data in the directory, and a whole lot of things would be to just run "photorec" across the raw disk to try and find unfragmented files based on signature - then go through and find what you can use and rename it. The problem is that this only works for known file types, and looses naming information and directory structure, and will recover deleted copies as well, with no obvious way to tell which is the newest file. It also does not work for files where there is disk fragmentation (It works well for recovering photos from a corrupted USB disk)

davidgo
  • 73,366