diff --git a/playbooks/nh3-pve-2-disk-prep.yaml b/playbooks/nh3-pve-2-disk-prep.yaml new file mode 100644 index 0000000..a24beb0 --- /dev/null +++ b/playbooks/nh3-pve-2-disk-prep.yaml @@ -0,0 +1,86 @@ +# nh3-pve-2 (MS-03, NH3) disk prep, 2026-10-03, at Prime's request ("get rid of the grub records for everything but +# the boot drive and format the 1tb drive as vmstorage"). Same shape as playbooks/esh-pve-2-disk-prep.yaml: +# - drop the firmware boot entry for the old Proxmox install on the 1 TB drive; +# - wipe that drive and turn it into LVM-thin VM storage `vmstore`. +# scripts/elway infra-ops@10.100.250.62 --playbook playbooks/nh3-pve-2-disk-prep.yaml +# +# Disks (read live before writing this; nvme0/nvme1 numbering can swap between boots, so every +# destructive step names the drive by its by-id link, which carries the serial): +# boot KXG60ZNV256G NVMe TOSHIBA 256GB serial 69CA12VQK65N ESP PARTUUID fa4b9887-… VG pve (root) +# data CT1000E100SSD8 (Crucial 1 TB) serial 2610EAD05AB7 ESP PARTUUID 40fba75c-… VG pve-OLD-B77AB92D +# The old VG is an earlier PVE install the installer renamed; its thin pool was 0.00% used (no guest disks). +# The GRUB menu itself never listed the old install (os-prober is not installed and is disabled), so +# the only stale entry is the firmware's Boot0005 "UEFI OS" pointing at the 1 TB drive's ESP. +# +# Re-runnable: once `vmstore` exists the wipe steps skip, so a second run cannot touch the new pool. +steps: + - name: refuse unless the box booted from, and has root and /boot/efi on, the 256 GB drive + sudo: true + shell: | + set -e + efibootmgr | grep -q '^BootCurrent: 0000' + efibootmgr -v | grep -q '^Boot0000\* proxmox.*fa4b9887-1dcf-4608-a1bf-eec08d31b336' + test "$(findmnt -no PARTUUID /boot/efi)" = fa4b9887-1dcf-4608-a1bf-eec08d31b336 + lsblk -nso SERIAL /dev/mapper/pve-root | grep -q 69CA12VQK65N + ! lsblk -nso SERIAL /dev/mapper/pve-root | grep -q 2610EAD05AB7 + ! lsblk -nro MOUNTPOINTS /dev/disk/by-id/nvme-CT1000E100SSD8_2610EAD05AB7 | grep -q . + changed_when: "false" + + - name: delete firmware entry Boot0005 (old install's fallback loader on the 1 TB drive) + sudo: true + shell: efibootmgr -b 0005 -B + when: "efibootmgr -v | grep -q '^Boot0005.*40fba75c-2284-4160-8ec2-807977327287'" + + - name: deactivate and remove the old install's volume group + sudo: true + shell: | + set -e + vgchange -an pve-OLD-B77AB92D + vgremove -y pve-OLD-B77AB92D + when: "vgs pve-OLD-B77AB92D >/dev/null 2>&1" + + - name: remove the LVM label from the old PV + sudo: true + shell: pvremove -y /dev/disk/by-id/nvme-CT1000E100SSD8_2610EAD05AB7-part3 + when: "pvs /dev/disk/by-id/nvme-CT1000E100SSD8_2610EAD05AB7-part3 >/dev/null 2>&1" + + - name: wipe the 1 TB drive (partition signatures, GPT, then a full discard) + sudo: true + shell: | + set -e + wipefs -a /dev/disk/by-id/nvme-CT1000E100SSD8_2610EAD05AB7-part1 /dev/disk/by-id/nvme-CT1000E100SSD8_2610EAD05AB7-part2 /dev/disk/by-id/nvme-CT1000E100SSD8_2610EAD05AB7-part3 + sgdisk --zap-all /dev/disk/by-id/nvme-CT1000E100SSD8_2610EAD05AB7 + wipefs -a /dev/disk/by-id/nvme-CT1000E100SSD8_2610EAD05AB7 + blkdiscard -f /dev/disk/by-id/nvme-CT1000E100SSD8_2610EAD05AB7 + blockdev --rereadpt /dev/disk/by-id/nvme-CT1000E100SSD8_2610EAD05AB7 || true # PVE ships no partprobe + udevadm settle + when: "! vgs vmstore >/dev/null 2>&1 && test -e /dev/disk/by-id/nvme-CT1000E100SSD8_2610EAD05AB7-part3" + + - name: create LVM-thin pool + storage `vmstore` (the GUI's Disks > LVM-Thin > Create path) + sudo: true + shell: pvesh create /nodes/nh3-pve-2/disks/lvmthin --device /dev/disk/by-id/nvme-CT1000E100SSD8_2610EAD05AB7 --name vmstore --add_storage 1 + when: "! vgs vmstore >/dev/null 2>&1" + +verify: + - name: no firmware entry points at the old ESP; Boot0000 (256 GB) is still first + sudo: true + shell: | + ! efibootmgr -v | grep -q 40fba75c-2284-4160-8ec2-807977327287 && efibootmgr | grep -q '^BootOrder: 0000' + changed_when: "false" + - name: old VG gone; vmstore VG lives on the 1 TB drive + sudo: true + shell: | + ! vgs pve-OLD-B77AB92D >/dev/null 2>&1 && lsblk -nro NAME /dev/disk/by-id/nvme-CT1000E100SSD8_2610EAD05AB7 | grep -q '^vmstore-vmstore$' + changed_when: "false" + - name: vmstore is an active storage with images,rootdir content + sudo: true + shell: | + pvesm status --storage vmstore | grep -q ' active ' && grep -A4 '^lvmthin: vmstore' /etc/pve/storage.cfg | grep -q 'content rootdir,images\|content images,rootdir' + changed_when: "false" + - name: positive control — allocate and free a 1 GiB volume on vmstore + sudo: true + shell: | + set -e + pvesm alloc vmstore 9999 vm-9999-disk-0 1G + pvesm free vmstore:vm-9999-disk-0 + changed_when: "false"