<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Lostdomain.org &#187; snapshot</title>
	<atom:link href="http://lostdomain.org/tag/snapshot/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostdomain.org</link>
	<description>To find yourself, think for yourself</description>
	<lastBuildDate>Wed, 04 Apr 2012 13:30:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Snapshot hell: Recover a locked vmdk</title>
		<link>http://lostdomain.org/2009/05/14/recover-locked-vmdk/</link>
		<comments>http://lostdomain.org/2009/05/14/recover-locked-vmdk/#comments</comments>
		<pubDate>Thu, 14 May 2009 18:50:15 +0000</pubDate>
		<dc:creator>Martijn</dc:creator>
				<category><![CDATA[vmware]]></category>
		<category><![CDATA[snapshot]]></category>

		<guid isPermaLink="false">http://lostdomain.org/?p=87</guid>
		<description><![CDATA[I&#8217;ve had my share of battles with corrupt vmdk files, after the process of removing a snapshot crashed. Finally, I found a way to recover them through a VCB utility. Here&#8217;s the log that usually presents itself: May 12 01:43:13.593: vmx&#124; DISKLIB-DSCPTR: Failed to open extents for descriptor file in normal mode May 12 01:43:13.593: [...]<div class="addthis_toolbox addthis_default_style" addthis:url='http://lostdomain.org/2009/05/14/recover-locked-vmdk/' addthis:title='Snapshot hell: Recover a locked vmdk' ><a class="addthis_button_twitter"></a><a class="addthis_button_facebook like"></a><a class="addthis_button_google"></a><a class="addthis_button_email"></a><a class="addthis_button_preferred_1"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[I&#8217;ve had my share of battles with corrupt vmdk files, after the process of removing a snapshot crashed. Finally, I found a way to recover them through a VCB utility. Here&#8217;s the log that usually presents itself:

<blockquote>May 12 01:43:13.593: vmx| DISKLIB-DSCPTR: Failed to open extents for descriptor file in normal mode
May 12 01:43:13.593: vmx| DISKLIB-LINK  : &#8220;/vmfs/volumes/49dc603e-af139aaa-7131-002219b6f201/VM1/VM1.vmdk&#8221; : failed to open (Device or resource busy).  
May 12 01:43:13.593: vmx| DISKLIB-CHAIN : &#8220;/vmfs/volumes/49dc603e-af139aaa-7131-002219b6f201/VM1/VM1.vmdk&#8221; : failed to open (Device or resource busy).
May 12 01:43:13.594: vmx| DISKLIB-LIB   : Failed to open &#8216;/vmfs/volumes/49dc603e-af139aaa-7131-002219b6f201/VM1/VM1.vmdk&#8217; with flags 0xa (Device or resource busy).
May 12 01:43:13.594: vmx| DISK: Cannot open disk &#8220;/vmfs/volumes/49dc603e-af139aaa-7131-002219b6f201/VM1/VM1.vmdk&#8221;: Device or resource busy (1048585).
May 12 01:43:13.594: vmx| Msg_Post: Error
May 12 01:43:13.594: vmx| [msg.disk.noBackEnd] Cannot open the disk &#8216;/vmfs/volumes/49dc603e-af139aaa-7131-002219b6f201/VM1/VM1.vmdk&#8217; or one of the snapshot disks i
t depends on.
May 12 01:43:13.594: vmx| [msg.disk.configureDiskError] Reason: Device or resource busy.</blockquote>

We will use the vcbExport utility to read the data from the old vmdk and create a new one. 

First, unregister the VM from your ESX host (if not done already):

<blockquote># cd /vmfs/volumes/49dc603e-af139aaa-7131-002219b6f201/
# vmware-cmd -s unregister `pwd`/VM1/VM1.vmx
unregister(/vmfs/volumes/49dc603e-af139aaa-7131-002219b6f201/VM1/VM1.vmx) = 1</blockquote>

Then move the old VM directory and create a new one:

<blockquote># mv VM1 VM1.old
# mkdir VM1
# cd VM1</blockquote>

Then, convert the old vmdk to a new one:

<blockquote># vcbExport -M 1 -F 1 -d VM1.vmdk -s ../VM1.old/VM1.vmdk</blockquote>

This will take a while, depending on the size of your disks. After all, it is copying the entire data file. Do the same for the other vmdk&#8217;s, if you have more than one disk.

After you finish with vcbExport, we need to alter a few things to the .vmdk file(s); open it in your favorite editor.

Change:

<blockquote>createType=&#8221;monolithicFlat&#8221;</blockquote>

To:

<blockquote>createType=&#8221;vmfs&#8221;</blockquote>

Change: 

<blockquote>RW 56124534 FLAT &#8220;VM1-flat.vmdk&#8221; 0</blockquote>

To:

<blockquote>RW 56124534 VMFS &#8220;VM1-flat.vmdk&#8221;</blockquote>

Copy .vmx and .vmxf file

<blockquote># cp ../VM1.old/VM1.vmx* .</blockquote>

After that, you can register and start the VM again:

<blockquote># vmware-cmd -s register VM1.vmx
register(/vmfs/volumes/49dc603e-af139aaa-7131-002219b6f201/VM1/VM1.vmx) = 1
# vmware-cmd VM1.vmx start
start() = 1</blockquote>

The VM will require an answer on the UUID matter (choose &#8216;Keep&#8217;) before it actually boots:

<blockquote># vmware-cmd VM1.vmx answer</blockquote>

<div class="addthis_toolbox addthis_default_style" addthis:url='http://lostdomain.org/2009/05/14/recover-locked-vmdk/' addthis:title='Snapshot hell: Recover a locked vmdk' ><a class="addthis_button_twitter"></a><a class="addthis_button_facebook like"></a><a class="addthis_button_google"></a><a class="addthis_button_email"></a><a class="addthis_button_preferred_1"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://lostdomain.org/2009/05/14/recover-locked-vmdk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

