diff --git a/src/modules/mount/main.py b/src/modules/mount/main.py index 1313fca49..8e7dce7ba 100644 --- a/src/modules/mount/main.py +++ b/src/modules/mount/main.py @@ -77,6 +77,7 @@ def mount_partition(root_mount_point, partition, partitions): # for the root mount point. # If a separate /home partition isn't defined, we also create # a subvolume "@home". + # If a swapfile is used, we also create a subvolume "@swap". # Finally we remount all of the above on the correct paths. if fstype == "btrfs" and partition["mountPoint"] == '/': has_home_mount_point = False @@ -94,6 +95,13 @@ def mount_partition(root_mount_point, partition, partitions): subprocess.check_call(['btrfs', 'subvolume', 'create', root_mount_point + '/@home']) + swap_choice = global_storage.value( "partitionChoices" ) + if swap_choice: + swap_choice = swap_choice.get( "swap", None ) + if swap_choice and swap_choice == "file": + subprocess.check_call(['btrfs', 'subvolume', 'create', + root_mount_point + '/@swap']) + subprocess.check_call(["umount", "-v", root_mount_point]) device = partition["device"]