How to Change with CLI the mountpoint of /home in Fedora Silverblue 34

Currently my Fedora Silverblue installation is on a device with 3 partitions as installed with Anaconda

$ lsblk -f /dev/sda
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
sda
├─sda1 vfat FAT32 A623-F1E3 590,3M 1% /boot/efi
├─sda2 ext4 1.0 2ddd824c-df0f-4e14-afc3-e93c42ab0dfe 839,3M 7% /boot
└─sda3 btrfs fedora_fedora 906b5870-a232-40e8-a1b0-e548f77cc69b 6,3G 81% /var/home

On /dev/sda3 the btrfs filesystem holds all the mountpoints for system and home: (Output from gparted on the mounpoints associated with /dev/sda3): /, /sysroot, /usr, /var, /var/home

Il would like to create a 4th partition /dev/sda4, in btrfs, and holding only /home so as to separate/isolate /home in/dev/sda4 from the system mountpoints which should remain in /dev/sda3

Is it possible ? what kind of command lines should do the job ?

From what you posted that is an unusual config.
Normally with btrfs the system would have the same 3 partitions, but would only have the /root (mounted at /) and /home (mounted at /home) subvolumes on /dev/sda3.
Having /var/home is totally non-standard and unless you created it deliberately that way the mount point does not even exist.

You need to change that to mount that subvolume both named and mounted as /home. The /root subvolume (mounted as /) should be the top level subvolume and /home should be next.

Sorry, I don’t use btrfs on my daily driver so I am not familiar with the tools enough to give you the details of how.

1 Like

Actually, that’s the way it’s set up for Silverblue. It’s a symlink, so /var/home and /home would both be usable in the same way.

lrwxrwxrwx@  7 root 31 Aug 09:23 bin -> usr/bin
drwxr-xr-x@  - root 27 Oct 12:16 boot
drwxr-xr-x@  - root 27 Oct 12:17 dev
drwxr-xr-x@  - root 27 Oct 12:17 etc
lrwxrwxrwx@  8 root 31 Aug 09:23 home -> var/home
lrwxrwxrwx@  7 root 31 Aug 09:23 lib -> usr/lib
lrwxrwxrwx@  9 root 31 Aug 09:23 lib64 -> usr/lib64
lrwxrwxrwx@  9 root 31 Aug 09:23 media -> run/media
lrwxrwxrwx@  7 root 31 Aug 09:23 mnt -> var/mnt
lrwxrwxrwx@  7 root 31 Aug 09:23 opt -> var/opt
lrwxrwxrwx@ 14 root 31 Aug 09:23 ostree -> sysroot/ostree
dr-xr-xr-x@  - root 27 Oct 07:16 proc
lrwxrwxrwx@ 12 root 31 Aug 09:23 root -> var/roothome
drwxr-xr-x@  - root 27 Oct 12:19 run
lrwxrwxrwx@  8 root 31 Aug 09:23 sbin -> usr/sbin
lrwxrwxrwx@  7 root 31 Aug 09:23 srv -> var/srv
dr-xr-xr-x@  - root 27 Oct 12:16 sys
drwxr-xr-x@  - root 31 Aug 09:23 sysroot
drwxrwxrwt@  - root 27 Oct 12:18 tmp
drwxr-xr-x@  - root 31 Dec  1969 usr
drwxr-xr-x@  - root 27 Oct 12:17 var

To @mahdiaqallal - I think you would just need to edit your /etc/fstab and replace the /home mountpoint with your new partition.

Well, since I never use silverblue (and do not intend to do so) the unusual config has never before been encountered. Thanks for the info though since now I won’t be quite so surprised when something like that is seen in the future.

Thanks for your insights.
What command line should I type to follow your advices?

BTW The configuration was the one automatically presented to me by Anaconda for Silverblue 34.
I’ve installed the Anaconda installation image for Silverblue 34 on a USB disk.

Then booted the USB disk and Anaconda pretty much did all the settings with Automated configuration on the drive …

Thus this configuration…

What settings should choose in Anaconda to get it right… And why those settings?

Thank you.

I found here a partial solution but not quite explicit enough for me:

https://ask.fedoraproject.org/t/move-home-to-direction-partition/3356

Even if you are using another Fedora flavour, could you then walk me through the command lines to move /home to another partition.

The generalized steps are this.

  1. create the new partition on the other drive.
    Choose the filesystem to use and format it.
  2. copy all the data from the existing /home to the new drive
    this usually can be done using
    sudo mount <options> /dev/<new partition name> /mnt
    sudo /rsync -avAX /home/ /mnt/
    sudo umount /mnt
  3. edit /etc/fstab to mount the new drive at /home.
    Do a backup of /etc/fstab before you edit it, to enable recovery in case something goes wrong.
    this likely will involve replacing the current mount entry in fstab with the data needed to mount the new partition at /var/home
  4. If you desire to clean out the data currently in the /var/home volume to recover storage space there will be a couple other steps involved.
    Regardless of whether you clean out the space the command
    sudo mount -a
    should mount the new partition. Once you verify that it mounts properly then a reboot will have everything on the new volume for /home

This is generalized, and may or may not work as expected on silverblue. Silverblue is intended to be mostly immutable so how this will work in practice is (to me) unknown. It does however work on most linux versions.

Here is the output of cat /etc/fstab:

#
# /etc/fstab
# Created by anaconda on Mon Aug 9 21:24:55 2021
#
# Accessible filesystems, by reference, are maintained under ‘/dev/disk/’.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run ‘systemctl daemon-reload’ to update systemd
# units generated from this file.
#
UUID=906b5870-a232-40e8-a1b0-e548f77cc69b / btrfs subvol=root,compress=zstd:1 0 0
UUID=2ddd824c-df0f-4e14-afc3-e93c42ab0dfe /boot ext4 defaults 1 2
UUID=A623-F1E3 /boot/efi vfat umask=0077,shortname=winnt 0 2
UUID=906b5870-a232-40e8-a1b0-e548f77cc69b /home btrfs subvol=home,compress=zstd:1 0 0

@ guiltydoggy
Let’s say UUID for the “new /home” would be UUID=XXXX-YYYY
I REALLY don’t want to break this new installation on Silverblue …

Would you please walk me through all the steps in command line ?

I’m afraid I haven’t done this personally, so I won’t be able to guarantee that it will work. But assuming that your new partition has UUID=XXXX-YYYY, and it’s formatted in btrfs, and you’ve created a btrfs subvolume on that partition named “home”, then it should be just a matter of replacing the existing home entry’s UUID=906b….cc69b in /etc/fstab with the UUID=XXXX-YYYY.

Thanks @ computersavvy for the steps,
By the way if the target /home folder is on a btrfs filesystem, it is first necessary that the /home folder is associated with a btrfs subvolume
https://fedoraproject.org/wiki/Btrfs#Installer_support

Thank you @guiltydoggy

By the way assigning to the btrfs subvolume dedicated to /home either with the mountpoint /home or /var/home in /etc/fstab produces the same result: Fedora Silverblue does all the right symlinks necessery

However @ guiltydoggy:

  • When I update the /etc/fstab , having created the relevant btrfs subvolume associated to /home and with mountpoint (/var)/home, at reboot, everything seems fine: Files and folders are where they are expected to be. Either mountpoints in /etc/fstab work the same : /var/home or /home

  • But logging through tty with the username (below: “mahdiaqallal”) to whom the subfolder (/home/mahdiaqallal) does exist and is associated below /home, does produce an odd comment just after successfull terminal login:

fedora login: mahdiaqallal
Password:
Last login: Tue Apr 5 19:25:57 on tty3
– mahdiaqallal: /var/home/mahdiaqallal: change directory failed: No such file or directory
Logging in with home = “/”
Welcome to Fedora Silverblue. This terminal is running on the
host system. You may want to try out the Toolbox for a directly
mutable environment that allows package installation with DNF.

For more information, see the documentation.

mkdir: impossible to create folder ’ /var/home/mahdiaqallal ’ : Permission denied’
touch: impossible to touch ‘/var/home/mahdiaqallal/.config/toolbox/host-welcome–shown:’ No file or folder exists

Do you already have a /var/home/mahdiaqallal created? I’m guessing no. You’ll have to mkdir that directory as root/sudo. Make sure to chown your new home directory to your own user and group. Then chmod to only give access to your own user.

Well actually have a /var/home/mahdiaqallal folder associated with user mahdiaqallal …

To summarize this thread:

$ sudo lsblk -f  /dev/sdc /dev/sdb
NAME   FSTYPE FSVER LABEL         UUID                                 FSAVAIL FSUSE% MOUNTPOINT                            
sdb                                                                                                                          
├─sdb1 vfat   FAT32               DEEB-CDFE                                                                                 
├─sdb2 ext4   1.0                 d675c5b4-a45d-4529-b3c2-f6dc51e81e84                                                      
├─sdb3 btrfs        fedora_fedora 4ec9d406-41fb-4760-828b-35f1565ae5fc    8,4G    86% /run/media/mahdiaqallal/fedora_fedora 
sdc    btrfs        HOMETEST      7e81da8e-7058-44af-8496-695540dd8694    6,9G     1% /run/media/mahdiaqallal/HOMETEST

I would like to move /home so that a system:

  • running on root filesystem in /dev/sdb3 and /home also in /dev/sdb3

  • would be running on root filesystem in /dev/sdb3 and having /home moved to /dev/sdc

  • and in both cases having a user (mahdiaqallal) associated with his natural $HOME folder: $HOME=/var/home/mahdiaqallal whether $HOME is in /dev/sdb3 or in /dev/sdc (in both cases all are in btrfs filesystems)

Note: to show all the relevant filesystem informations in terminal, illustrative mountpoints:

/dev/sdb3       /run/media/mahdiaqallal/fedora_fedora
/dev/sdc        /run/media/mahdiaqallal/HOMETEST
#Initial /etc/fstab running on root filesystem in /dev/sdb3 and /home also in /dev/sdb3
#
/dev/sdb3               /                       btrfs   subvol=root,compress=zstd:1 0 0
UUID=d675c5b4-a45d-4529-b3c2-f6dc51e81e84 /boot ext4    defaults        1 2
UUID=DEEB-CDFE          /boot/efi               vfat    umask=0077,shortname=winnt 0 2
/dev/sdb3               /home                   btrfs   subvol=home,compress=zstd:1 0 0


$ sudo btrfs subvolume list /run/media/mahdiaqallal/fedora_fedora
ID 256 gen 3271 top level 5 path home
ID 258 gen 3271 top level 5 path root
$ sudo btrfs subvolume show /run/media/mahdiaqallal/fedora_fedora/home | head -3
home
	Name: 			home
	UUID: 			ff7f0c05-b8ca-4d48-afea-2ba086010013
$ sudo ls -ld /run/media/mahdiaqallal/fedora_fedora/home/mahdiaqallal
drwx------. 1 mahdiaqallal mahdiaqallal 3792 11 avril 16:55 /run/media/mahdiaqallal/fedora_fedora/home/mahdiaqallal

Thus to make it as identical to /dev/sdb3, the device holding the new $HOME /dev/sdc is:

  • formatted with a btrfs filesystem
  • having a subfolder named /home and as btrfs subvolume
$ sudo btrfs subvolume list /run/media/mahdiaqallal/HOMETEST
ID 257 gen 166 top level 5 path home
$ sudo btrfs subvolume show /run/media/mahdiaqallal/HOMETEST/home | head -3
home
	Name: 			home
	UUID: 			66142147-5baf-3048-bf86-6bd5b5293b8e
$ sudo ls -ld /run/media/mahdiaqallal/HOMETEST/home/mahdiaqallal
drwxr-xr-x. 1 mahdiaqallal mahdiaqallal 338 10 avril 23:09 /run/media/mahdiaqallal/HOMETEST/home/mahdiaqallal
#New /etc/fstab running on root filesystem in /dev/sdb3 and having /home moved to /dev/sdc
#
UUID=4ec9d406-41fb-4760-828b-35f1565ae5fc       /                       btrfs   subvol=root,compress=zstd:1 0 0
UUID=d675c5b4-a45d-4529-b3c2-f6dc51e81e84 		/boot                   ext4    defaults        1 2
UUID=DEEB-CDFE         					        /boot/efi               vfat    umask=0077,shortname=winnt 0 2
UUID=7e81da8e-7058-44af-8496-695540dd8694       /home                   btrfs	subvol=home,compress=zstd:1 0 0

It seems all folders, subfolders, permissions and access do already exist, and are quite the same.

So @ guiltydoggy what I am missing here ?

What’s the output of ls -la /home When booted with the new fstab?

bash-5.1$ sudo tail -6 /etc/fstab
#
UUID=4ec9d406-41fb-4760-828b-35f1565ae5fc               /                       btrfs   subvol=root,compress=zstd:1 0 0
UUID=d675c5b4-a45d-4529-b3c2-f6dc51e81e84               /boot                   ext4    defaults        1 2
UUID=DEEB-CDFE                                          /boot/efi               vfat    umask=0077,shortname=winnt 0 2
UUID=7e81da8e-7058-44af-8496-695540dd8694               /var/home               btrfs   subvol=home,compress=zstd:1 0 0

bash-5.1$ ls -la /home
lrwxrwxrwx. 3 root root 8 23 sept.  2021 /home -> var/home
bash-5.1$ echo $HOME
/var/home/mahdiaqallal
bash-5.1$ ls -lad /home/mahdiaqallal
drwxr-xr-x. 1 mahdiaqallal mahdiaqallal 338 10 avril 23:09 /home/mahdiaqallal


This doesn’t look correct. The mountpoint should be simply /home, not /var/home.

Can you also post your output of lsblk -f? Just to verify the correct UUID in the fstab.

Edit: Can you also print the output of ls -la /home/? Similar to my previous question, but please note the extra / at the end of “home” this time.

I believe on silverblue that is correct, though I do not have it installed to verify.

My main machine is Kinoite. The default home mountpoint is /home in fstab. The root filesystem has a symlink from /home → /var/home. I find it difficult to understand what the ramifications are of these two things combined, but I’m sure /etc/fstab has always had the mountpoint as /home. If anyone can explain to me in simple terms how a mountpoint to a symlink works, I’d be interested in learning.

The mount works the same as any other access via a symlink. Mounting to /home is redirected and the mount actually occurs at /var/home which is the physical mount point. fstab and most other actions still use /home for access since that is standard everywhere but the mutable directory structure resides under /var/home.

This is just one of those vagaries that have cropped up with immutable OSes.

I think the OP may have an error in his fstab by mounting directly to /var/home. It likely should be similar to yours and be mounted to /home while allowing the system to handle the symlink redirect. I have no system on which to test that theory though.

1 Like