1

Yesterday I decided to upgrade from 16.04 LTS to 20.04 LTS. I have my home directory on a different partition. The upgrade to 18.04 went smooth, and the upgrade to 20.04 was well underway when the power went down and trouble started. First I had grub problems, but after I got that fixed I had some trouble with reading things from my former /home directory.

In my /etc/fstab I have the line that mounts the drive correctly: UUID=xxxxxxxxxxxxxxxxxxxxxx /home ext4 defaults 0 2 And in fact I can see the folders that should be there in my home drive (Backups, lost+found+maarten)

If I go into the folders however, I can see no files there. If I use Gparted I can see that the drive still holds files, as 599Mb of the 1.7Tb is used.

The Backups folder I can read quite some files (I'm pretty happy with that), the maarten directory contains some folders (Desktop, Documents, the regular stuff you would find in your home directory), but all those folders are empty.

I can write files into those folder.

I did try a chown and chmod (chown -R $USER:$USER /home and chmod 755)

Anyone any idea how I can recover the files in my former home directory?

3
  • You will have to check the file system of the drive first. Be aware though, that there is some chance that the damage caused by a power outage at the wrong moment cannot be repaired. Then, you will need to reformat the drive and restore the data from your backup. – vanadium Jul 27 '20 at 7:44
  • iI'll work on it tonight, fortunately there is no documents lost that I cannot miss. I did do a check on the filesystem yesterday, though it was not the fsck command... don't recall the exact command unfortunately. That check gave no errors, and everything seemed ok (It might have been something like e2fsck....) – mckooiker Jul 27 '20 at 9:27
  • Perfect that you have a backup. Really, the most secure and at the same time easiest and fastest approach will be a reformat or even a reinstall, sad as it is. A power outage on the wrong split of a second can cause serious damage, and it seems you did not have luck here. – vanadium Jul 27 '20 at 11:06
0

Section assuming that you have a backup of your user data

(Continue to next section if you do not have a backup)

There is a chance that damage caused by a power outage at the wrong moment is quite severe. The most secure approach is to fully reinstall your system, reformatting the drives that were open during the power outage. That is the only secure way to ensures no corruption is lingering behind.

As a softer approach, you may first check the file systems and see whether there is damage. Drop to a root shell prompt in recovery mode and have all of your drives checked. The check will tell if there is damage or not. If the damage is small, you may be able to successfully repair the file system adding the -y option. If there is a lot of output from fsck, damage may be large and then, you will likely need to reformat.

If you were able to check the file systems, then you can test how it all appears. If the system does not behave well and/or a significant number of files are missing, you will still need to reformat the disk and then put your data back.

If you do not have a backup of your user data

Then you may need to attempt data recovery first. The golden rule here is: do not touch the damaged disk. Anything you do puts you at risk to overwrite more data.

Preferably, you have that attempted by a specialized firm. Otherwise you could attempt data recovery yourself using testdisk and photorec. testdisk can restore deleted or corrupt partitions, whereas photorec can carve the binary data and recover data where it recognizes a possible file. Do not hold your breath though. At best you recover a high number of files with random names, which you then will need to sift through to order them again.

The only real safeguard against disaster is a good and up-to-date backup. A backup of all your personal files is all it really takes to be safe. Operating systems and software configuration data are easily restored without you needing to have a backup for that.

2
  • I ended up formatting the disk and putting back my backup data. Good thing I backed up my data before doing the upgrade and fortunately the power outage did not do too much physical damage to the drive, as it seems to be working well now. Thanks for your time and quick feedback! – mckooiker Jul 28 '20 at 6:16
  • Gladd you sorted it out. Physical damage is not likely, I think. Even heavy file system damage is not necessarily a result on power outage. It depends on the precise moment. It is most likely to happen at moment where heavy disk activity is ongoing. Will not be very likely to happen on an idle system. – vanadium Jul 28 '20 at 6:50
0

You need to carefully plan your recovery methods before taking any action that can result in data loss. I can suggest you to dump your /home filesystem image (eg. with dd command) on an external drive as first step. Then you can boot your pc using a recovery live distro with testdisk/photorec and try to recover filesystem content. Now you can boot your linux in single user (recovery) mode and run fsck on /home. Check if lost+found is empty

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.