Cloning a virtual machine disk via ESXi host

Sharing is caring!

<div dir&equals;"ltr" style&equals;"text-align&colon; left&semi;"><span itemprop&equals;"articleBody"><&sol;span><&sol;p>&NewLine;<div>&NewLine;<h3>Cloning a virtual machine disk without delta files or snapshots<&sol;h3>&NewLine;<p>To clone a virtual machine disk using the ESX&sol;ESXi host terminal&colon;<&sol;p>&NewLine;<ol>&NewLine;<li>Log into the terminal of the ESX&sol;ESXi host&period;&NewLine;<&sol;li>&NewLine;<li>Navigate to the virtual machine&&num;8217&semi;s directory using the cd command&period; It is located at&colon;&NewLine;<p><span style&equals;"font-family&colon; Courier New&semi;">&sol;vmfs&sol;volumes&sol;<i>source&lowbar;datastore<&sol;i>&sol;<i>virtual&lowbar;machine<&sol;i>&sol;<&sol;span><&sol;p>&NewLine;<&sol;li>&NewLine;<li>Confirm the destination directory where the clone will be copied to&period; Create this directory&comma; if required&period;&NewLine;<p>For example&comma; if this destination directory does not exist&colon;<&sol;p>&NewLine;<p><span style&equals;"font-family&colon; Courier New&semi;">&sol;vmfs&sol;volumes&sol;destination&lowbar;datastore&sol;virtual&lowbar;machine&sol;<&sol;span><&sol;p>&NewLine;<p>Create the directory using this command&colon;<&sol;p>&NewLine;<p><span style&equals;"font-family&colon; Courier New&semi;">mkdir &sol;vmfs&sol;volumes&sol;destination&lowbar;datastore&sol;virtual&lowbar;machine&sol;<&sol;span><br &sol;><span style&equals;"font-family&colon; Courier New&semi;"><&sol;span><span style&equals;"font-family&colon; Courier New&semi;"><br &sol;><&sol;span><&sol;li>&NewLine;<li>Clone the virtual hard disk using the <span style&equals;"font-family&colon; Courier New&semi;">vmkfstools -i<&sol;span> command after shutting down the virtual machine&colon;<br &sol;><br style&equals;"font-family&colon; Courier New&semi;" &sol;><span style&equals;"font-family&colon; Courier New&semi;">&num; vmkfstools -i &sol;vmfs&sol;volumes&sol;Storage1&sol;examplevm&sol;examplevm&period;vmdk &sol;vmfs&sol;volumes&sol;Storage2&sol;examplevm&lowbar;clone&period;vmdk<&sol;span><br &sol;>The output appears similar to&colon;&NewLine;<p><span style&equals;"font-family&colon; Courier New&semi;">Destination disk format&colon; VMFS thick<br &sol;>Cloning disk &&num;8216&semi;&sol;vmfs&sol;volumes&sol;Storage1 &lpar;3&rpar;&sol;examplevm&sol;examplevm&period;vmdk&&num;8217&semi;&&num;8230&semi;<br &sol;>Clone&colon; 100&percnt; done&period;<&sol;span><&sol;p>&NewLine;<p><span style&equals;"font-weight&colon; bold&semi;">Notes<&sol;span>&colon; <&sol;p>&NewLine;<ul>&NewLine;<li>Encapsulate objects with quotes where appropriate to ensure spaces and other special characters are interpreted correctly&period;<&sol;li>&NewLine;<li>By default&comma; the <span style&equals;"font-family&colon; Courier New&semi;">vmkfstools -i <&sol;span>command will create a destination thick provisioned disk&period; If you would like the destination disk to be thin provisioned&comma; add <span style&equals;"font-family&colon; Courier New&semi;">-d thin<&sol;span> to the end of the above command&period;&NewLine;<p>Example&colon;<&sol;p>&NewLine;<p><span style&equals;"font-family&colon; 'Courier New'&semi; font-size&colon; x-small&semi;">&num; vmkfstools -i &sol;vmfs&sol;volumes&sol;Storage1&sol;examplevm&sol;examplevm&period;vmdk &sol;vmfs&sol;volumes&sol;Storage2&sol;examplevm&lowbar;clone&period;vmdk -d thin<&sol;span><&sol;li>&NewLine;<&sol;ul>&NewLine;<&sol;li>&NewLine;<&sol;ol>&NewLine;<h3>Cloning a virtual machine disk with delta files or snapshots<&sol;h3>&NewLine;<p>To clone a virtual machine disk using the ESX&sol;ESXi host terminal&colon;<&sol;p>&NewLine;<ol>&NewLine;<li>Log into the ESX&sol;ESXi host&&num;8217&semi;s terminal&period;&NewLine;<&sol;li>&NewLine;<li>Navigate to the virtual machine&&num;8217&semi;s directory using the cd command&period; It is located at&colon;&NewLine;<p><span style&equals;"font-family&colon; Courier New&semi;">&sol;vmfs&sol;volumes&sol;<i>source&lowbar;datastore<&sol;i>&sol;<i>virtual&lowbar;machine<&sol;i>&sol;<&sol;span><&sol;p>&NewLine;<&sol;li>&NewLine;<li>Confirm the destination directory where the clone will be copied to&period; Create this directory&comma; if required&period;<span style&equals;"font-family&colon; Courier New&semi;"><br &sol;><&sol;span>For example&comma; if this destination directory does not exist&colon;&NewLine;<p><span style&equals;"font-family&colon; Courier New&semi;">&sol;vmfs&sol;volumes&sol;destination&lowbar;datastore&sol;virtual&lowbar;machine&sol;<&sol;span>Create the directory using this command&colon;<&sol;p>&NewLine;<p><span style&equals;"font-family&colon; Courier New&semi;">mkdir &sol;vmfs&sol;volumes&sol;destination&lowbar;datastore&sol;virtual&lowbar;machine&sol;<&sol;span><br &sol;><span style&equals;"font-family&colon; Courier New&semi;"><&sol;span><span style&equals;"font-family&colon; Courier New&semi;"><br &sol;><&sol;span><&sol;li>&NewLine;<li>Clone the virtual hard disk from its current snapshot delta point using the <span style&equals;"font-family&colon; Courier New&semi;">vmkfstools -i<&sol;span> command&period;<br &sol;><br style&equals;"font-family&colon; Courier New&semi;" &sol;><span style&equals;"font-family&colon; Courier New&semi;">&num; vmkfstools -i &sol;vmfs&sol;volumes&sol;Storage1&sol;examplevm&sol;examplevm-000003&period;vmdk &sol;vmfs&sol;volumes&sol;Storage2&sol;examplevm&lowbar;clone&period;vmdk<&sol;span>&NewLine;<p>The output appears similar to&colon;<&sol;p>&NewLine;<p><span style&equals;"font-family&colon; Courier New&semi;">Destination disk format&colon; VMFS thick<br &sol;>Cloning disk &&num;8216&semi;&sol;vmfs&sol;volumes&sol;Storage1 &lpar;3&rpar;&sol;examplevm&sol;examplevm-000003&period;vmdk&&num;8217&semi;&&num;8230&semi;<br &sol;>Clone&colon; 100&percnt; done&period;<&sol;span><&sol;p>&NewLine;<p><span style&equals;"font-weight&colon; bold&semi;">Note<&sol;span>&colon; If the process fails&comma; try selecting the next snapshot delta point in the snapshot tree&period; The selected point or one of its parents may be corrupt&period;<&sol;li>&NewLine;<&sol;ol>&NewLine;<&sol;div>&NewLine;<&sol;div>&NewLine;

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.