2023年1月6日 星期五

Detect if a VM is running in Google Compute Engine

Detect if a VM is running in Compute Engine

sudo dmidecode -s system-product-name | grep "Google Compute Engine"
這個需要 root 權限,實際上是去讀取 /sys/firmware/dmi/tables/DMI
用 strings /sys/firmware/dmi/tables/DMI | grep "Google Compute Engine" 也行

若程式沒有 root 權限,可以去讀取 /etc/hosts 有沒有包含 Added by Google 字樣
grep "Added by Google" /etc/hosts

沒有留言:

ESXi find what process lock file

ESXi 檔案刪不掉,出現 Device or resource busy 若檔案名稱是 windows-10-flat.vmdk 下此指令就可以知道那邊佔用 ps | grep `lsof | awk '/windows-10-flat.vmdk/ {print $1...