0

I have an Ubuntu 22.04 OS with dual-boot to Windows 10.

The Disks breakup correctly shows my /home partition to be nearly 30% full, but I am unable to see any files/folders in the sub-folders of home (ie. Documents, Pictures, Downloads etc) where they were previously saved. As expected, I can't even see any previously installed snaps, except firefox, from a new installation I ran over the old one in a recovery attempt.

In fact, when I first encountered a directory missing all its contents, I rebooted, but it went into emergency mode, and my only choice was to re-install without formatting/erasing my home partition (as I usually do). It seems to have worked, since the home partition is indeed 30% full as earlier.

I tried $fsck$ but it didn't fix this issue. Please help me diagnose and fix this problem so I can recover my files/folders and at least back them up.

Edit:

grep /home /etc/mtab returns the string /dev/sda2 /home ext4 rw,relatime 0 0

sudo ls -1Ra /home has a large output that is beyond the character limit of the terminal (I can only a see a truncated version, with several lost blocks from the early part). Here is a sample:

/home/lost+found/#10862597:
total 368
drwxrwxr-x   5 tom tom  4096 May 12 11:22 .
drwx------ 639 root    root    53248 May  9 15:57 ..
-rw-rw-r--   1 tom tom  2406 May 12 11:22 archive.py
-rw-rw-r--   1 tom tom 32277 May 12 11:22 asyn.py
-rw-rw-r--   1 tom tom 26395 May 12 11:22 caching.py
-rw-rw-r--   1 tom tom  6358 May 12 11:22 callbacks.py
-rw-rw-r--   1 tom tom  4856 May 12 11:22 compression.py
-rw-rw-r--   1 tom tom  4193 May 12 11:22 config.py
-rw-rw-r--   1 tom tom  1245 May 12 11:22 conftest.py
-rw-rw-r--   1 tom tom 21507 May 12 11:22 core.py
-rw-rw-r--   1 tom tom  2717 May 12 11:22 dircache.py
-rw-rw-r--   1 tom tom   348 May 12 11:22 exceptions.py
-rw-rw-r--   1 tom tom 10187 May 12 11:22 fuse.py
-rw-rw-r--   1 tom tom 10211 May 12 11:22 generic.py
-rw-rw-r--   1 tom tom 13766 May 12 11:22 gui.py
drwxrwxr-x   3 tom tom  4096 May 12 11:22 implementations
-rw-rw-r--   1 tom tom  1800 May 12 11:22 __init__.py
-rw-rw-r--   1 tom tom  7879 May 12 11:22 mapping.py
-rw-rw-r--   1 tom tom 19516 May 12 11:22 parquet.py
drwxrwxr-x   2 tom tom  4096 May 12 11:22 __pycache__
-rw-rw-r--   1 tom tom 10079 May 12 11:22 registry.py
-rw-rw-r--   1 tom tom 62483 May 12 11:22 spec.py
drwxrwxr-x   3 tom tom  4096 May 12 11:22 tests
-rw-rw-r--   1 tom tom  2195 May 12 11:22 transaction.py
-rw-rw-r--   1 tom tom 17103 May 12 11:22 utils.py
-rw-rw-r--   1 tom tom   500 May 12 11:22 _version.py

  • 1
    How do you have /home mounted? Do: grep /home /etc/mtab. Also try sudo ls -lRa /home or sudo find /home -ls. Please [edit] your question to add whatever information you get. Do not use Add Comment. – waltinator Sep 24 '23 at 04:36
  • @waltinator, just made an edit. I tried accessing the lost+found directory using the terminal, but although it comes up in an ls, I can't cd into it. – question_quasar Sep 24 '23 at 04:49
  • 2
    See https://unix.stackexchange.com/questions/18154/what-is-the-purpose-of-the-lostfound-folder-in-linux-and-unix You should not cd to /lost+found, it's a stash for files that fsck found floating loose, and reconnected them to the filesystem. They may be incomplete/corrupted. If you're happy with the file (it's complete and un-corrupted), use sudo mv to put them back where they belong. Investigate with sudo file /lost+found/*, sudo less /lost+found/*. – waltinator Sep 24 '23 at 05:11
  • Thank you @waltinator! I managed to recover a large portion of the lost files, although a good many documents were corrupted. I had lost all hope thinking that my drive was corrupted, but your timely help saved me a lot of trouble. Thank you once again. – question_quasar Sep 24 '23 at 12:02

1 Answers1

0

Thanks to @waltinator for helping diagnose my problem.

I used a variant of this code from a related post to move /home/lost+found to /home/user/recovered (a new directory). I had lost a significant amount of data and did not have the disk space to afford a copy operation. Then I removed the root permissions using sudo chmod -R 777 /home/user/recovered for convenience. The data in this folder often requires manual sifting, but thankfully, I was able to recover many of my important files.