From de0bbbe90af7e4edf3325dae7577f26de0795ec5 Mon Sep 17 00:00:00 2001 From: dalto Date: Sat, 6 Nov 2021 14:33:43 -0500 Subject: [PATCH] [mount] Add support for zfs datasets --- src/modules/mount/main.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/modules/mount/main.py b/src/modules/mount/main.py index 2e96b6036..1b849a433 100644 --- a/src/modules/mount/main.py +++ b/src/modules/mount/main.py @@ -131,6 +131,24 @@ def mount_partition(root_mount_point, partition, partitions): ",".join([mount_option, partition.get("options", "")])) != 0: libcalamares.utils.warning("Cannot mount {}".format(device)) + if fstype == "zfs" and partition["mountPoint"] == '/': + # Get the zfs dataset list from global storage + zfs = libcalamares.globalstorage.value("zfs") + + if not zfs: + libcalamares.utils.warning("Failed to locate zfs dataset list") + + # Set the canmount property for each dataset. This will effectively mount the dataset + for dataset in zfs: + if dataset['canmount'] == 'noauto' or dataset['canmount'] == 'on': + subprocess.check_call(['zfs', 'set', 'canmount=' + dataset['canmount'], + dataset['zpool'] + '/' + dataset['dsName']]) + + # It is common for the / mountpoint to be set to noauto since it is mounted by the initrd + # If this is the case we need to manually mount it here + if dataset['mountpoint'] == '/' and dataset['canmount'] == 'noauto': + subprocess.check_call(['zfs', 'mount', dataset['zpool'] + '/' + dataset['dsName']]) + def run(): """