photon icon indicating copy to clipboard operation
photon copied to clipboard

Dynamic disk space partitioning during installation with a kick start file

Open khaaliid opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe.

We are using kickstart file to fully automate the OS installation. But recently we have different hard-disk storage volumes (500GB, 700GB, 1TB ...etc.). As of now we have to create multiple copies of the ISO image to handle that. This is a little bit hard to maintain and troubleshoot if any issue happened.

Describe the solution you'd like

Is it possible to have a parameter under the "partition" field to accept partition size as a precentage instead of the actual value.

As of now the partition feild looks like : {"mountpoint": "/boot", "size": 128, "filesystem": "ext4"} Expected : {"mountpoint": "/boot", "sizeprecent": 10, "filesystem": "ext4"}

as per above example the /boot will have a 10% of the harddrive.

Describe alternatives you've considered

We have to create multiple copies of the ISO image

Additional context

No response

khaaliid avatar May 09 '22 10:05 khaaliid

+1 The class in installer.py handles kickstart command options. With respect to the implementation, in terms of resiliency of physical volumes > volume group > logical volumes > file systems (partitions), a feature 'sizepercent' for /boot does not exist, actually /boot on lvm is not supported. It may be a sweet spot to anticipate sort of inheritance of installer subclasses (storage+packages) for Photon OS release version + flavors.

dcasota avatar May 10 '22 09:05 dcasota

As of now 'sizepercent' option doesn't exist in installer. However, you can explore 'preinstall' and 'preinstallscripts' feature to calculate the size as per your requirement and value can be updated dynamically in kickstart file before installation starts. Please refer for example: https://github.com/vmware/photon-os-installer/blob/52c657ed4c512b85a713b5e79c5de0dbff67b7fe/photon_installer/ks_config.txt#L241

jaankit avatar Nov 10 '22 06:11 jaankit

@jaankit fyi

E.g. on Rpi4 ESXiOnArm, the Photon 4.0 vm disk by-path output is:

  ls -lh /dev/disk/by-path/
total 0
lrwxrwxrwx 1 root root  9 Nov 10 15:18 platform-40000000.pcie-pci-0000:01:00.0-ata-1 -> ../../sda
lrwxrwxrwx 1 root root  9 Nov 10 15:18 platform-40000000.pcie-pci-0000:01:00.0-ata-1.0 -> ../../sda
lrwxrwxrwx 1 root root 10 Nov 10 15:18 platform-40000000.pcie-pci-0000:01:00.0-ata-1.0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Nov 10 15:18 platform-40000000.pcie-pci-0000:01:00.0-ata-1.0-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Nov 10 15:18 platform-40000000.pcie-pci-0000:01:00.0-ata-1-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Nov 10 15:18 platform-40000000.pcie-pci-0000:01:00.0-ata-1-part2 -> ../../sda2
lrwxrwxrwx 1 root root  9 Nov 10 15:01 platform-40000000.pcie-pci-0000:01:00.0-ata-2 -> ../../sr0
lrwxrwxrwx 1 root root  9 Nov 10 15:01 platform-40000000.pcie-pci-0000:01:00.0-ata-2.0 -> ../../sr0

this would match to

"disk": "$DISK"
			"preinstall": [
                                "#!/bin/sh",
                                "ondisk=$(ls -lh /dev/disk/by-path/ | grep 'pci-0000:01:00.0' | cut -d' ' -f 9)",
                                "export DISK=\"/dev/disk/by-path/$ondisk\""
                                ] }

On ESXi 8.0, the Photon 3.0 vm disk by-path output is:

ls -lh /dev/disk/by-path/
total 0
lrwxrwxrwx 1 root root  9 Nov 10 11:27 pci-0000:00:07.1-ata-2 -> ../../sr0
lrwxrwxrwx 1 root root  9 Nov 10 11:30 pci-0000:03:00.0-scsi-0:0:0:0 -> ../../sda
lrwxrwxrwx 1 root root 10 Nov 10 11:30 pci-0000:03:00.0-scsi-0:0:0:0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Nov 10 11:30 pci-0000:03:00.0-scsi-0:0:0:0-part2 -> ../../sda2
root@photon-machine [ ~/workspaces/photon ]#

this would match to

"disk": "$DISK"
			"preinstall": [
                                "#!/bin/sh",
                                "ondisk=$(ls -lh /dev/disk/by-path/ | grep 'scsi-0:0:1:0' | cut -d' ' -f 9)",
                                "export DISK=\"/dev/disk/by-path/$ondisk\""
                                ] }

There are additional "thinkable" identifiers

  • platform-fe3400000.mmc-partx
  • pci-xxxx:xx:xx.x-usb-x:x.x:x.x-scsi-x:x:x:x
  • ip-a.b.c.d:3260-iscsi-iqn.<identifier>-lun-x
  • pci-xxxx:xx:xx.0-nvme-x
  • pci-<identifier>-fc-...-lun-x

How can preinstall help? In theory there is a thinkable todo/doing/done matrix with identifiers and actual Photon flavor implementations.

Docs advices about status quo, "exploreable worthy" and "do not try you have been warned" would be very helpful.

dcasota avatar Nov 10 '22 18:11 dcasota