Proxmox
Augmenter la taille d'un disque d'une VM Linux sur Proxmox
- Grossir la partition dans le GUI de Proxmox Dans la VM...
sync
partprobe
blockdev --rereadpt /dev/vdc
parted /dev/vdc
GNU Parted 3.2
Using /dev/vdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) resizepart 1
Warning: Not all of the space available to /dev/vdc appears to be used, you can fix the GPT to use all of the space (an extra 10485760 blocks) or continue with the current setting?
parted: invalid token: 1
Fix/Ignore? F
Partition number? 1
Warning: Partition /dev/vdc1 is being used. Are you sure you want to continue?
Yes/No? Yes
End? [64.4GB]? 100%
(parted) print
Model: Virtio Block Device (virtblk)
Disk /dev/vdc: 69.8GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 64.4GB 64.4GB ext4
(parted) quit
Information: You may need to update /etc/fstab.
partprobe
resize2fs /dev/vdc1
df -ht ext4
partprobe
blockdev --rereadpt /dev/vdc
List Proxmox VMs
arr_pmx=( $(find /etc/pve/nodes/ -mindepth 1 -maxdepth 1 -type d | sort) )
for pmx in ${arr_pmx[@]}; do
arr_files=( $(find ${pmx}/qemu-server/ -mindepth 1 -maxdepth 1 -type f -iname "*.conf" | sort) )
for file in ${arr_files[@]}; do
file_name="$(basename ${file})"
vm_id="${file_name%.conf}"
if [ -z "${vm_id}" ]; then
vm_id='EMPTY'
fi
vm_name="$(grep 'name:' ${file}| head -1 | awk '{print $2}')"
if [ -z "${vm_name}" ]; then
vm_name='NO_NAME'
fi
echo -en "${vm_name} (${vm_id})\n"
done
done
List all active VMs in a pool
# The selected pools are MY-POOL1 and MY-POOL2 in the example below
declare -a active_vm=( $(pvesh get /cluster/resources --type vm --noborder | grep -E 'MY-POOL1|MY-POOL2' | grep 'running' | awk '{print $1}' | cut -d '/' -f 2 | sort) )
for vm_id in ${active_vm[@]}; do
declare -a arr_files=( $(find /etc/pve/nodes/ -type f -iname ${vm_id}.conf) )
for file in ${arr_files[@]}; do
vm_name="$(grep -F 'name:' ${file} | head -1 | awk '{print $2}')"
if [ -z "${vm_name}" ]; then
vm_name='NO_NAME'
fi
echo -en "${vm_name} (${vm_id})\n"
done
done
Sort la liste des VMs active dans PROXMOX
arr_pmx=( $(find /etc/pve/nodes/ -mindepth 1 -maxdepth 1 -type d | sort) )
for pmx in ${arr_pmx[@]}; do
active_vm=$(echo -en "${pmx} | grep -v 'stopped'")
if [ -z "${active_vm}" ]; then
echo "${active_vm}"
fi
done
Get a quick overview on how fast your system is
pveperf
Verify the subscription status of your hardware node
pvesubscription get
Start a backup of machine 101:
vzdump 101 -compress lzo
~~~bash
## PVE Cluster Manager see manual
~~~bash
man pvecm
Restart every single Proxmox services:
service pve-cluster restart && service pvedaemon restart && service pvestatd restart && service pveproxy restart
Proxmox VE version info - Print version information for Proxmox VE packages
pveversion
Find next free VM ID
pvesh get /cluster/nextid
View sum of memory allocated to VMs and CTs
grep -R memory /etc/pve/local | awk '{sum += $NF } END {print sum;}'
View sorted list of VMs like vmid proxmox_host type
cat /etc/pve/.vmlist | grep node | tr -d '":,'| awk '{print $1" "$4" "$6 }' | sort -n | column -t
View sorted list of vmid
cat /etc/pve/.vmlist | grep node | cut -d '"' -f2 | sort -n
Various:
find . -type f -name "*.conf" -exec cat {} \; | grep unused
pvesh get /pools/LAB-pool --output-format json | python -c 'import json,sys;print json.load(sys.stdin)["members"]'
pvesh get /pools/LAB-pool --output-format json | python -m json.tool | grep name | cut -d ':' -f 2
cat /etc/pve/.vmlist | grep node | tr -d '":,'| awk '{print $1" "$4" "$6 }' | sort -n | column -t
pvesm list ecpool | cut -d ":" -f 2 | awk '{print $1}'| sed 's/-disk-[0-9]//g' | sed 's:base-[0-9]*/::g' | sort | uniq | wc -l