1

So I was in the process of creating a ubuntu live USB with the start up disc creator on my Ubuntu 14.04 computer. I meant to format the USB stick that was in my computer but accidentally selected my 256GB External Hard Drive that used to contain every single thing I have ever done on a computer since middle school. 12 years of data gone.

I immediately ejected the drive and have not touched it since. I know that when you delete a file that generally it does not actually get deleted but is made available to be over ridden.

Is it possible for me to unformat my drive?

  • You could try testdisk. Ubuntu has it in the repositories, and here is how to use it: http://www.cgsecurity.org/wiki/TestDisk_Step_By_Step. – mikewhatever Dec 13 '14 at 20:38
  • 1
    I am sure you have a backup of that disk if it was so important --- so the best solution is to recover from the backup. Disks sometime fails on their own (often than you think) after all. Otherwise, look at http://askubuntu.com/questions/286181/how-do-i-recover-my-accidentally-lost-windows-partitions-after-installing-ubuntu and learn to have not one, but two backups at any time. – Rmano Dec 13 '14 at 20:59
  • Unfortunately I do not have backups. I was saving up for a free nas where I can keep backups but I did not have the money yet. – Andrew Pullins Dec 14 '14 at 17:58

2 Answers2

1

Yes, you should be able to retrieve the filesystem as long as you don't continue to write to it. The more stuff you write, the less chance you have of getting your filesystem back, because you'll start overwriting stuff.

You can use the Testdisk software do do these things, but if you've never done it before, you might possibly want to make a backup of your disk before doing so, just to make sure you don't make it worse.

The thing to keep in mind here is to keep calm, don't give up and read the manuals properly. There's very good chances you'll be able to retrieve everything perfectly if you take proper care. Also, if the filesystem turns out to be too damaged to retrieve, you should be able to get all your files back although this might be quite a lot of work. (Without the filesystem, you don't have filenames or directories, but only the file content).

  • How do you make a backup of a drive that has been reformatted? I mean I guess all the data is technically still there but... – Andrew Pullins Dec 14 '14 at 18:03
  • In Ubuntu, a filesystem can have a name such as /dev/sda1. That is the first partition on the first disk. However, you also have /dev/sda. That's the whole disk. If you want to make an exact copy of the whole disk, you can use dd to copy /dev/sda to some file. – Jo-Erlend Schinstad Mar 21 '15 at 02:54
  • Ok I have my drive cloned and I used photorec (something that comes with testdisk) to recover my files. But each file was put in a folder named recup_Dir.1-900 and named each file f00920337.. Is it possible to get back my original file directory and file names? Other wise I have resulted in creating a script iterates through these directories pulls out certain file types and placing them into various folders. Eg .PNG *.jpg >> /backup/photos. – Andrew Pullins Mar 21 '15 at 17:52
  • No, filenames and directories are stored in the filesystem. Testdisk is also able to recover the filesystem in many cases, so you could try that. You can also explore the filesystem without recovering it and save specific files or directories. – Jo-Erlend Schinstad Mar 22 '15 at 01:24
  • How does one do this? – Andrew Pullins Mar 22 '15 at 01:41
  • "testdisk" is another program that's included in the testdisk package. You may wish to consult the manual or perhaps ask a new question about that specifically. I wouldn't be able to provide a good answer in a comment and it wouldn't be productive. – Jo-Erlend Schinstad Mar 28 '15 at 11:12
1

I had a HDD fail on me a few months back and my advice is to clone the drive to back it up before you start with recovery tools, rather than just copying it. Copying will only copy files that are visible and indexed by the file system, whereas cloning will literally copy every sector of data on the drive, including lost/deleted files and 'junk'. I believe there are free/open-source cloning tools available - do a Google search for 'Hiren's Boot Disk', I think that includes one or two.

Time4Tea
  • 295
  • 2
  • 3
  • 14
  • How do you make a backup of a drive that has been reformatted and nolonger "has files"? – Andrew Pullins Dec 15 '14 at 03:07
  • You need to clone it, as I mentioned above. That copies all of the data on the disk, even if the files are lost, broken up or just junk. That way, if you try to recover the disk and screw it up, you can clone your copy and have another shot. – Time4Tea Dec 15 '14 at 04:09
  • Actually, I believe Gparted in Ubuntu can be used to clone partitions. Have a look at the link here: http://computerdoctor-mitchel.blogspot.com/2010/11/using-gparted-to-clone-disc.html. Basically, you will need a blank drive that is at least as big as the partition you want to clone. You'll also need something to boot into so you can access the drives (e.g. an Ubuntu live USB). From there, you should be able to install Gparted and clone the drive. – Time4Tea Dec 15 '14 at 04:09
  • So this is an external drive can I use gparted from my computer without the liveUSB? just connect the two drives? – Andrew Pullins Dec 28 '14 at 18:30
  • Yes, as long as you can access both drives from your computer and you have gparted installed then I believe you should be able to clone partitions from one to the other. – Time4Tea Jan 06 '15 at 19:13