Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 5773  / 2 Years ago, fri, september 30, 2022, 7:16:02

I'm using 11.10 (ext4) and somehow I've lost /home/myuserid. /home is there, but appears empty. I can boot to the login prompt and login as Guest, but when attempting to login as myuserid, I get routed back to the login screen. I can also boot into recovery mode via Grub, then to a root prompt. As both Guest and root, /home appears empty:



root@ubuntu:~$ cd /home
root@ubuntu:/home$ ls -al
total 0
drwxr-xr-x 1 root root 60 2012-01-13 07:42 .
drwxr-xr-x 1 root root 240 2012-01-13 07:42 ..
root@ubuntu:/home$


However, when I boot the computer with my Ubuntu installation USB, run from USB, and open Nautilus, I can see /home/myuserid is there, and all the files in it are intact. I tried recovering it using parted as explained on the Ubuntu Data Recovery page, but the rescue START END command didn't do anything (didn't even give a return code, just a new prompt).



It seems like I've just deleted a pointer in the partition table to the location on disk or something, without deleting the actual partition and files. Anyone know how to restore /home/myuserid?



PS - I've read through many of the threads here on this topic, but they all seem oriented toward restoring lost files, rather than restoring a partition table pointer to a user folder, or fixing a problem with a user folder not mounting correctly, or whatever it is I've done here. My files really aren't lost, I can see and open them just fine when running from the USB drive, and I'm hesitant to try recovery tools like PhotoRec when 1) they don't seem 100% reliable, and 2) I suspect the solution is simpler.



Edit: /home is not mounted now. Booting with the USB drive, which is what I'm doing now, does not automount it. And yes /home is on its own partition (as are /boot, swap, /, and /home, all on separate partitions).


More From » 11.10

 Answers
1

We do not know why or how you lost your $HOME but from what you said it still seems there.



You can easily switch to a shell from your Guest Session by pressing Alt+Ctrl+F1. From there login with your myuserid. You may experience an error saying No directory: logging in with HOME=/. After being logged in run



cd /home/myuserid
ls


If all files are in place and only then you may be able to restore your HOME with the following command



sudo usermod -d /home/myuserid myuserid


Log out from the guest session and login to your account as usual.



If your files are not visible from the guest session then do as comments already suggested. Backup your data or try to mount the partition where /home resides.


[#40971] Friday, September 30, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
anxietunnel

Total Points: 66
Total Questions: 120
Total Answers: 115

Location: Norway
Member since Sat, Mar 4, 2023
1 Year ago
;