it-artikel:linux:how-to-mount-home-from-another-already-mounted-drive-or-volume-for-better-snaps-support

How to mount home from another already mounted drive or volume for better snaps support

Something historic

“snaps” seem Canonical's/Ubuntu's prefered package format for easy and fast installation of desktop apps. However the whole snaps system often fails with errors if someone has moved the /home/ directory to another drive or data volume. Especially if the /home is a symbolic link, instead of a real mount point.

Some users have their /home on a separate partition and simply “mount” the /home partition there. That does solve the snaps problem. However having a separate /home partition is not optimal when it comes to storage space management.

I personally prefer to have and maintain one or more large data volumes and put my /home/ directory there, so all users share the same storage space. Until lately i approached that using a very old method of “moving” the /home/ somewhere else and symlinking it back to /home . But this is problematic, as mentioned before. snapd does not like this and fails installing or executing snap apps.

The solution to this problem are “bind mounts”. (see man mount for bind)

Solution: "bind mount" /home

Today any great Linux distro should be able to support “bind mounts” to solve that. It means you can mount directories or even single files from within already mounted volumes multiple times to wherever you like to, without trouble or danger.

Instead of mounting “partitions” or “devices” we just mount “a source directory” to an arbitrary mount point. Like this:

mount --verbose --bind /somevolume/home/ /home/

Or if we prefer using /etc/fstab instead its like:

/etc/fstab
...
 
#
# put this at the very end of the fstab file
# after all system and data volumes has been
# mounted properly. 
#
/somevolume/home/ /home/ none bind

it-artikel/linux/how-to-mount-home-from-another-already-mounted-drive-or-volume-for-better-snaps-support.txt · Last modified: 2022-08-31 14:30 by 127.0.0.1