Merge branch 'btrfs-no-subvolume' into calamares

FIXES #1837
This commit is contained in:
Adriaan de Groot 2021-12-02 22:09:25 +01:00
commit 310d67cf27
3 changed files with 15 additions and 3 deletions

View File

@ -258,7 +258,8 @@ class FstabGenerator(object):
if mount_point == "/": if mount_point == "/":
self.root_is_ssd = is_ssd self.root_is_ssd = is_ssd
if filesystem == "btrfs" and "subvol" in partition: # If there's a set-and-not-empty subvolume set, add it
if filesystem == "btrfs" and partition.get("subvol",None):
options = "subvol={},".format(partition["subvol"]) + options options = "subvol={},".format(partition["subvol"]) + options
if has_luks: if has_luks:

View File

@ -191,6 +191,8 @@ def mount_partition(root_mount_point, partition, partitions):
libcalamares.globalstorage.insert("btrfsSubvolumes", btrfs_subvolumes) libcalamares.globalstorage.insert("btrfsSubvolumes", btrfs_subvolumes)
# Create the subvolumes that are in the completed list # Create the subvolumes that are in the completed list
for s in btrfs_subvolumes: for s in btrfs_subvolumes:
if not s["subvolume"]:
continue
subprocess.check_call(["btrfs", "subvolume", "create", subprocess.check_call(["btrfs", "subvolume", "create",
root_mount_point + s["subvolume"]]) root_mount_point + s["subvolume"]])
if s["mountPoint"] == "/": if s["mountPoint"] == "/":

View File

@ -42,15 +42,24 @@ extraMountsEfi:
mountPoint: /sys/firmware/efi/efivars mountPoint: /sys/firmware/efi/efivars
# Btrfs subvolumes to create if root filesystem is on btrfs volume. # Btrfs subvolumes to create if root filesystem is on btrfs volume.
# If mountpoint is mounted already to another partition, it is ignored. # If *mountpoint* is mounted already to another partition, it is ignored.
# Separate subvolume for swapfile is handled separately and automatically. # Separate subvolume for swapfile is handled separately and automatically.
#
# It is possible to prevent subvolume creation -- this is likely only relevant
# for the root (/) subvolume -- by giving an empty string as a subvolume
# name. In this case no subvolume will be created. When using snapper as
# a rollback mechanism, it is recommended to **not** create a subvolume
# for root.
btrfsSubvolumes: btrfsSubvolumes:
- mountPoint: / - mountPoint: /
subvolume: /@ subvolume: /@
# As an alternative:
#
# subvolume: ""
- mountPoint: /home - mountPoint: /home
subvolume: /@home subvolume: /@home
- mountPoint: /var/cache - mountPoint: /var/cache
subvolume: /@cache subvolume: /@cache
- mountPoint: /var/log - mountPoint: /var/log
subvolume: /@log subvolume: /@log