VMware Archive

Corrupted vmdk and vmsd files

I wanted to blog here about a silly mistake I made yesterday.

I need to expand a VM’s disk and was using the ol’ vmkfstools -X. However, I obviously do this all too flippantly and forgot to check if there was any snapshots. oops. That sunken feeling.

I corrupted the vmdk and the snapshot vmsd file.

Here’s how I fixed it all.

Firstly I couldn’t run anything against the original vmdk file, as it kept saying the file was locked by the host. I unregistered the VM from VC, put the ESX server into maintenance mode (which moved all the VMs off to other hosts in the clustering – fully enabled DRS) and power cycled the host. This remove the lock on the file thankfully.

The original vmdk had been 20GB before I tried expanding it to 30GB. So I created a new 20GB vmdk:
# vmkfstools -c 20G -d thick silver1.vmdk

I then copied the contents of the broken 30GB disk into the new one:
# dd if=silver-flat.vmdk of=silver1-flat.vmdk bs=1048576 count=20480

Moved the old vmdk and renamed the new one:
# vmkfstools -E silver.vmdk silver.vmdk.old
# vmkfstools -E silver1.vmdk silver.vmdk

All the snapshots rely upon a CID and a parentCID in their -00000x.vmdk files. I opened both snapshot disks to record the details.
# cat silver-000001.vmdk
# cat silver-000002.vmdk

Basically, 000002 parentCID is 000001′s CID. In turn 000001 parentID was set to point to the original vmdk. So I had to edit the new vmdk file and set this CID.
# vi silver.vmdk

I was then able to power on the VM. Phew!

However the snapshots were still screwed up. When I tries to commit the snapshots with:
# vmware-cmd silver.vmx removesnapshots

It thought it didn’t have any snapshots, but it was clearly using the two additional vmdk disks. The vmsd file was also corrupted. So I renamed the existing one:
# mv silver.vmsd silver.vmsd.old

Then I created a new snapshot, to re-generate a new vmsd file:
# vmware-cmd silver.vmx createsnapshot recreate_vmsd

And finally I could commit the snapshots:
# vmware-cmd silver.vmx removesnapshots

Now all that was left was to increase the disk:
#vmkfstools -X 30G silver.vmdk

I guess I won’t be doing that in a hurry again :)

Tags: ,

VMware Server 2 beta

I managed to spend some time this morning playing with the new VMware Server 2 beta.
Firstly, a few things I had to do to get it working on a fairly vanilla Ubuntu Gutsy (7.10) install:

  • Install xinetd:

$ sudo apt-get install xinetd

  • Get a VMware Server (1.x) serial number from here:
  • Untar the tar.gz file and run the vmware-install.pl (with sudo)
  • When prompted, run the vmware-config.pl script. The default answers should suffice for most set-ups. I already had some VMs in my home folder, so I changed the default location for the datastore.
  • I then had to reboot my laptop, as a “vmware-mgmt restart” still wouldn’t allow the web interface to start.
  • There was no menu items added, but opening a browser to https://localhost:8333 allows you log into the Web Interface.

The Web Access is obviously based on the same tomcat Web Access as VI3, with a few extras. It seems to have more host options than the ESX3/VC2 Web Access (but I don’t have any access to one right now so I can’t be sure). There is no native console anymore, you can see plenty of disapproving comment about this in this forum post: http://communities.vmware.com/thread/112788

The Web Access is obviously the way that VMware are pushing for their Server product. This allows a smoother upgrade to VI3, and makes Server more like a baby ESX, rather than a free Workstation. I can understand why they want to do this, but it highlights a missing piece of the puzzle – there is still no VI Client for Linux/Mac users. I’ve never understood the reason for VMware creating its VI Client as a Windows only .net application. The old Server console (and Workstation) is based on a native console (GTK based?), which works very well in Windows and Linux.

This brings me on to an even bigger bug-bear, which is why the VC Server isn’t a Virtual Appliance based on a LAMP stack. The VC server can happily use a mySQL database. The web server is already there. If they had just written the VC server component in a cross platform way then we could install this on Linux (or a Windows server). I don’t see any point in paying for yet another Windows license, when this could be a downloadable VM. Anway, that’s for another post…

So rather than begging VMware to re-instate the old native console for this, I would rather see then drop the existing VI Client and re-write this as a cross platform client.

Not there quite yet…

Just to give you all a bit of an update. I’m pretty busy with my move to Vancouver, but I have been plugging away on things. Desperately trying to squeeze in a few more lines in the Backup/Storage/Resources page, but things are tight. I’m not that far away from publishing 1.0, but I’m off tonight for the next few weeks on holiday, before I arrive in Vancouver. Hopefully I should publish this soon though. My apologies if I don’t reply to any emails for a few days, as I might not be anywhere near an internet connection.

Closing in

At last. Version 0.9 is online . I consider this to be pretty much "feature complete". I just need help to tell me if you think there is anything inaccurate, missing or out-of date. I will tidy up the general formatting in the meantime, but please let me know what you all think. Once I’ve released version 1.0 sometime later this week or next, I won’t update it very often. So if you think it can be improved then speak now!

I’m already thinking about what to do for the 3i guide, but I leave for Vancouver at the end of next week, so things might slow for a few weeks. Hopefully my next job will involve lots of VMware work again, so I can continue to create similar guides. Let me know if you have any advice here :)

storage goodness

I’ve uploaded 0.8 to the usual place , with the storage section done. I’ve included some storage CLI stuff, but I might rip this back out if I am running low on space. Normally I wouldn’t use these as the VIC is the best tool for this. The only time I can see the commands being used is for scripting or kickstart options. Let me know if you think they should stay. I’d be interested if people use them.

Also, as I mentioned on the VMware forum post , I’ve removed the Management Agent section (for space reasons again), and included links in the install section.

Please let me know if you know of a link to a good HP Insight Manger guide. Or better links than the other ones I have.

here we go again

Version 0.7 is done.

I’ve been fiddling with the networking section to get it as good as I can. This is the one section where I do need to use a few COS commands, as sometimes its the only way. I’m pretty happy with its "facts to size" ratio.

Unfortunately, I think the planned section for the common hardware management agents (IBM Director, Dell OpenManage & HP InsightManager) is going to have to be dropped. I just don’t think I’m going to have space. I think I could do IBM director in 4 lines, but I’m not so familiar with the other two (anyone got any links to Dell’s and HP’s setups?) I’ll just need to wait and see. I’ve still got Storage (FC, iSCSI & NFS), Resources (DRS, Resource Pools, Clusters & HA) and VCB, all to squeeze into one column. Eek.

As usual, let me know if you have any comments.

3i USB key

I managed to get my hands on a VMworld 3i USB key and was also accepted into the 3.5 beta programme. Both on the same day. However, it means that I’m now bound by the beta rules, until 3.5 goes GA.

I am already starting to draft a 3i command vreference card, as there is loads of good information available on the web:

http://scalethemind.com/

http://www.ntpro.nl/blog/

Mike Laverik of RTFM fame has written one of his guides for this , but as its only available to those who attended VMworld and VCIs, I guess I’ll have to wait. It be interesting what he manages to find and what I miss.

Tags: ,

Version 0.6

Version 0.6 of the ESX3 vreference card is out! Grab it here .

The big addition is the ESX host section. However, I have also added in some folding guides and increased the size of the text boxes so I can squeeze even more ESX goodness in. It works OK with the two printers I have access to, but if it causes an issue for lots of people I’ll revisit this.

Once I have got this card to 1.0 and things have settled down, I plan to release a "letter" sized version.

first release

I’ve just published version 0.5 of the ESX3 vmreference card.

The first public release :)