Today making some clean of a filesystem with mc being root I deleted by error 2 directories I didn’t want to delete. ( I know, I know, I must have been more careful)
They weren’t very important, of course I have backups of almost everything, but I want to try to recover for two reasons:
- just in case there were something important i’m missing
- To learn about recovering just in case I need it in the future
I was deleting the this directories (mc warned me “are you sure yo want to delete all?” YES… “are you sure yo want to delete them recursively?” YES >:( )
the it begun to delete. Actually I wanted to delete all of them except these two. When I realized I have selected the two wrong directories I stop the deleting but they were already erased.
I unmounted the filesystem (the were in a filesystem mounted on /data ) and then begun trying to recover them.
The filesystem is in /dev/sda2 in the same disk I have my root filesystem ( my root filesystem is /dev/sda6 ) and my home
I’ve been reading about recovering. One useful tool seems to beextundelete.
I tried to install it in opensuse but
andromeda:/home/fernando/tmp/extundelete-0.2.4 # ./configure Configuring extundelete 0.2.4 configure: error: Can't find ext2fs library
I guess I would have fixed the error but I’m a bit lazy today so I booted my system with System Rescue CD which has extundelete installed, I mounted my root partition /dev/sda6 in order to recover the directories into it and then
#extundelete --restore-directory /musica /dev/sda2 NOTICE: Extended attributes are not restored. Loading filesystem metadata ... 801 groups loaded. Loading journal descriptors ... 32436 descriptors loaded. Searching for recoverable inodes in directory /musica ... 66317 recoverable inodes found. Looking through the directory structure for deleted files ... 66299 recoverable inodes still lost.
So It restore SOME of the files in the directory and none of the directories inside it.
Then I tried with the other
NOTICE: Extended attributes are not restored. Loading filesystem metadata ... 801 groups loaded. Loading journal descriptors ... 32436 descriptors loaded. Searching for recoverable inodes in directory /software ... 66317 recoverable inodes found. Looking through the directory structure for deleted files ... 66317 recoverable inodes still lost. No files were undeleted.
Less luck. No file nor directory recovered.
I have used testdisk and photorec sometimes to recover files from SD cards. So I tried
# testdisk /dev/sda2
But It seems IOt try to use a complete disk and /dev/sda is my root disk so I went no further.
I will continue testing and I will report any success. Anyhow seems to be a hard work. Better be careful in the future.