Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a tool which can search linked clones of a chosen virtual machine in selected directories?

Alternatively is there a tool which would show the path to the parent virtual disk of a selected virtual disk (.vmdk file)? This would make potential creation of the search tool much easier.

share|improve this question

1 Answer 1

Script showing parent .vmdk file

There seems to be no tool which can show parent .vmdk file. Very good source of information for the script was VMDK Handbook.

#!/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"
share|improve this answer
    
A script for searching linked clones will probably follow later :) –  pabouk Jul 28 '13 at 0:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.