Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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 accidentally installed Ubuntu to one of my data drives from Windows. The drive was a NTFS drive and contained about 80 GB of important data. The size of the drive is 110 GB. Its new file system is ext4.

In an attempt to recover the data, I downloaded foremost and tried the following commands:

foremost -i / -o /media/281C8DB01C8D7998/Recovery/ -T -v
foremost -i /dev/sda7 -o /media/281C8DB01C8D7998/Recovery/ -T -v

(sda7 is the drive in question.)

It appears that with either command, foremost gets stuck reading some file. Here is the console output:

abhi@abi-PC:/dev$ foremost -i /dev/sda7 -o /media/281C8DB01C8D7998/Recovery/ -T -v
Foremost version 1.5.7 by Jesse Kornblum, Kris Kendall, and Nick Mikus
Audit File

Foremost started at Fri Sep 28 20:58:00 2012
Invocation: foremost -i /dev/sda7 -o /media/281C8DB01C8D7998/Recovery/ -T -v 
Output directory: /media/281C8DB01C8D7998/Recovery_Fri_Sep_28_20_58_00_2012
Configuration file: /etc/foremost.conf
Processing: stdin
File: stdin
Start: Fri Sep 28 20:58:00 2012
Length: Unknown

Num  Name (bs=512)         Size  File Offset     Comment 


As you can see I have to kill it from system monitor. This approach does not seem to be working. What else could I try to recover the files?

Please help. The files are very important and I will be devastated if I cannot recover them.


Some more information:

abhi@abi-PC:~$ sudo fdisk -l /dev/sda
[sudo] password for abhi: 

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x4f3e2fb9

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sda2          206848   205004799   102398976    7  HPFS/NTFS/exFAT
/dev/sda3       205004800   512409599   153702400    7  HPFS/NTFS/exFAT
/dev/sda4       512411646   976771071   232179713    f  W95 Ext'd (LBA)
/dev/sda5       512411648   731011071   109299712    7  HPFS/NTFS/exFAT
/dev/sda6       731013120   734136319     1561600   82  Linux swap / Solaris
/dev/sda7       734138368   976771071   121316352   83  Linux
share|improve this question
Does dev/sda7 even exist? I have a hard time believing you "accidentally overwrote" the 6th partition (sda4 doesn't count). You should probably add the output of sudo fdisk -l /dev/sda – RobotHumans Sep 28 '12 at 15:50
@aking1012, thank you for your response. Please check the edit. – Abhijit Gavas Sep 28 '12 at 15:57
I'm guessing you should boot from optical. You can't run recovery tools on mounted partitions – RobotHumans Sep 28 '12 at 16:10
If it is a different physical drive you can unmount it via GUI or terminal, both will result in the drive to be available for data recovery. Even so, I agree with @aking1012 that you can run the recovery more safely if running from live CD/USB boot. – Geppettvs D'Constanzo Sep 28 '12 at 16:28

Parts of this answer comes from: Is there any recovery software available for ext4?

If you formatted the hard disk drive you may wish to use Testdisk in order to recall the previous partition table and recover some data. Testdisk also allow you to recover individual files. Check it out at Please inform if you have tried Testdisk. And take a look at previous testdisk references like those mentioned in the next links:

Best tool to recover removed files

Formatted and lost 6 years worth of photo memories.. any way to get this back?

How to recover Ubuntu partition after computer failure?

Where the answers of some other people under those questions may also be helpful for you.

Good luck!

P.S. Forensic procedures like foremost is the last step. Try first Testdisk.

share|improve this answer
Thank you for the answer. I have not tried testdisk. I will try it and report back. – Abhijit Gavas Sep 28 '12 at 15:55
You're very welcome. I'll be around in order to follow your question closely just in case that you need some additional support. – Geppettvs D'Constanzo Sep 28 '12 at 15:57

Your Answer


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.