Generate a subvolume for swap if swapfile is used
This commit is contained in:
parent
97eb32bf5c
commit
b180cbd47d
@ -77,6 +77,7 @@ def mount_partition(root_mount_point, partition, partitions):
|
|||||||
# for the root mount point.
|
# for the root mount point.
|
||||||
# If a separate /home partition isn't defined, we also create
|
# If a separate /home partition isn't defined, we also create
|
||||||
# a subvolume "@home".
|
# 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.
|
# Finally we remount all of the above on the correct paths.
|
||||||
if fstype == "btrfs" and partition["mountPoint"] == '/':
|
if fstype == "btrfs" and partition["mountPoint"] == '/':
|
||||||
has_home_mount_point = False
|
has_home_mount_point = False
|
||||||
@ -94,6 +95,13 @@ def mount_partition(root_mount_point, partition, partitions):
|
|||||||
subprocess.check_call(['btrfs', 'subvolume', 'create',
|
subprocess.check_call(['btrfs', 'subvolume', 'create',
|
||||||
root_mount_point + '/@home'])
|
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])
|
subprocess.check_call(["umount", "-v", root_mount_point])
|
||||||
|
|
||||||
device = partition["device"]
|
device = partition["device"]
|
||||||
|
Loading…
Reference in New Issue
Block a user