Solution: Boot with Ubuntu Live USB, find the missing user directory in
/media, back it up, then boot into the Recovery Console Root Prompt, run
mount -a to force mount everything in fstab, then reboot and try logging in again. Details:
Backup /home/myuserdir using
cp -axto preserve all links and attributes:
- Plug in an external hard drive or other backup media via USB.
- Boot from USB startup disk. 1 2
- Open a terminal, cd /media
- Find the unmounted /home partition in /media. It may be named a long GUID string instead of /home. Just
cdinto it and see if the missing
/[GUID]/myuserid) partition is there. Once you've found it, then ...
- Copy the entire user directory to backup media using
cp -axto preserve links and attributes:
ubuntu@ubuntu:/> cd /media/[GUID]
ubuntu@ubuntu:/media/[GUID]> cp -ax * /media/backupdrivename/backupdir
- This will take a while. About 30-40m for my 117GBs, for reference.
Log out, shutdown, remove the USB startup drive and the backup hard drive. Reboot into the Ubuntu Recovery Console.
- Hold Shift down while booting to display the GRUB boot menu. Choose the Recovery Console boot option.
In Recovery Console, select the option to drop into a Root Prompt.
At the root prompt, run
mount -ato mount everything in /etc/fstab. Now check /home with
ls -al /home. With luck
/home/myuserdiris now there.
sudo reboot. If Ubuntu starts the auto filesystem check during reboot, let it run, don't cancel. At the login screen, login with normal userid.
After this my /home/userdir had been restored and I could log in normally and everything worked.
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: @arrange - /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).