Home partition on subvolume

Hi guys.

I’ve made stupid thing and delete home subvolume - (yes I know).

So I’ve made new subvolume:
cd /
btrfs subvolume create /home
And restore from backup. So far so good.

In /etc/fstab I have line:
UUID=5aa7d0c4-fd54-438e-825c-7a068266e363 /home btrfs subvol=home 0 0

but during boot, system inform me that this device doesn’t exist.

Oct 4 22:38:27 srv systemd[1]: Reached target Local File Systems (Pre).
Oct 4 22:38:27 srv systemd[1]: Mounting /home…
Oct 4 22:38:27 srv systemd[1]: Mounting /u0…
Oct 4 22:38:27 srv systemd[1]: Mounting /u1…
Oct 4 22:38:27 srv systemd[1]: Condition check resulted in Virtual Machine and Container Storage (Compatibility) being skipped.
Oct 4 22:38:27 srv systemd[1]: Starting File System Check on /dev/disk/by-uuid/3e184f71-5362-4112-b95a-033787d52a01…
Oct 4 22:38:27 srv mount[644]: mount: /home: wywołanie systemowe mount(2) nie powiodło się: Nie ma takiego pliku ani katalogu. (ENG: system call failed. File or directory does not exist)
Oct 4 22:38:27 srv kernel: BTRFS info (device sdb): flagging fs with big metadata feature
Oct 4 22:38:27 srv kernel: BTRFS info (device sdb): disk space caching is enabled
Oct 4 22:38:27 srv systemd[1]: home.mount: Mount process exited, code=exited, status=32/n/a
Oct 4 22:38:27 srv systemd[1]: home.mount: Failed with result ‘exit-code’.
Oct 4 22:38:27 srv systemd[1]: Failed to mount /home.
Oct 4 22:38:27 srv systemd[1]: Dependency failed for Local File Systems.
Oct 4 22:38:27 srv systemd[1]: Dependency failed for Collectd statistics daemon.
Oct 4 22:38:27 srv systemd[1]: collectd.service: Job collectd.service/start failed with result ‘dependency’.
Oct 4 22:38:27 srv systemd[1]: local-fs.target: Job local-fs.target/start failed with result ‘dependency’.
Oct 4 22:38:27 srv systemd[1]: local-fs.target: Triggering OnFailure= dependencies.
Oct 4 22:38:27 srv systemd[1]: systemd-ask-password-wall.path: Succeeded.

root@srv system]# btrfs subvolume list /
ID 258 gen 8101547 top level 5 path root
ID 307 gen 8100515 top level 258 path var/lib/machines
ID 481 gen 8100515 top level 258 path var/lib/portables
ID 533 gen 3905656 top level 258 path snaps/snap_root_01122019
ID 561 gen 4642234 top level 258 path .snapshot/root-07112020
ID 611 gen 8100452 top level 258 path home
[root@srv system]#

Any advise what I’m doing wrong?

Best regards.
Michał.

1 Like

Hi Vladislav, thank you for your suggestion.

I’ll will try to regenerate initramsfs, and I’ll let know about results.

Regards.
Michał

1 Like

I advise you, if you snapshot the root, to create the home volume on the toplevel, in your case you have created it nested inside the root volume.
For more information: https://btrfs.wiki.kernel.org/index.php/SysadminGuide#Layout

sudo mount /dev/sdXY /mnt
sudo btrfs subvol create /mnt/home
2 Likes

Hi guys.

As said @emanuc the problem lay in where subvolume was placed.
It should be on the toplevel instead of /root. That why system couldn’t find it.

Thank You very much.

Below what I did for others unfamiliar with btrfs fedora users:


1. Boot from rescue usb (I not sure if that step is necessary)
2. mount /dev/sda3 /mnt
3. rename old home
    cd /mnt/root; mv ./home ./home_old
4. btrfs subvol create /mnt/home
5. Uncoment in /mnt/root/fstab: UUID=5aa7d0c4-fd54-438e-825c-7a068266e363 /home btrfs subvol=home 0 0 
5. reboot system

You can move subvolume just like directories. So your step 3. above can just be:

mv /mnt/root/home /mnt

And that’s it. Now the original fstab entry will work. And its the same layout as what the installer uses: both the subvolumes named “root” and “home” are placed in the top-level of the file system, and those subvolumes are what get mounted to the mount points / and /home respectively.

A variation on this is to do the move without a USB stick, and instead use the systemd debug shell with boot parameter systemd.debug-shell=1 which will provide a root shell at tty9. Just switch to tty9, mount the file system to /mnt and rename/move per the above. And then reboot.

3 Likes

Hi Chris. I didn’t realize that is such thing as “debug shell”. I reckon it will be very helpful.

Best regards.
Michał.