-
Notifications
You must be signed in to change notification settings - Fork 20
VMware
Gabor Szarnyas edited this page Jan 29, 2020
·
12 revisions
There is an official VMware tutorial, which recommends using the vmkfstools
, which is not installed by default. Instead of using that, simply perform some search-and-replacing and rename the files. For example, to rename the Rete-Lab-2017
image to IVT-Lab-2017
, follow this guide:
-
Edit the
vmx
andvmdk
files:sed -i "s/old_substring/new_substring/" *.vmx sed -i "s/old_substring/new_substring/" *.vmdk
-
Rename the files. Use the dry run (
-n
) switch for testing and remove it for the final run:rename -f "s/old_substring/new_substring/" *
Be careful as both sed
and rename
use regex matching, and even their regex syntax (standards vs. extended vs. Perl) can differ.
An automated version with environment variables is listed below. Careful, this will actually perform the rename.
export VM_PREFIX*=
export OLD=
export NEW=
sed -i "s/$OLD/$NEW/" $VM*.vmx
sed -i "s/$OLD/$NEW/" $VM*.vmdk
rename -f "s/$OLD/$NEW/" $VM*.*
An example configuration:
export VM=Rete-Lab-2017
export OLD=Rete-Lab
export NEW=IVT-Lab