How to Recover Deleted Files From NTFS in Linux
It can be very frustrating to accidentally delete a file. Fortunately, when you delete a file, the information is not moved anywhere else; the computer is simply given permission to put new information over it. So long as you do not accidentally over-write your file, you may still be able to recover it. Though Linux does not natively use NTFS partitions, it can still recover deleted files from them. It is not a difficult task when you know what tools to use.
Instructions
-
-
1
Figure out which drive you want to undelete the files from. Open a terminal window and enter the following command in it:
sudo fdisk --l
In the output, look for the line that ends with "NTFS" and write down the name at the front of the drive. It looks something like "/dev/sda1."
-
2
Run ntfsundelete to scan the drive by entering the following command into the terminal:
sudo ntfsundelete /dev/sda1
If the name of the drive you wrote down differs from "/dev/sda1" substitute your drive name in that space.
-
-
3
Scan for the deleted files from the NTFS drive. You need to know what type of file you are trying to recover, whether it is a .doc, .txt, .mp3, .jpg or another type. Enter the following command to scan for all of a file type in the drive:
sudo ntfsundelete /dev/sda1 --u --m *.jpg
Substitute the .jpg for whatever file type you are searching, so if you are searching for a .mp3 file, for example, enter this command:
sudo ntfsundelete /dev/sda1 --u --m *.mp3
This scans the drive and then places all of the recovered files into the home folder of your Linux machine.
-
1
Tips & Warnings
If these commands are not installed by default in your particular Linux distribution, you can use a Ubuntu Live CD to recover the file from the NTFS partition with these commands.
There are also some software packages that can recover deleted files from NTFS partitions. Some examples are TestDisk, Trinity Rescue Kit and ntfsclone.
References
Resources
- Photo Credit hard disk in funzione image by Michele Campini from Fotolia.com