Skip to content

Commit

Permalink
btrfs improvements and fixes (#2970)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgziminsky authored Dec 1, 2024
1 parent 60842bd commit 256f206
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions archinstall/lib/disk/device_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,12 +599,12 @@ def create_lvm_btrfs_subvolumes(

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:
Expand Down Expand Up @@ -653,12 +653,12 @@ def create_btrfs_volumes(
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)

Expand Down
3 changes: 2 additions & 1 deletion archinstall/lib/disk/subvolume_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def _add_subvolume(self, preset: SubvolumeModification | None = None) -> Subvolu
path = prompt_dir(
str(_("Subvolume mountpoint")),
header=header,
allow_skip=True
allow_skip=True,
validate=False
)

if not path:
Expand Down
2 changes: 1 addition & 1 deletion archinstall/lib/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def _mount_btrfs_subvol(
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)
Expand Down

0 comments on commit 256f206

Please sign in to comment.