4
There are several questions about how to undo an rm -r
command, however in this specific case I have an exfat formatted partition / hard disk, rather than, for example, and ext4/ext3 formatted disk.
The disk is an external disk, and so as I haven't written anything to the disk since running the rm -r
command, the data should be fully recoverable. (Nothing should have been over-written.)
So a brief summary of what I did was:
- I have an external 2TB disk, which I use to backup my data for a particular project.
- I tried to copy that data to a NAS by plugging in the external disk (via USB) and running a
cp -r
command to copy data. - I didn't realize that where I was copying the data to wouldn't have enough free space. So the
cp -r
command failed reporting not enough disk space. - Since the destination location was my home directory, I ran
rm -r
on the 3 subfolders which were copied from the root of my external disk. - Oops, that
rm -r
command was actually run on the root of my external disk, NOT my home dir.
So I have a partial copy of the data on the disk where my home directory is. Unfortunately this is only about 50 GB of about 1.2 GB...
(By the way if any of the above isn't clear leave a question in the comments and I will clarify.)
I know the names of the 3 subfolders which were on my external drive root.
How can I restore the subdirectory "tree". (I know the data for the files will still be there, but that the data structure which points to the files specifying which folders they are in will have been erased? I think? I'm not 100% sure on how exfat data is formatted on a disk...)
So far I have tried testdisk
. What I have done is a scan for deleted files and folders to a new log file on a local nas disk. Unfortunately this is taking an exceedingly long time, and I think testdisk will just dump all the files it finds into one folder... which is no good because I had many files with the same names in different subfolders on the external disk.
So I have 2 problems:
- By my calculations it will take about half a year to complete the scan. (At the rate it is running now.)
- I think the subfolder heirachy will not be restored and all files will be put into one subfolder in the recovery location.
Questions:
Will testdisk restore the subfolder heirachy or dump everything in a single folder?
Is there a faster method to undo the
rm -r
command which I ran on my exfat formatted external hard disk?
Note that the rm -r
command deleted probably about 1000000 files from the disk... so I guess what I am hoping for is some way to batch undelete large quantities of files?
1For me, testdisk just worked perfectly fine, un-deleting the files in an entire directory tree. Apparently, you can get lucky on exFAT. – Hermann – 2020-01-01T23:43:56.070