Skip to content

Instantly share code, notes, and snippets.

@t2psyto
Created July 26, 2021 01:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save t2psyto/5bca28518f3fba736721d2f13d31d9c1 to your computer and use it in GitHub Desktop.
Save t2psyto/5bca28518f3fba736721d2f13d31d9c1 to your computer and use it in GitHub Desktop.
esxi vm clone
#!/bin/sh
echo "src: /vmfs/volumes/$1"
echo "dest: /vmfs/volumes/$2"
echo "machine: $3"
ls -l /vmfs/volumes/$1/$3/
read -p "Press [Enter] key to continue."
mkdir /vmfs/volumes/$2/$3/
# copy except "*.vmdk"
ls /vmfs/volumes/$1/$3/* | grep -v -e ".vmdk$" | xargs -I {} cp -p {} /vmfs/volumes/$2/$3/`basename {}`
# copy "*.vmdk"
ls /vmfs/volumes/$1/$3/*.vmdk | grep -v -e "-flat.vmdk$" | xargs -I {} vmkfs -i {} -d thin /vmfs/volumes/$2/$3/`basename {}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment