hi,
I will backup virtual Machine with the script below
all work fine until script must virtual disk copied with command vmkfstools.pl
at this time i recieve error message unable to clone virtual disk:vim.fault.invaliddatastorepath but the path is correct for other command why not for this commande, can you help me please?
Thanks in advance
Raph
SET DATASTOREPATH=/vmfs/volumes/datastore1
SET SNAPSHOTPATH=/vmfs/volumes/NFS-VMFS01
c:
cd "c:\program files\vmware\vmware vi remote cli\bin"
echo ESX: (%TIME%)
FOR /F %%A IN ('plink %USER%@%ESXHOST% -pw %PASS% ls %DATASTOREPATH%/') do call :SNAPSHOT %%A
goto end
:SNAPSHOT
echo snapshot
echo.
echo esx = %1
if "%1"=="ISO" goto end
if "%1"=="workstation1" goto end
echo.
echo VM: %1 (%TIME%)
echo Create VM Snapshot directory
plink %USER%@%ESXHOST% -pw %PASS% mkdir %SNAPSHOTPATH%/%1
echo.
echo Copy VMX file
plink %USER%@%ESXHOST% -pw %PASS% cp %DATASTOREPATH%/%1/%1.vmx %SNAPSHOTPATH%/%1
echo.
echo Remove existing Snapshots
plink %USER%@%ESXHOST% -pw %PASS% rm %SNAPSHOTPATH%/%1/%1.vmdk
plink %USER%@%ESXHOST% -pw %PASS% rm %SNAPSHOTPATH%/%1/%1_1.vmdk
echo.
rem echo Stop VM %1
rem vmware-cmd.pl -H %ESXHOST% -U %USER% -P %PASS% %DATASTOREPATH%/%1/%1.vmx stop soft
echo.
echo Take snapshot of %1
vmware-cmd.pl -H %ESXHOST% -U %USER% -P %PASS% %DATASTOREPATH%/%1/%1.vmx createsnapshot "SS1" "Nightly Snapshot" 1 1
echo.
rem echo Startup %1
rem vmware-cmd.pl -H %ESXHOST% -U %USER% -P %PASS% %DATASTOREPATH%/%1/%1.vmx start soft
rem echo.
echo Copy VM disk %1-flat.vmdk
echo.
echo %DATASTOREPATH%/%1/%1.vmdk
vmkfstools.pl --server %ESXHOST% --username %USER% --password %PASS% -a lsilogic -d thin -i /%DATASTOREPATH%/%1/%1.vmdk %SNAPSHOTPATH%/%1/%1.vmdk
vmkfstools.pl --server %ESXHOST% --username %USER% --password %PASS% -a lsilogic -d thin -i /%DATASTOREPATH%/%1/%1-flat.vmdk %SNAPSHOTPATH%/%1/%1-flat.vmdk
echo.
echo remove snapshot
vmware-cmd.pl -H %ESXHOST% -U %USER% -P %PASS% %DATASTOREPATH%/%1/%1.vmx removesnapshots
echo.
:end
pour info la commande echo %DATASTOREPATH%/%1/%1.vmdk que j'ai mis pour vérifier me donne bien le chemin : /vmfs/volumes/datastore1/test1/test1.vmdk
The datastore path cannot be like this. You must place the datastore name between "[ ]", like this:
\[datastore1\] VM_FOLDER_NAME/VM_DISK_NAME.vmdk
Marcelo Soares
VMWare Certified Professional 310/410
Technical Support Engineer
Globant Argentina
Consider awarding points for "helpful" and/or "correct" answers.
Thanks Marcelo,
but must i the fully path of the datastore given or only de datastore name
with first syntax
Unable to clone virtual disk : vim.fault.InvalidDatastore
with de second syntax
/Can't call method "fault_string" without a package or object reference at C:\Pro
gram Files\VMware\VMware VI Remote CLI\bin\vmkfstools.pl line 480.
I understand not good de solution
Thanks
Use like this:
"\[datastore1\]%1/%1.vmdk" "\[NFS-VMFS01\]%1/%1.vmdk"
Marcelo Soares
VMWare Certified Professional 310/410
Technical Support Engineer
Globant Argentina
Consider awarding points for "helpful" and/or "correct" answers.
Thanks Marcelo
But i have use like this:
"[datastore1]test1/test1.vmdk" "[NFS-VMFS01]test1/test1.vmdk"
but dat work not yet now i have always
Can't call method "fault_string" without a package or object reference at C:\Program Files\VMware\VMware VI Remote CLI\bin\vmkfstools.pl line 480.
the client machine that i use to launch wmkfstools.pl is a windows 2003 server
thanks in advance
Raph