M.Max M.Max - 6 months ago 17
Linux Question

Integrate Home Directory from Partition after Ubuntu Reinstall

I made a mistake when reinstalling ubuntu. In the installation process I did not mark my home partition as

/home
so i got an empty home directory on my root partition. My home partion is accessible under
/media/myusername
but the data from there is not recognized by Ubuntu.

To solve this I added a new user. With this account I made the following commands:

usermod -d myusername:myusername /media/myusername
chown -cR myusername:myusername /media/myusername


When I login with my normal user where I want to integrate my home partition, I see that there have changed something. For example the icons of the programs in my panel looks like after a fresh install. The data of the home partition is still available from
/media/myusername
.

Solution:


  1. Add a new user if you just use one ubuntu user and login.

  2. Add the following commands to your terminal:

    sudo usermod -d myusername:myusername /media/myusername
    sudo chown -cR myusername:myusername /media/myusername

  3. Copy the UUID from your home partition in the file manager. Right click on the partition. There will be something like: afce9d3e-7ce9-4cd6-91d2-77a0fa5c5a0a

  4. Open fstab and past your UUID sothat your partition will automount

    sudo nano /etc/fstab



add a new line e.g.

# home partition
UUID=afce9d3e-7ce9-4cd6-91d2-77a0fa5c5a0a /media/ ext4 defaults 0 1

Answer

Not sure to have understand.

Before the reinstallation, you used to have a /home in a separated partition. After the reinstallation, that partition appears as /media/myusername. So, you personal folder should look like /media/mysusername/myusername. Correct ?

If not, than, before the installation, you used to have your /home/myusername on another partition.

In the 2 cases, I suggest you to mount your /media/myusername, either on /home (if in the first case), either on /home/myusername (if in the second case).

To make the mount permanent, you must add the entry in /etc/fstab.

Now, for the other problem of data not recognized, I suspect a file format issue. Could you give us the return of the command : df -T ?