Vmware ESXi Virual disk types

When creating virtual disks in ESXi there are lots of questions that most people ignore.  90% of the time you can ignore them but a few can really help performance.

 

Device Type

  • Create a new virtual Disk
  • Use an existing virtual Disk – Used to connect to a shared disk or a disconnected one
  • Raw Device Mapping – Raw device direct access to a physical lun – Used in microsoft clustering performance uses etc..

 

Disk-provisioning

  • Thick Provision Lazy Zeroed – Space required for virtual disk is allocated at creation time but the disk is zeroed out on demand when requested by the guest operating system (like a fast format in Windows).  Fast creation, fully allocated blocks on datastore, high chance of contiguous file blocks
  • Thick Provision Eager Zeroed – Space required for virtual disk is allocated at creation time and every sector of the disk is zeroed during disk creation.  Slow creation, fully allocated blocks on datastore, highest chance of contiguous file blocks
  • Thin Provision – Disk only uses as much space as it initially needs.  Fastest creation, Allocated and zeroed out on demand, low chance of contiguous file blocks, uses less disk space

 

Which one do you choose?

Well that depends on your needs.  If performance is your critical issue then Thick provisioned is the only choice.  If you need to save disk space or doubt that your customer will really use the 24TB’s of disk space they have requested then thin provisioned is the choice.  Lazy Zeroed is something between the two.

 

How do I switch?

As of ESXi 5 you have two choices: storage vmotion and inflate.  When initiating a storage vmotion you have the option to choose any of the three options above and convert it.  You can also turn a thin into thick by finding the flat file using the datastore browser and selecting inflate.

 

SCSI Controller type (Only on first disks):

Much like disk type there are many choices:

  • BusLogic Parallel
  • LSI Logic Parallel
  • LSI Logic SAS – Requires Hardware 7 or later
  • VMware Paravirtual – Requires Hardware 7 or later

Paravirtual is a physical adapter that requires vmtools drivers in order to use.  Paravirtual adapters provide the best performance but can be only used in new operating systems.  Also they cannot be used on boot devices.   Normally your OS selection handles the best scsi type for you.

 

SCSI Bus Sharing:

When you add a new SCSI Bus you have options on the scsi type but it also gives you the following options (can only be changed when added or vm is powered down)

  • None – Virtual disks cannot be shared
  • Virtual – Virtual disks can be shared between virtual machines on the same server
  • Physical – Virtual disks can be shared between virtual machines on any server

Of course you still need a cluster file system but if you plan on using this system then select Physical.

 

Scsi bus location:

Each virtual machine can have up to 4 scsi buses each with their own controller.  Lots of people have questioned the advantage of multipe buses in vmware.  In traditional hardware you have multiple buses to provide redundancy in case of a bus failure.  This does not apply to virtual hardware.  But it still provides the virtual operating system multiple channels to handle I/O which is always a good thing.

Mode:

  • Independent (Not affected by snapshots)
  • Virtual (Default)

 

Independent Mode:

  • Persistent (Changes are written to disk) – great for databases and other data where a snapshot does not make sense.
  • Nonpersistent (Changes to this disk are discared when you power off or revert to the snapshot) – Used on lab computers, kiosks etc..

 

 

Vmware ESXi Virtual network interface cards choosing a network adapter for your virtual machine

Classic question there are all these virtual networking adapter types which one do I choose?  99% of the people you talk to will tell you they let vmware choose when then select the operating system.  This will choose a compatible network adapter type but not always the best type. Gaming and enterprise level servers usually require a few scratches on the head before the run smoothly, but still for better gameplay is better to get one of those fps gaming mouse that give a better time reaction in the game. Each generation of virtual adapter brings better performance and features.  As a rule of thumb you want the highest vmxnet adapter your system supports.  As of ESXi 5 the following adapters are available listed in order preference (worst to best):

 

  • Flexible – Has two functions can function as a vlance or vmxnet (will be vlance unless vmware tools is installed)  vlance is an emulated 10Mbps nic available on almost all operating systems.  vmxnet is the first generation of virtualized only network cards and requires vmware tools to be installed.
  •  e1000 – is an emulated Intel 82545EM Gigabit ethernet NIC with support in most operating systems.  It is the default adapter for all 64-bit operating systems and is required for guest VLAN tagging.
  • vmxnet2 – Updated version of vmxnet that contains VLAN tagging, jumbo frames and hardware off-load with additional high-performance features
  • vmxnet3 – Is not really related the vmxnet2 but does represent the next generation of nic drivers it includes all features of vmxnet2 plus multiqueue support, IPv6 offloads, MSI/MSI-X interrupt – this driver has limited OS support requires vmware tools like all vmxnet adapters and requires Esxi hardware version 7 (Esxi version 4 at least)

 

How do I choose?  The best answer is consult vmwares knowledge base for information:

http://kb.vmware.com/kb/1001805

 

Here are some samples:

Vmxnet3

  • 32- and 64-bit versions of Microsoft Windows XP,7, 2003, 2003 R2, 2008, and 2008 R2
  • 32- and 64-bit versions of Red Hat Enterprise Linux 5.0 and later
  • 32- and 64-bit versions of SUSE Linux Enterprise Server 10 and later
  • 32- and 64-bit versions of Sun Solaris 10 U4 and later

 

 

Files that make up a virtual machine ESXi

For the longest time I always wondered what exactly all those files inside your directory do and their purpose so here is a handy guide:

 

Configuration File -> VM_name.vmx

Swap File -> VM_name.vswp or vmx-VM_NAME.vswp

BIOS File -> VM_name.nvram

Log files -> vmware.log

Disk descriptor file -> VM_name.vmdk

Disk data file -> VM_name-flat.vmdk

Suspended state file -> VM_name.vmss

Snapshot data file -> VM_name.vmsd

Snapshot state file -> VM_name.vmsn

Template file -> VM_name.vmtx

Snapshot disk file -> VM_name-delta.vmdk

Raw Device map file -> VM_name-rdm.vmdk

 

.vmx – Contains all the configuration information and hardware settings for the virtual machine, it is stored in text format.

 

.vswp – is a file that is always created for virtual machines during power on.  It’s equal to the size of allocated ram minus any memory reservation at boot time.   This swap file is used when the physical host exhausts all of its allocated memory and guest swap is used.

 

.nvram – is a binary formated file that contains BIOS information much like a BIOS chip.   If deleted it is automatically recreated when the virtual machine is powered back on.

 

.log – Log files are created when the machine is power cycled the current log is always called vmware.log

 

Lock down port speed on a brocade switch

Well this one is pretty simple and a lot of vendors still want the port speeds locked down.  So first of all use

 

switchshow

 

To show the current speed then use

portcfggport port# speed

 

Speed can be

s auto

1 GB

2 GB

4 GB

8 GB

 

 

Upgrade the firmware on a brocade switch

Yep I love doing this…. it’s really easy as long as you have an FTP server or run ftp on your desktop and have firewalls allowed…

 

The brocade switch needs to be able to download the firmware from a FTP server.  Once you have an FTP it’s easy to do the install of firmware.  The process downloads the firmware and installs it on the secondary CP then moves load over the the secondary cp.  Once all load is on the secondary CP then it upgrades the first CP.  This way the code is completely loaded and verified before load gets moved to the new system.

 

Once you have the FTP setup then you can login to the switch via ssh (or telnet yuk disable it and use ssh) and issue the following command:

 

firmwaredownload

 

It will list a series of prompts to help you install the firmware the most important is the location this is relative to where the ftp server drops you… for example mine drops you into the users home directory which is /home/username and I have my firmware unpacked into /v6.4.2.b so the full path is /home/username/v6.4.2.b but when connecting via ftp the path is v6.4.2.

 

You will be disconnected during the firmware update you can reconnect pretty quickly and use the following command to check status:

 

showfirmwaredownload

 

This will display the current status.  You can also use version to check that it’s been upgraded.

 

 

How to add an entry in a subdomain without adding the domain

So you need a subdomain in your dns but you only need one and don’t want to create a whole new file… well it’s really easy…

 

Assume that you are editing the zone file for b.domain.com and you want to add www.a.b.domain.com just add this to b.domain.com

 

www.a.b.domain.com    IN A 10.10.10.41

How to setup more than one ip address in dns (DNS Round robin)

So I bet you have seen what happens when you look up the Ip address for google.com .. you get five or six different IP addresses your client takes the first one…   for example

 

nslookup google.com

Non-authoritative answer:
Name:   google.com
Address: 74.125.225.145
Name:   google.com
Address: 74.125.225.144
Name:   google.com
Address: 74.125.225.148
Name:   google.com
Address: 74.125.225.147
Name:   google.com
Address: 74.125.225.146

 

Lets do that again:

Non-authoritative answer:
Name:   google.com
Address: 74.125.225.144
Name:   google.com
Address: 74.125.225.145
Name:   google.com
Address: 74.125.225.148
Name:   google.com
Address: 74.125.225.147
Name:   google.com
Address: 74.125.225.146

Notice how the order changes?  That is DNS round robin and your machine will use the first IP address it gets producing a type of poor mans (or womans) load balancer. It works great but how do you do it in DNS so that it works?

 

The best way is to load multiple A records inside DNS like this:

www.awesome.com        IN A  10.10.10.2

www.awesome.com        IN A 10.10.10.3

www.awesome.com        IN A 10.10.10.4

 

Another way is the following:

 

www.awesome      IN A 10.10.10.2

IN A 10.10.10.3

IN A 10.10.10.4

 

How to add space to a ext3 lvm online

Logical Volumes are great you can add disk space without unmounting disk.  With ext3 you can expand that space without a downtime.  It’s easy.

 

Assume you add a new disk called /dev/sdg and you partition it into a single partition to keep the blocked lined up with your storage system. Now you have /dev/sdg1

Make it into pv’s

 

pvcreate /dev/sdg1

 

Now add it to your current logical volume called storage with the following command

 

vgextend storage /dev/sdg1

 

Use vgdisplay to show how many pv’s are used and now many are free… using the next command we need to add them together..

 

lvextend -l number_of_pvs /dev/storage/storage

 

Now you need to expand the ext3 which can take some time:

 

resize2fs /dev/storage/storage

 

And wait …

 

Disable crontab email to user

So your daily jobs send you email and you want it to stop well just add this to then end of all your cron jobs:

 

>/dev/null 2>&1

 

This means send standard output and standard error to /dev/null which throws it away.

 

Secure / Harden PHP

PHP is great and I love it, but it does have some basic things that can improve it’s security simple modifications to php.ini can really increase the security.  Locate your php.ini (find / -name php.ini) and then modify the following items

 

#Avoids system calls and buffer overflows

disable_functions = exec,system,shell_exec,passthru

# Injection protection
register_globals = Off

# Turns off display of PHP version
expose_php = Off

#Escape incomming quotes to avoid injection
magic_quotes_gpc = On

 

 

These will take huge steps to protecting your system