Showing posts with label VMware. Show all posts
Showing posts with label VMware. Show all posts

Thursday, June 11, 2009

VMWare: Defrag or convert your 2nd virtual hard disk

In order to defrag or convert the 2nd disk, you need to reference or create the corresponding disk descriptor file that points to your 2nd disk. A disk descriptor file is simply a plain text file with the same extension as your virtual disk (vmdk). Its file size is usually about 1 or 2 KB.

  • Go VMware Server Console (VMware Server v1) or VI (VMware Server v2).
  • Select the VM.
  • Stop/shutdown the VM if it is running.
  • Select Edit Virtual machine settings.
  • Swap your 2nd disk node with the first HD node. Make sure the end result of your 2nd disk is at (0:0) node position:
    • In the Hardware tab, select Hard Disk at (0:0) node if you are using VMware Server v1; or select Hard Disk 1 for VMware Server v2.
    • Change it to other node. For Server v1, click Advance for selection. For Server v2, the selection should be at the right pane and named with Virtual Device Node.
    • Select your 2nd hard disk and change it to (0:0) node position.
  • Click OK and exit Virtual Machine Settings.
  • A new disk descriptor file in plain text is produced and named under your 2nd HD name with a VMDK extension, e.g., W2008My2HD.vmdk.
  • For Server v1, you can directly defrag the VM via the console. Or like v2, you can use virtual disk manager for defragmentation. With VMDK text file, you can do whatever you want with Virtual Disk Manager.

Don't forget to change it back to the original setting when you're done; otherwise, your VM won't boot.

Please remember that there is no need to use virtual disk manager to defrag a virtual machine (VM) if it is created in one big flat file or a set of preallocated 2GB files. Such a VM is only needed to defrag at the Windows level.

I would recommend to use flat or preallocated 2GB type for your 2nd, 3rd, ...and etc hard disk so that you don't have go through this hassle.

Wednesday, May 27, 2009

Problem of copying big file within a VM from the host

Have you ever experienced the following error?

Cannot copy <file_name>: The specified network name is no longer available.

Regardless of which Microsoft Windows, this problem occurs whenever you use Bridged mode on VMware network. Everything works fine with Host-only or NAT.

On VMware Server 1, I can disable the automatic bridging and then reconfigure other virtual adapter (not vmnet1 or vmnet8) as Bridged network by binding it to a physical adapter. This problem will go away. But this technique doesn't work for VMware Server 2. Thus, the problem still remains unresolved. What I can do is to copy files within the host to the VM, instead of inside the VM and do copying.

I don't believe that this post is correct. VMnet1 is Host-only. Indeed, I am not sure how we can change the nature of vmnet1 and vmnet8 to Bridged. Since the author of that post was using Host-only on vmnet1, certainly copying big file problem would not be an issue.

The other thing I would like to mention is that any newly added virtual adapter is always Host-only if the VMware Server is running on Windows. I am not sure if it holds true for other platforms.

Monday, May 25, 2009

Bridged vs Host-only vs NAT

I have been using VMware since 2002. I mostly use it for my development testing. There was no free version from VMware at that time. Luckily I got exposed to both WorkStation and GSX at work. Now I can have my free virtual server installed at home. All my VMware servers are running on Microsoft platform. I have both VMware Server 1 and 2 running on different machines. I like VMware Server 1 more than Server 2 because of its simple interface (which is VMware Server Console), a bit light weight to me and no restart needed when a configuration is changed.

Most my friends are confused by the 3 different modes network setting: Bridged, Host-only and NAT. Like most people, they use the default setting, Bridged. In the following, I am going to briefly distinguish the difference among these 3 network modes. I would also point out some issues existing in each mode, from a user point of view. Those issues applies to the free versions both VMware Server 1 and 2 running on Microsoft Windows platforms. For detail of how these 3 modes work or are configured, please consult VMware documentation ( Server 1 [Install, Manual] | Server 2 User Guide ).

Each VMware network mode is associated with a named virtual adapter. You can add and remove any virtual adapter you want. On Windows, the newly added virtual adapter is only bound to Host-only network. It may not be the case if you are running the server on other platforms but I don't know. In addition, you can configure a custom adapter to assoicate with each physical network adapter to fit your need.

These three basic VMware network are listed as follows.

Mode Virtual Adapter
Bridged : vmnet0 this is the default.
Host-only : vmnet1
NAT : vmnet8

Note that the issues listed in the following table are only applied to Microsoft Windows. I am not sure if they hold true for other platforms.

Bridged (vmnet0)

Communication and Visibility: The virtual machine (VM) acts as if a regular PC ran on the same physical network. You can go Internet and do whatever you want unless your software is hardware dependent. All VMs on vmnet0 are visible to others on the same physical network and vice versa.

Performance: In my experience, the VMware Bridged network is kind of slow. On Microsoft Windows, it is much slower on a workgroup network, compared to a domain.

DHCP or Additional Service: No DHCP service is provided. If you don't have a router or DHCP server running on your network, this mode may not suit for you. In this case, you should consider either Host-only or NAT network depending on if you want Internet access.

Issues:

  • Big File Copy: Regardless of VMware Server 1 or 2, the file copying from the host inside a VM will fail when the file size is large enough. While the file is being copied from the network, the following error may occur: "Cannot copy <file_name>: The specified network name is no longer available." (Also see this)
  • Leaking IPs to physical network: The VM's IP is assigned by the physical network (e.g. your router or DHCP server). Thus, this problem doesn't apply here.

Host-only (vmnet1)

Communication and Visibility:The network communication of this mode is limited between the host and the VMs on the same vmnet1 adapter. Those VMs cannot make a connection beyond the host; thus there is no internet access capability. They remain hidden behind the host. You cannot configure it to expose any VM on vmnet1 to the physical network either.

Performance: The performance of Host-only (or vmnet1) is very fast. I usually use this setting for software testing especially when I don't need an Internet access. For example, I could run a database server inside a VM for a simple test.

DHCP or Additional Service: This mode provides DHCP sevice. If you don't have a router or a DHCP sever running on your network, this one comes in handy. This service can be disabled.

Issues:

  • Big File Copy: Unlike Bridged, I don't experience any file copy problem regardless of size (also see this).
  • Leaking IPs to physical network: VWware DHCP may assign IPs to the PCs on the physical network and cause problems. I encounter this problem when I have my VM Server running first and then my other physical PC joins the physical network later.

NAT (vmnet8)

Communication and Visibility: All VMs using the adapter vmnet8 form a private network with the host. They all have internet access capability, but they are not visible to others beyond the host as if they are sitting behind their own firewall with the host. You can expose the VM for a particular access by port forwarding via NAT configuration provided by the VMware network utility (in the desktop Start menu: VMware -> VMware Server -> Manage Virtual Networks).

Because of its internet capability, I use it often for Web application testing and development too.

Performance: To me, it is faster than Bridged and could be as fast as Host-only.

DHCP or Additional Service: This mode provides DHCP sevice. If you don't have a router or a DHCP sever running on your network, this one comes in handy. This mode also provides NAT service for further network configuration. Both services can be disabled.

Issues:

  • Big File Copy: Unlike Bridged, I don't experience any file copy problem regardless of size (also see this).
  • Leaking IPs to physical network: VWware DHCP may assign IPs to the PCs on the physical network and cause problems. I encounter this problem when I have my VM Server running first and then my other physical PC joins the physical network later.

Disabling VMware DHCP and NAT on Windows

If you are only using Bridged network, I would recommend to have both VMware DHCP and NAT services disabled. They are not used by Bridged.
On Windows, you can disable it via your Services console (services.msc) from Administrative Tools. These two services on Windows are called VMnetDHCP (for VMware DHCP Service) and VMWare NAT Nervice respectively.
  • Locate the service you want to disable.
  • Right click to select Properties.
  • From the Startup type dropdown box, select Disabled.
  • Click OK button.

Or run the following commands at the command prompt.
   sc config "VMnetDHCP" start= disabled 
   sc config "VMware NAT Service" start= disabled
Note that
  • start= must be in one single word.
  • There must be a space between the equal sign (=) and the word disabled.