I have a dual boot Windows Ubuntu laptop, and Ubuntu is split across multiple partitions (p4 and p5) so that my home folder is not on the main Ubuntu partition.
Then I must have accidentally uninstalled Python or otherwise destroyed my Ubuntu 22.04.01 (or 22.04.02?) installation, and I couldn't boot into Ubuntu at all.
So I formatted p4 and installed Ubuntu (desktop 22.04.03 LTS, a slight upgrade) fresh there, mounting as /
.
Now, when I go to my ~/
home folder, I don't see my old files.
I found them in /media/myname/home/myname
.
During installation, I didn't see an obvious option about how to set my existing p5 home partition as home (keeping my files, not formatting that partition).
If I messed up the installation, what settings should I choose on my next attempt so that my home files are back where they belong?
Or how can I fix it without reinstalling?
(I don't understand https://askubuntu.com/a/926856/48214, and I did use the same username, so apparently that's not sufficient. As answers at How to reinstall Ubuntu in the easiest way? and Keep /home directory when installing Ubuntu 14.04 suggested, I formatted /
but left /home
unformatted, hoping it would use /home
as my new home folder too, but it didn't.)
A Quick GUI Fix
Open the app Disks and click on the drive that has the old
/home
partition. It may look something like this:Yours will probably say
/dev/nvme0n1p5
and themounted at:
will be/media/myname/home/
or something similar.You will see a new window open:
Make it look the the image above. Particularly, in this order:
UUID=Abunchofnumbersandletters
/home
Note defaults is the only option you need for the "home" partition. The current options, "nosuid, nodev, nofail" are for partitions (and drives) that are to be temporarily mounted, for example, a partition in an external USB drive.
In general the mount point
/media/$USERNAME/something
is for temporarily mounting a partition that may or may not exist in the future. These temporary partitions are mounted for only the current user./home
should be mounted so that all the users can access and use their own "Home" folders such as/home/myname/
,home/myspouse/
,/home/mychild/
etc.Click OK to save the changes.
Alternately you may edit the file
/etc/fstab
usingsudo
and add the line:Note, the first line (starts with
#
) is a comment for your future reference. You can change it to suite your needs. ChangeAbunchofnumbersandletters
to the correct UUID of your partition.Then reboot your computer. If all goes well you will see your old files in your home folders.
Clean Up
Once you are satisfied that everything is working as expected, you may want to delete the folders created inside the mount point
/home
during the installation process. You will have to boot from the Live Ubuntu installation USB to do that.Use the Try Ubuntu option when you boot from the Live USB.
Look for the Ubuntu installation partition (what you call "P4") in the Dock:
Do not select the P5 partition! If you do, you will lose all your files and folders!! I am showing the content of the equivalent of both P4 and P5 below:
Navigate to the folder
/media/ubuntu/blablabla/home
, whereblablabla
is theUUID
of your/
partition (P4).First make sure your important files are not in
/media/ubuntu/blablabla/home/Your_USERNAME/Documents/
etc. If you are satisfied, delete the folder/media/ubuntu/blablabla/home/Your_USERNAME/
.Do not delete the
/media/ubuntu/blablabla/myname/
folder. This is your mount point for the home partition. If you delete it, your computer won't boot.Hope this helps
This could be done by permanently and automatically mounting your second partition on
/home
, i.e., adding a single line in/etc/fstab
. Alternatively, the utility "Disks" could be used.If you want to achieve this using the installer, then you need to select "Something else". That allows you to manually assign partitions, i.e. your first partition should be mounted on
/
, your second that contains your home directories on/home
. It is important to make sure the checkbox "format" is turned off.