Skip to content

Commit e075c74

Browse files
authored
Enhance disk format script for VirtIO detection
Added checks for VirtIO disks in Proxmox/QEMU and Packer environments. Signed-off-by: enoch85 <[email protected]>
1 parent 66b94ef commit e075c74

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

disk/format-sdb.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,30 @@ then
4545
DEVTYPE=xvdb
4646
elif [[ "$SYSVENDOR" == "QEMU" ]];
4747
then
48-
SYSNAME="Proxmox/QEMU"
49-
DEVTYPE=sdb
48+
# Check if using virtio (vd*) or scsi/ide (sd*) disks
49+
if lsblk -e7 -e11 | grep -q vdb
50+
then
51+
SYSNAME="Proxmox/QEMU (VirtIO)"
52+
DEVTYPE=vdb
53+
else
54+
SYSNAME="Proxmox/QEMU"
55+
DEVTYPE=sdb
56+
fi
5057
elif [ "$SYSVENDOR" == "Red Hat" ];
5158
then
5259
SYSNAME="Red Hat"
5360
DEVTYPE=vdb
61+
elif [[ "$SYSVENDOR" == *"Packer"* ]];
62+
then
63+
# Packer build environment - check for virtio disks
64+
if lsblk -e7 -e11 | grep -q vdb
65+
then
66+
SYSNAME="Packer (VirtIO)"
67+
DEVTYPE=vdb
68+
else
69+
SYSNAME="Packer"
70+
DEVTYPE=sdb
71+
fi
5472
elif [ "$SYSVENDOR" == "DigitalOcean" ];
5573
then
5674
SYSNAME="DigitalOcean"

0 commit comments

Comments
 (0)