You may be wondering, why do we mount all filesystems if at the beginning it was stated that the partition shouldn't be mounted? In my case, the reason for doing this is that otherwise the system entered in emergency mode after a couple of minutes (while at the same time showing the recovery mode menu superimposed on the screen bottom line, the interface to the system was very buggy at that point, seemed kind of dangerous, and using "Enable networking" was the only way I managed to continue the process. In my case it was several minutes until it returned back to the menu. The screen will begin to show logs and may seem to hang, but just be patient. This enables networking and mounts all filesystems defined in /etc/fstab. In the recovery mode menu, quickly select "Enable networking". In my case, I tried doing all that without rebooting, but systemd or something else wasn't too happy about it, so in the end I had to shutdown by just pressing the power button, as I was kind of locked out of the box.Īnyway, if you reboot too, when the grub screen shows up choose "Advanced options", and then pick the one for "recovery mode". The goal now is logging in as root, dropping to run-level 3 and unmounting the partition that we have to process.
#Recover files in linux install#
Then, install ext4magic, a disk utility to recover files from ext3 or ext4 partitions. If possible, try to close all the programs that may be writing on the same partition. We want to minimize the amount of interactions with the system, so the blocks which contained the deleted files don't get overwritten. Also, don't store the copy of the journal in /tmp, in case it gets cleaned up. dev/sda6 should be the appropriate path to your device, so change it accordingly. Right after deleting the files, open a terminal and make a copy of the filesystem journal: sudo debugfs -R "dump /opt/sda6.journal" /dev/sda6
this procedure assumes that the partition that contained the deleted files is different from the root partition, as that was the scenario with which I had to deal (deleted files were in my home dir).
These notes document the steps I took to get them back. Recently, I deleted some files by mistake in a Ubuntu machine with an ext4 fs. Recovering deleted files in Ubuntu with ext4 filesystem