From bf8c238f0eaa2972e49b4500ef7baf92a0301bef Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Fri, 17 Feb 2017 12:58:19 +0100 Subject: [PATCH 1/2] If rootfs has a mountpoint other than /, strip it from it and any child datasets when mounting at /new_root. --- src/zfs-utils/zfs-utils.initcpio.hook | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/zfs-utils/zfs-utils.initcpio.hook b/src/zfs-utils/zfs-utils.initcpio.hook index 09d081f..ab9bf87 100644 --- a/src/zfs-utils/zfs-utils.initcpio.hook +++ b/src/zfs-utils/zfs-utils.initcpio.hook @@ -53,6 +53,7 @@ zfs_mount_handler () { fi local node="$1" + local rootmnt=$(zfs get -H -o value mountpoint "${ZFS_DATASET}") local tab_file="${node}/etc/fstab" local zfs_datasets="$(zfs list -H -o name -t filesystem -r ${ZFS_DATASET})" @@ -73,7 +74,7 @@ zfs_mount_handler () { fi ;; *) - mount -t zfs -o "zfsutil,${rwopt_exp}" "${dataset}" "${node}${mountpoint}" + mount -t zfs -o "zfsutil,${rwopt_exp}" "${dataset}" "${node}${mountpoint##${rootmnt}}" ;; esac done From 93e946155ea56305058a0d69a282772e32a62b92 Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Sat, 18 Feb 2017 00:29:16 +0100 Subject: [PATCH 2/2] If rootfs actually has the mountpoint '/', this would strip the leading slash on children, breaking the whole thing, so we have to append '/' just in case. --- src/zfs-utils/zfs-utils.initcpio.hook | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zfs-utils/zfs-utils.initcpio.hook b/src/zfs-utils/zfs-utils.initcpio.hook index ab9bf87..4337e23 100644 --- a/src/zfs-utils/zfs-utils.initcpio.hook +++ b/src/zfs-utils/zfs-utils.initcpio.hook @@ -74,7 +74,7 @@ zfs_mount_handler () { fi ;; *) - mount -t zfs -o "zfsutil,${rwopt_exp}" "${dataset}" "${node}${mountpoint##${rootmnt}}" + mount -t zfs -o "zfsutil,${rwopt_exp}" "${dataset}" "${node}/${mountpoint##${rootmnt}}" ;; esac done