fix(disk-resize): keep growpart script ASCII-only
Proxmox's guest-agent exec (PVE/QemuServer/Agent.pm) dies with "Wide character in subroutine entry" when input-data contains non-ASCII bytes. The growpart script had Cyrillic comments, so the whole auto-grow call returned 500 and the FS was never resized. Replace those comments with ASCII so the script reaches the guest. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -297,7 +297,7 @@ set -u
|
|||||||
MP="{mountpoint}"
|
MP="{mountpoint}"
|
||||||
SRC="$(findmnt -nro SOURCE "$MP" 2>/dev/null)"
|
SRC="$(findmnt -nro SOURCE "$MP" 2>/dev/null)"
|
||||||
[ -z "$SRC" ] && SRC="$(awk -v m="$MP" '$2==m{{print $1}}' /proc/mounts | head -n1)"
|
[ -z "$SRC" ] && SRC="$(awk -v m="$MP" '$2==m{{print $1}}' /proc/mounts | head -n1)"
|
||||||
# Для btrfs убираем суффикс подтома вида [/@]
|
# strip btrfs subvolume suffix like [/@]
|
||||||
SRC="${{SRC%%[*}}"
|
SRC="${{SRC%%[*}}"
|
||||||
DEV="$(readlink -f "$SRC" 2>/dev/null || echo "$SRC")"
|
DEV="$(readlink -f "$SRC" 2>/dev/null || echo "$SRC")"
|
||||||
BASE="$(basename "$DEV")"
|
BASE="$(basename "$DEV")"
|
||||||
@@ -311,8 +311,8 @@ fi
|
|||||||
DISK="/dev/$PK"
|
DISK="/dev/$PK"
|
||||||
SIZE_BEFORE="$(blockdev --getsize64 "$DISK" 2>/dev/null || echo 0)"
|
SIZE_BEFORE="$(blockdev --getsize64 "$DISK" 2>/dev/null || echo 0)"
|
||||||
echo "disk bytes before rescan: $SIZE_BEFORE"
|
echo "disk bytes before rescan: $SIZE_BEFORE"
|
||||||
# Заставляем ядро перечитать новую ёмкость диска. Критично для SATA/SCSI:
|
# Force kernel to re-read disk capacity. Critical for SATA/SCSI where it
|
||||||
# capacity не обновляется на лету. Повторяем, т.к. rescan асинхронный.
|
# is not updated live. Retry because rescan is asynchronous.
|
||||||
for i in 1 2 3 4 5; do
|
for i in 1 2 3 4 5; do
|
||||||
echo 1 > "/sys/class/block/$PK/device/rescan" 2>/dev/null || true
|
echo 1 > "/sys/class/block/$PK/device/rescan" 2>/dev/null || true
|
||||||
partprobe "$DISK" 2>/dev/null || true
|
partprobe "$DISK" 2>/dev/null || true
|
||||||
|
|||||||
Reference in New Issue
Block a user