feat(esh-pve-2): drop stale 1 TB boot entry, wipe it into LVM-thin storage vmstore
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
# esh-pve-2 (MS-03, ESH) disk prep, 2026-10-02, at Prime's request:
|
||||
# - 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.0.10.70 --playbook playbooks/esh-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 199A3537K01N ESP PARTUUID a64d873f-… VG pve (root)
|
||||
# data CT1000E100SSD8 (Crucial 1 TB) serial 2611EAD0291A ESP PARTUUID 56c18061-… VG pve-OLD-2E68F512
|
||||
# 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.*a64d873f-e2d7-4da6-882c-cef6767fb77f'
|
||||
test "$(findmnt -no PARTUUID /boot/efi)" = a64d873f-e2d7-4da6-882c-cef6767fb77f
|
||||
lsblk -nso SERIAL /dev/mapper/pve-root | grep -q 199A3537K01N
|
||||
! lsblk -nso SERIAL /dev/mapper/pve-root | grep -q 2611EAD0291A
|
||||
! lsblk -nro MOUNTPOINTS /dev/disk/by-id/nvme-CT1000E100SSD8_2611EAD0291A | 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.*56c18061-9c09-427f-8862-f531a558f630'"
|
||||
|
||||
- name: deactivate and remove the old install's volume group
|
||||
sudo: true
|
||||
shell: |
|
||||
set -e
|
||||
vgchange -an pve-OLD-2E68F512
|
||||
vgremove -y pve-OLD-2E68F512
|
||||
when: "vgs pve-OLD-2E68F512 >/dev/null 2>&1"
|
||||
|
||||
- name: remove the LVM label from the old PV
|
||||
sudo: true
|
||||
shell: pvremove -y /dev/disk/by-id/nvme-CT1000E100SSD8_2611EAD0291A-part3
|
||||
when: "pvs /dev/disk/by-id/nvme-CT1000E100SSD8_2611EAD0291A-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_2611EAD0291A-part1 /dev/disk/by-id/nvme-CT1000E100SSD8_2611EAD0291A-part2 /dev/disk/by-id/nvme-CT1000E100SSD8_2611EAD0291A-part3
|
||||
sgdisk --zap-all /dev/disk/by-id/nvme-CT1000E100SSD8_2611EAD0291A
|
||||
wipefs -a /dev/disk/by-id/nvme-CT1000E100SSD8_2611EAD0291A
|
||||
blkdiscard -f /dev/disk/by-id/nvme-CT1000E100SSD8_2611EAD0291A
|
||||
blockdev --rereadpt /dev/disk/by-id/nvme-CT1000E100SSD8_2611EAD0291A || true # PVE ships no partprobe
|
||||
udevadm settle
|
||||
when: "! vgs vmstore >/dev/null 2>&1 && test -e /dev/disk/by-id/nvme-CT1000E100SSD8_2611EAD0291A-part3"
|
||||
|
||||
- name: create LVM-thin pool + storage `vmstore` (the GUI's Disks > LVM-Thin > Create path)
|
||||
sudo: true
|
||||
shell: pvesh create /nodes/esh-pve-2/disks/lvmthin --device /dev/disk/by-id/nvme-CT1000E100SSD8_2611EAD0291A --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 56c18061-9c09-427f-8862-f531a558f630 && 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-2E68F512 >/dev/null 2>&1 && lsblk -nro NAME /dev/disk/by-id/nvme-CT1000E100SSD8_2611EAD0291A | 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"
|
||||
Reference in New Issue
Block a user