Change Home Folder Location

I have UB 19.10 installed on the HD of my laptop.

Not I got myself a SSD , that’s inside the notebook together with the HD.

I have installed UB 19.10 on the SSD. UB on the HD is also still there.

Now I want to load the home folder from the UB version that is on the HD, instead of that on the SSD, since there are a lot of configuration files and other stuff on it.

Is there an easy way to do this?

I found some information here, but it rather complicated and I am afraid to mess things up.

It depends of how you « partitioned » your new installation and how was « partitioned » previous installation.

Don’t change anything for the moment. We need to see the actual « full picture » of your installation.

⋅ At boot, does grub give you the choice to start one or the other of your two installed system ?
⋅ when booted in one of your system, do you still find the other one ?

Commands that might help to picture :

cat /etc/fstab
lsblk
df -Th
sudo blkid

from each of your running system.

My « idea » : at end,
⋅ only keep the system installed and running on SSD
⋅ on SSD keep the whole root / partition
⋅ on HDD only keep /home folder
⋅ from system on SSD’s root, set HDD to be mounted at start ( in /media/DATA for example )
⋅ move hidden files and folders from HDD's /home/$USER to SSD's /home/$USER
. replace SSD's /home/$USER/folders by symbolic links pointing to matching HDD's /home/$USER/folders

We may also use the whole HDD’s partition mounted as /home is SSD but this would not benefit the performance of SSD for hidden files and folders where config’s are stored.
This way you have on SSD everything’s related to system and almost nothing related to your personal files. On HDD you have everything’s related to your personal files and nothing’s absolutely necessary for your system.

What do you think about that ?

That is a really cool idea. I hope I didn’t read it too late.

I tried the Fstab thing and it broke my system. :frowning:

So, I managed to re-install Ubuntu on the SSD as root and the the mount point for the home folder to the Hard Drive.

Now, Ubuntu loads in astonishing 10 seconds and applications like LibreOffice pop up real quick.

But, as you say, all the hidden files for newly installed programs are now on the HDD. Would it be possible to move them to the SSD, and create this symbolic link (no idea how this works…)?

Well everything’s possible. In theory.

Please post here returns of above suggested commands to see « how » are organized your discs and partitions.

There are many ways to create ( symbolic ) links :
⋅ in file explorer, select a file or folder and hit [ ctrl +M ] this will create a link named Link to file_or_folder you can then move this link wherever you want and rename it.
⋅ in file explorer, holding [ shift + ctrl ] while drag’n’drop from source to destination will also create a link.
⋅ from terminal with ln -s /path_to/target_file/_or_folder name_for_link will create a link where your terminal is located. Or ln -s /path_to/target_file/_or_folder /path_to/destination/name_for_link

Thanks for investing your time. It would be interesting to make this work. Here is the output of the commands you have listed above:

cat /etc/fstab

/etc/fstab: static file system information.

/ was on /dev/sdb during installation
UUID=b125e762-265d-4e0d-a206-74c5d5a42c04 / ext4 errors=remount-ro 0 1
/boot/efi was on /dev/sda1 during installation
UUID=CC65-3241 /boot/efi vfat umask=0077 0 1
/home was on /dev/sda5 during installation
UUID=2f5311a1-7d88-408c-8c07-c6e904cf259e /home ext4 defaults 0 2
/swapfile none swap sw 0 0

lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 89,1M 1 loop /snap/core/7917
loop1 7:1 0 93,8M 1 loop /snap/core/8935
loop3 7:3 0 193M 1 loop /snap/mailspring/456
loop4 7:4 0 54,8M 1 loop /snap/gtk-common-themes/1502
loop5 7:5 0 55M 1 loop /snap/core18/1705
loop6 7:6 0 16,5M 1 loop /snap/ubuntu-budgie-welcome/186
loop7 7:7 0 16,5M 1 loop /snap/ubuntu-budgie-welcome/190
sda 8:0 0 931,5G 0 disk
├─sda1 8:1 0 260M 0 part /boot/efi
├─sda2 8:2 0 16M 0 part
├─sda3 8:3 0 371G 0 part
├─sda4 8:4 0 650M 0 part
└─sda5 8:5 0 559,7G 0 part /home
sdb 8:16 0 223,6G 0 disk /

df -Th

Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 3,8G 0 3,8G 0% /dev
tmpfs tmpfs 782M 3,3M 778M 1% /run
/dev/sdb ext4 220G 14G 195G 7% /
tmpfs tmpfs 3,9G 78M 3,8G 2% /dev/shm
tmpfs tmpfs 5,0M 4,0K 5,0M 1% /run/lock
tmpfs tmpfs 3,9G 0 3,9G 0% /sys/fs/cgroup
/dev/loop1 squashfs 94M 94M 0 100% /snap/core/8935
/dev/loop3 squashfs 194M 194M 0 100% /snap/mailspring/456
/dev/loop0 squashfs 90M 90M 0 100% /snap/core/7917
/dev/loop4 squashfs 55M 55M 0 100% /snap/gtk-common-themes/1502
/dev/loop5 squashfs 55M 55M 0 100% /snap/core18/1705
/dev/loop6 squashfs 17M 17M 0 100% /snap/ubuntu-budgie-welcome/186
/dev/sda5 ext4 550G 354G 168G 68% /home
/dev/sda1 vfat 256M 34M 223M 13% /boot/efi
tmpfs tmpfs 782M 64K 782M 1% /run/user/1000
/dev/loop7 squashfs 17M 17M 0 100% /snap/ubuntu-budgie-welcome/190

sudo blkid

/dev/sdb: UUID=“b125e762-265d-4e0d-a206-74c5d5a42c04” TYPE=“ext4”
/dev/loop0: TYPE=“squashfs”
/dev/loop1: TYPE=“squashfs”
/dev/loop3: TYPE=“squashfs”
/dev/loop4: TYPE=“squashfs”
/dev/loop5: TYPE=“squashfs”
/dev/loop6: TYPE=“squashfs”
/dev/loop7: TYPE=“squashfs”
/dev/sda1: LABEL=“SYSTEM” UUID=“CC65-3241” TYPE=“vfat” PARTLABEL=“EFI system partition” PARTUUID=“ae854e3c-f282-467b-a5c6-40c0ab7b87a7”
/dev/sda2: PARTLABEL=“Microsoft reserved partition” PARTUUID=“7437aa01-f2c8-4aaa-9df9-e2ec47a75ec4”
/dev/sda3: LABEL=“OS” UUID=“523C67B63C67942F” TYPE=“ntfs” PARTLABEL=“Basic data partition” PARTUUID=“947a09fe-12cf-4ac1-8cb6-7257bf2fd9ee”
/dev/sda4: LABEL=“RECOVERY” UUID=“D84EFBE24EFBB6FA” TYPE=“ntfs” PARTLABEL=“Basic data partition” PARTUUID=“51cb38a2-4a38-4e52-a995-a3adf69a2a20”
/dev/sda5: UUID=“2f5311a1-7d88-408c-8c07-c6e904cf259e” TYPE=“ext4” PARTUUID=“a415a9ac-96d9-4e21-918b-7d8a3132cfdc”

1⋅ First some warnings, disclaimers, pieces of advice, questions :

⋅ when you copy paste commands outputs, do it « neutral » and complete using 3xaltgr7 as markups :

django@ASGARD:~$ cat /etc/fstab 
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sdb1 during installation
UUID=25c341fb-320d-4a4a-9d64-b08c5fe55540 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=22faac8b-34aa-4425-98a7-184d0613ccff none            swap    sw              0       0
# DATA
UUID=b19322e6-8a6d-4e24-b87f-4b0155b41963 /media/DATA ext4 defaults 0 2

django@ASGARD:~$

⋅ try not to skip any question :wink:

⋅ sda is your HDD and sdb is your SSD. I’m a bit bugged that sdb shows no partition and by the /boot/efi location. Those might suggest later issues - be aware your current setup may not be perfect as is.

⋅ partitions sda2, sda3, sda4 host a Windows system ( hence probably the sda1 /boot/efi partition ). Do you still need it ?

Those notes only aim at helping your …helper - me, trying to figure out what you have tried / done so far :slight_smile: Anyway, let’s go back to topic.

2⋅ /home is on HDD right now and not on SSD

from your fstab :

# /home was on /dev/sda5 during installation
UUID=2f5311a1-7d88-408c-8c07-c6e904cf259e /home ext4 defaults 0 2

so that probably meant you had a separate /home partition on your previous Ubuntu installation, right ?
You took that « old » /home and mounted it in replacement of the /home folder on your SSD.
The idea is to undo that, to get back to default situation where /home is just a « normal » folder inside your / root system.

a⋅ first do a backup of the hidden files and folders you’d find inside actual /home/your_user on usb-thumb or any external media or any place you have access to but outside /home ( important ).

b⋅ second have at hand reach an ubuntu iso on usb-thumb or dvd from which you could start a live-session. These two points are just safety tips. We should not need them.

c⋅ then modify your /etc/fstab file to disable the /dev/sda5 mount. Easy, just comment its line like this

# /home was on /dev/sda5 during installation
# UUID=2f5311a1-7d88-408c-8c07-c6e904cf259e /home ext4 defaults 0 2

by adding # at the beginning. We will need to modify again that line later.

d⋅ Reboot. You should be able to login to your user session. This should be « empty » like at first time you login and this is purposely expected. If you can’t login, go to h⋅

e⋅ create a mounting point for your « old /home » named DATA in the /media folder
sudo mkdir /media/DATA
Once in use, things found in /media folder will appear in « devices / other places » in your file explorer.

f⋅ let’s modify again fstab to mount your « old /home » in previously created DATA folder by launching from terminal
gedit admin:///etc/fstab
or from inside terminal
sudo nano /etc/fstab
modify and uncomment line regarding /dev/sda5 like this
UUID=2f5311a1-7d88-408c-8c07-c6e904cf259e /media/DATA ext4 defaults 0 2

g⋅ Reboot. Or just run sudo mount -a in terminal ( which will mount what’s in fstab ). If any error message post it here. You should now find in your file explorer DATA and be able to browse it.
ls -la /media/DATA
ls -la /media/DATA/your_user

h⋅ If you can’t login. Boot your pc from ubuntu live session. Browse to your installed system
/media/ubuntu/123abc456qsd789wxc/home/your_user
and copy there the hidden files and folders previously backed-up. You’d need to do this as root user since live session user is not the owner of the destination place.
Once copied - important ! - if you were the first and only user of the installed system do a
sudo chown -R 1000:1000 /media/ubuntu/123abc456qsd789wxc/home/your_user
Of course 123abc456qsd789wxc is to be replaced by what you’d see on your side.

Then reboot and log into your session and go to e⋅

→ here you should have :
⋅ /home on your SSD
⋅ empty folders in /home/your_user ( Desktop, Documents, Pictures and so on )
⋅ DATA automatically present and mounted at boot in your file explorer.

→ ready to play with links ?

1 Like

[ important : in case you have budgie-trash-applet installed, stop using it from now on, see Trash applet [!] when emptying, follow links? fix pending ]

3⋅ replacing folders in /home/$USER on SSD by links to matching folders on HDD

This is very easy for all the generic folders ( Documents, Pictures, Download… ) there’s a trick though for Desktop.

a⋅ In your personal folder, simply delete the folders - after checking they’re empty, of course. You won’t be able to delete Desktop folder ( since it’s handled by Nemo to display its content on desktop screen, I guess that’s why it can’t be deleted as long as the graphical session is on ) so we will take care of it later.

Using one of the previously mentioned methods, browse to /media/DATA/user/ and create your links.
Put these links in /home/user with the exact same names as the deleted folders. And voilà.

b⋅ Desktop folder. There may be other methods but here is how I deal with it. Login to your usual session. Create a new user, with administrative role. Log out from your session. Login to the newly created user. Open a terminal :

new_user@computer:~$ sudo rmdir /home/usual_user/Desktop
new_user@computer:~$ sudo ln -s /media/DATA/usual_user/Desktop /home/usual_user/Desktop
new_user@computer:~$ sudo chown -h usual_user:usual_user /home/usual_user/Desktop

Desktop might be replaced by the localized name ( in french, Bureau ).
Log out. Login to your usual session. Voilà.

c⋅ Last check for perfection. In your usual session, have an eye on ~/.config/user-dirs.dirs
It should read something like this :

django@ASGARD:~$ cat .config/user-dirs.dirs 
# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run.
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
# 
XDG_DESKTOP_DIR="$HOME/Bureau"
XDG_DOWNLOAD_DIR="$HOME/Téléchargements"
XDG_TEMPLATES_DIR="$HOME/Modèles"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Musique"
XDG_PICTURES_DIR="$HOME/Images"
XDG_VIDEOS_DIR="$HOME/Vidéos"
django@ASGARD:~$ 

…of course, in your language.
If some path look empty like this …="$HOME/" just add the missing part and save.
This file is used by many programs for them to know where are the « generic » expected user’s folders.
Nemo uses it for some of its bookmarks in left pane and to theme accordingly folders icons.

→ So now everything, hidden or not, under /home/user sits on SSD except for the links, which sources always sit on HDD.
If you delete a link, you don’t delete its source.
Links automatically endorse sources’ permissions and rights. May you have any permission issue, these should be fixed on source files/folders.

Hi, @Coeur-Noir, thanks for looking into this and elaborating this detailed manual. I will go through questions before I make the (long list of :slight_smile: ) changes, maybe my answer will change something in your advice or proceedings.

Here we go:

Yes, I have the old Ubuntu version still installed on the HDD. That I won’t need anymore. But I will need the Windows installation for applications I am unable to install on Linux.

so that probably meant you had a separate /home partition on your previous Ubuntu installation, right ?

This is correct, yes …

You took that « old » /home and mounted it in replacement of the /home folder on your SSD.>

Not sure I understand what you mean… When I click on the SSD in Nautilus, the Home folder is listed there (should be listed elsewhere, like on the HDD, shouldn’t it?). I don’t know, if it is sort of a symlink, or the actual location.

Interesting: inside the new Home folder, the old Home folder is listed, but now just a file storage. I have a home inside a Home folder, but the old one can be deleted once I have transferred all my the filess to the new location.

Adding an observation …

when I list the content of the SSD, in the file manager, then, and only then, I can see one home folder inside the other … this is probably due to installing the home partition in the partition where the old UB was installed …

Ok. So. When you start your computer, do you see a screen where you can chose which Operating System to boot on ? If your 3 OS are correctly installed you should see a kind of text menu looking a bit like this :


( this ↑ is a random example of a GRUB screen )

If you don’t see this kind of screen at boot, then something may not be optimal in your installation.

Data sit across the many partitions of your many discs. Each partition is « mounted » into a « mounting point » which is a file or a folder in your system tree. This is the role of fstab file : it tells the system « take this partition from that disc and show it in this place in the system » .

So when you look at your SSD in Nautilus ( or Nemo ? ) you indeed look at your / root partition on disc sdb. And your /home folder sits there in. But what’s shown inside this folder comes from disc sda, partition #5.

Reading the outputs of the previous commands, I can see :
⋅ /dev/sdb ext4 220G 14G 195G 7% / → this is the root of one Ubuntu system, on disc sdb, not partitioned, surprisingly.
⋅ /dev/sda5 ext4 550G 354G 168G 68% /home → this is a separate /home partition, on partition #5 of disc sda
⋅ sda5 actually mounted in your /home on SSD as shown by fstab

/home was on /dev/sda5 during installation
UUID=2f5311a1-7d88-408c-8c07-c6e904cf259e /home ext4 defaults 0 2

⋅ partions #2, 3 and 4 of disc sda are your windows OS
⋅ partition 1 of disc a is /boot/efi probably needed by both win and ubuntu for booting in efi mode.

→ my « conclusion » here : I see only one Ubuntu system, not two, do you confirm ?
→ Or… could you show what’s inside your /home
ls -la /home
…maybe there is a whole system in, not only a /home folder ?

All that being said, that does not change the process.

Yes, the Grub menu shows one option to start Windows, the old Ubuntu installation that sits on the HHD, and the new one *Ubuntu that’s on the SSD …

this is the output:

user@user:~$ ls -la /home
total 2097340
drwxr-xr-x 21 root root 4096 abr 19 09:39 .
drwxr-xr-x 20 root root 4096 abr 19 09:37 …
lrwxrwxrwx 1 root root 7 nov 30 03:09 bin -> usr/bin
drwxr-xr-x 4 root root 4096 abr 6 15:27 boot
drwxr-xr-x 2 root root 4096 nov 30 03:12 cdrom
drwxr-xr-x 5 root root 4096 out 17 2019 dev
drwxr-xr-x 152 root root 12288 abr 18 12:25 etc
drwxr-xr-x 3 root root 4096 nov 30 03:13 home
lrwxrwxrwx 1 root root 7 nov 30 03:09 lib -> usr/lib
lrwxrwxrwx 1 root root 9 nov 30 03:09 lib32 -> usr/lib32
lrwxrwxrwx 1 root root 9 nov 30 03:09 lib64 -> usr/lib64
lrwxrwxrwx 1 root root 10 nov 30 03:09 libx32 -> usr/libx32
drwx------ 2 root root 16384 nov 30 03:09 lost+found
drwxr-xr-x 3 root root 4096 nov 30 19:40 media
drwxr-xr-x 3 root root 4096 dez 3 20:34 mnt
drwxr-xr-x 7 root root 4096 abr 15 09:10 opt
drwxr-xr-x 2 root root 4096 out 14 2019 proc
drwxr-xr-x 42 user user 4096 abr 22 13:48 user
drwx------ 14 root root 4096 mar 30 11:59 root
drwxr-xr-x 13 root root 4096 nov 30 03:13 run
lrwxrwxrwx 1 root root 8 nov 30 03:09 sbin -> usr/sbin
drwxr-xr-x 11 root root 4096 abr 4 17:20 snap
drwxr-xr-x 2 root root 4096 out 17 2019 srv
-rw------- 1 root root 2147483648 nov 30 03:09 swapfile
drwxr-xr-x 2 root root 4096 out 14 2019 sys
drwxrwxrwt 15 root root 81920 abr 18 12:39 tmp
drwxr-xr-x 15 root root 4096 mar 30 12:01 usr
drwxr-xr-x 14 root root 4096 out 17 2019 var

Ok. So you did not have a separate /home partition on your previous Ubuntu install.

Now you have the full previous system mounted in the /home of your new one.

So you definitely need to change that !

So modify your fstab as already suggested.

At the end, we will find your full previous Ubuntu system inside /media/DATA and later get rid of what’s no longer useful to keep only the former /home folder.

Cool … now, these are a lot of individual steps to follow and I get kind of confused. I am afraid to miss something or mess something up …

Now, correct me if I’m wrong, you can break everything down into three major blocks:

  1. Change FStab, so that everything is in, or pointing to, the correct partitions;
  2. Organize the Home folder(s);
  3. Clean up …

Is this correct?

Maybe I can go step by step … first things first …

Could you maybe summarize the breakdown for the first? I hope this is not too much work …

First tings first, yes
1⋅ the fstab
2⋅ clean up → on the side of now /media/DATA ( hdd )
3⋅ then organize the /home folder on the side of your root system / ( ssd ).

Give yourself some time to read about :
⋅ partitions
⋅ mount / mounting points
as these are the fundamentals in Linux file-systems.
Maybe there → https://wiki.ubuntuusers.de/Startseite/

One question before I make any changes … what are implications if I leave system as it is today?

Will I notice any performance (or other) improvements after the changes? What will those be?

/home folder has one main function : this is the place for personal folder of ( human ) users of your system. Not a place for hosting another system.

The suggested changes will get things at their expected places. Easier to browse and maintain in the long run.

The minimal fixes to do are :
⋅ create the mount point /media/DATA
⋅ modify fstab in order to have sda5 mounted into /media/DATA

Then you’ll have a regular working full system on your ssd and you’ll be able to browse your older installation through /media/DATA. That older installation still sits on your hdd.

Hummm … so I managed to make the changes to the FStab file and mount the system on the SSD and create the media/DATA directory. The session wouldn’t log in after changing FStab, so I had to go through the steps in the life session.

But, in the end, it worked, thank you.

Now, I do have to reinstall all my applications, right? So that all the important files and application are on SSD?

Shall I copy all the previously copied hidden files to the SSD?

I’m half-surprised you needed the live session.

To check everything’s at its right place :

cat /etc/fstab
ls -la /home
ls -la /home/your_user
ls -la /media
ls -la /media/DATA

Modifying fstab file does not modify any « content » on discs and partitions. So what was installed before is still there, in its initial place.

Your former personal folder from previous installation is now in /media/DATA/home/name_of_user
You can take from there some of the hidden files and folders, those concerning your favorite app’s ( depending on your own usage, Firefox, Thunderbird, LibreOffice, Gimp, etc )
Personal config’s for app’s are generally stored in

~/.config/app_name
~/.local/share/app_name
~/.cache/app_name
~/.app_name ( → .thunderbird )
~/.editor_app_name ( → .mozilla for Firefox )

Cool, will copy that …

The symbolic links you have mentioned before … when I download something, can it be done in a way that it goes automatically into the downloads folder of the HDD?