I was setting up a new folder to backup my data in google drive and I mistakenly deleted all my files in my hard drive (it's an external hard drive).
rclone sync -u -P -l --fast-list gdrivefolder: /mount/drive/my_folder
when I should have had my local folder first and the remote folder after.
Because the google drive folder was empty, now my local folder looks empty.
I unmonted the drive and tried with extundelete but no luck so far.
I know I should have use the --dry-run option. I usually do, but today I'm not being smart.
Not really. You can restore from a backup or a snapshot as it's all dependent on how you had some backup options on the local file system.
I don't have backup for this data. It's a ext4 partition so I tried extundelete but says there is no undeleted data
When I did the sync this was the output
Transferred: 0 / 0 Bytes, -, 0 Bytes/s, ETA -
Checks: 517 / 517, 100%
Transferred: 0 / 0, -
Elapsed time: 24.5s
But extundelete says there is nothing deleted
$ sudo extundelete /dev/sdb1 --restore-all
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 29808 groups loaded.
Loading journal descriptors ... 0 descriptors loaded.
Searching for recoverable inodes in directory / ...
0 recoverable inodes found.
Looking through the directory structure for deleted files ...
0 recoverable inodes still lost.
No files were undeleted.
So I wonder how rclone deletes files? Is there a general log of rclone to see what it has been deleted?
It's like any delete on the OS so nothing different.
If you didn't run with logging, there would not be any logs.
you might want to use --backup-dir flag to protect against unforeseen problems like accidentally deleting files and ransomware.
What kind of files were they? I've had good success with
photorec recovering photos and videos off corrupted media and it should work equally well with deleted files.
Make sure you don't write anything else to the drive.
Thanks! I have seen photorec but I haven't tried it yet. I have some videos and some plain text file, but I also have binary data that doesn't have header so I was hoping to find something that works with the journal file.
TestDisk, that is from the same developer help me to recover some files, but for some reason after the syncronization made with rclone, Testdisk is not able to recover everything. Although Testdisk says it only works with ext2 partition so that might be the reason.
Photorec doesn't rely on the filesystem unlike Testdisk. It just treats it as blocks of data and recovers what it can. I've used it to recover lots of data from corrupted media (in combination with ddrescue). In fact I managed to recover half the images from an SD card that had been sent of for unsuccessful professional recovery.
Give photorec a try, it will probably recover a different set of files!