Managing ESXi Without the VI Client – Part 8

So far in this series of articles I’ve covered the following items.
Part 1 – initial setup and creating a VM
Part 2 – add a license key, enable VM automatic startup and shutdown and unregister a VM
Part 3 – create a virtual switch and configure a firewall VM
Part 4 – install an update for ESXi
Part 5 – Creating a datastore and migrating VMs
Part 6 – Adding a virtual disk to a VM and resetting your license configuration
Part 7 – Deleting a virtual disk and editing VM settings

Expanding a Windows system VMDK

1) Power down the VM.

2) Run vmkfstools to expand the virtual disk. Below I expand the file to 30 GB.

# vmkfstools -X 30G CLUSTER01.vmdk
#

3) Boot the VM and then run extpart (how to) from Dell to expand the C drive.

Recovery after deleting a running VM

  /vmfs/volumes/4a68046d-2159a120-ebac-001a9253e68f/WEB01 # ls -l
   -rw-------    1 root     root          536870912 Oct 31  2009 WEB01-1a7558fd.vswp
   -rw-------    1 root     root        16106127360 Jan  9 08:34 WEB01-flat.vmdk
   -rw-------    1 root     root               8684 Jan  2 07:23 WEB01.nvram
   -rw-------    1 root     root                569 Jan  2 07:18 WEB01.vmdk
   -rw-------    1 root     root                  0 Aug  1  2009 WEB01.vmsd
   -rwxr-xr-x    1 root     root               2810 Jan  2 07:18 WEB01.vmx
   -rw-------    1 root     root               1846 Aug  1  2009 WEB01.vmxf
   -rw-r--r--    1 root     root              51075 Nov 15  2009 vmware-10.log
   -rw-r--r--    1 root     root              50538 Nov 16  2009 vmware-11.log
   -rw-r--r--    1 root     root              50825 Jan  1 08:41 vmware-12.log
   -rw-r--r--    1 root     root              50892 Oct 11  2009 vmware-7.log
   -rw-r--r--    1 root     root              54337 Oct 31  2009 vmware-8.log
   -rw-r--r--    1 root     root              53989 Nov 13  2009 vmware-9.log
   -rw-r--r--    1 root     root              51087 Jan  9 08:03 vmware.log
   /vmfs/volumes/4a68046d-2159a120-ebac-001a9253e68f/WEB01 # rm *
   rm: cannot remove 'WEB01-1a7558fd.vswp': Device or resource busy
   rm: cannot remove 'WEB01-flat.vmdk': Device or resource busy
   /vmfs/volumes/4a68046d-2159a120-ebac-001a9253e68f/WEB01 # ls
   WEB01-1a7558fd.vswp  WEB01-flat.vmdk
   /vmfs/volumes/4a68046d-2159a120-ebac-001a9253e68f/WEB01 #
 



/vmfs/volumes/4aea17ed-5267d790-647d-001a9253e63a/WEB01 # ls -l ../../datastore1/WEB01/
-rw-------    1 root     root          536870912 Oct 31  2009 WEB01-1a7558fd.vswp
-rw-------    1 root     root        16106127360 Jan 28 05:25 WEB01-flat.vmdk
/vmfs/volumes/4aea17ed-5267d790-647d-001a9253e63a/WEB01 #



1) Copy vmsd, vmxf and vmx from another server.

2) Create new VMDK file with vmkfstools

vmkfstools -c 15G -a lsilogic WEB01.vmdk

3) Copy over flat.vmdk file4) Edited vmx file

changed VM name

  • changed VMDK name
  • changed generated MAC
  • changed swap file
  • changed virtual hardware version.
/vmfs/volumes/4aea17ed-5267d790-647d-001a9253e63a/WEB01 # vim-cmd vmsvc/message 384
Virtual machine message 0:
msg.uuid.altered:This virtual machine may have been moved or copied.

In order to configure certain management and networking features, VMware ESX needs to know which.

Did you move this virtual machine, or did you copy it?
If you don’t know, answer “I copied it”.

0. Cancel (Cancel)
1. I _moved it (I _moved it)
2. I _copied it (I _copied it) [default]
/vmfs/volumes/4aea17ed-5267d790-647d-001a9253e63a/WEB01 # vim-cmd vmsvc/message 384 0 1
/vmfs/volumes/4aea17ed-5267d790-647d-001a9253e63a/WEB01 # vim-cmd vmsvc/message 384
No message.
/vmfs/volumes/4aea17ed-5267d790-647d-001a9253e63a/WEB01 #

RECOVER FROM A FAILED SHUTDOWN

/sbin # backup.sh 0 /bootbank
config implicitly loaded
lockfile: Sorry, giving up on "/tmp/bootbank.lck"
/sbin # vim-cmd vmsvc/getallvms
Failed to connect: 514 Error connecting to hostd-vmdb service instance.
/sbin # services.sh start
Running ntpd start
Starting ntpd
Running hostd start
mount: mounting visorfs on /var/lib/vmware/hostd/stats failed: File exists
Running vobd start
[6535490] Begin 'hostd ++min=0,swap,group=hostd /etc/vmware/hostd/config.xml', min-uptime = 60, max-quick-failures = 1, max-total-failures = 1000000
Vobd started.
Running slpd start
Starting slpd
Running wsman start
Starting openwsmand
Running sfcbd-watchdog start
/sbin # vim-cmd vmsvc/getallvms
Failed to connect: 514 Error connecting to hostd-vmdb service instance.
/etc/vmware/init/init.d # inetd
/etc/vmware/init/init.d # vim-cmd vmsvc/getallvms
Skipping invalid VM '32'
Vmid Name File Guest OS Version Annotation
272 DC05.vmx [datastore2] DC05/DC05.vmx winNetEnterprise64Guest vmx-07
288 UDA01 [datastore2] UDA01/UDA01.vmx otherLinuxGuest vmx-04 _esXpress: 2008-07-26 00:25 - ERR - 0/2/2 disks, (0.0%) 0m/0g/0g, Act: 10m:03s 0mb/s (0gb/hr) vs Vrt: 12m:23s 0mb/s (0gb/hr)
320 FIREWALL01 [datastore2] FIREWALL01/FreeBSD.vmx otherGuest vmx-04
336 VirtualCenter [datastore2] VirtualCenter/VirtualCenter.vmx winNetEnterprise64Guest vmx-07
368 CLUSTER01 [datastore2] CLUSTER01/CLUSTER01.vmx winNetEnterpriseGuest vmx-04
384 WEB01 [datastore2] WEB01/WEB01.vmx winNetEnterprise64Guest vmx-04
/etc/vmware/init/init.d # vim-cmd vmsvc/power.on 272
Powering on VM:


Leave a Comment

Your email address will not be published. Required fields are marked *