是否有一个工具可以在选定的目录中搜索选定虚拟机的链接克隆?
或者是否有一个工具可以显示所选虚拟磁盘(文件)的父虚拟磁盘的路径.vmdk
?这将使搜索工具的潜在创建变得更加容易。
答案1
显示父 .vmdk 文件的脚本
似乎没有可以显示父.vmdk
文件的工具。有关该脚本的非常好的信息来源是VMDK 手册。
#!/bin/sh
monstart=512 # header start in monolithic vmdk
monlen=1024 # header length in monolithic vmdk
err () { echo "$@" >&2 ; exit 1 ; }
test "$#" = 1 || err Usage: vmw-vmdk-parent disk-image.vmdk
test -f "$1" || err "$1" does not seem to be a file
test -r "$1" || err "$1" is not readable
(
if test $(stat -c %s "$1") -le 1500 ; then
# separate header file (smaller than 1500 B)
cat "$1"
else
# monolithic vmdk file with embedded header
dd if="$1" status=noxfer bs=1 skip=$monstart count=$monlen 2>/dev/null
fi
) |
grep ^parentFileNameHint |
sed 's/^parentFileNameHint="\([^"]*\)"$/\1/' ||
err Error during processing "$1"