btrfs improvements and fixes (#2970)

This commit is contained in:
Michael Ziminsky (Z) 2024-12-01 00:35:30 -07:00 committed by GitHub
parent 60842bd1cf
commit 256f206b9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 6 deletions

View File

@ -599,12 +599,12 @@ class DeviceHandler:
self.mount(path, self._TMP_BTRFS_MOUNT, create_target_mountpoint=True)
for sub_vol in btrfs_subvols:
for sub_vol in sorted(btrfs_subvols, key=lambda x: x.name):
debug(f'Creating subvolume: {sub_vol.name}')
subvol_path = self._TMP_BTRFS_MOUNT / sub_vol.name
SysCommand(f"btrfs subvolume create {subvol_path}")
SysCommand(f"btrfs subvolume create -p {subvol_path}")
if BtrfsMountOption.nodatacow.value in mount_options:
try:
@ -653,12 +653,12 @@ class DeviceHandler:
options=part_mod.mount_options
)
for sub_vol in part_mod.btrfs_subvols:
for sub_vol in sorted(part_mod.btrfs_subvols, key=lambda x: x.name):
debug(f'Creating subvolume: {sub_vol.name}')
subvol_path = self._TMP_BTRFS_MOUNT / sub_vol.name
SysCommand(f"btrfs subvolume create {subvol_path}")
SysCommand(f"btrfs subvolume create -p {subvol_path}")
self.umount(dev_path)

View File

@ -59,7 +59,8 @@ class SubvolumeMenu(ListManager):
path = prompt_dir(
str(_("Subvolume mountpoint")),
header=header,
allow_skip=True
allow_skip=True,
validate=False
)
if not path:

View File

@ -361,7 +361,7 @@ class Installer:
subvolumes: list[disk.SubvolumeModification],
mount_options: list[str] = []
) -> None:
for subvol in subvolumes:
for subvol in sorted(subvolumes, key=lambda x: x.relative_mountpoint):
mountpoint = self.target / subvol.relative_mountpoint
mount_options = mount_options + [f'subvol={subvol.name}']
disk.device_handler.mount(dev_path, mountpoint, options=mount_options)