vSphere 5 – fdisk through Powercli

As i mentioned in my earlier post. Once we have added the new disk to our VM we need to run fdisk, format and mount it. We came up with this simple script.

We use Invoke-VMScript. We have a 12gb disk and we make sure that cylinder 64 is used as the starting cylinder.

Read more »

vSphere 5 – Add a second disk to a VM

The other day we had to increase a faire amount of Vm’s with another disk, 12gb for Data. With Powercli this is a fairly easy operation.

Here is a script that will shutdown the VM nicely and add the disk and finally boot the VM again. After i will give you yet another script that will with Powercli logon to the machine and run fdisk/format and finally mount the disk for you automatically.

I add some sleep functions in order to be sure that the machine has safely shutdown. Instead of Shutdown-VMGuest one could use Stop-VM but as i think its nicer to shutdown the machine (Apache, DB’s) rather than stopping it ‘hard’. Choice is your however.

Read more »

vSphere 5 – Add/Remove a VLAN on a ESX host

Sometimes we need to add a new VLAN to all of our ESX server in our infrastructure or cluster. In order to do that we use this little nifty script.

Read more »

vSphere5 – Clone from Template

Here is a script that uses a RHEL5.4 as a template and then make new machines based on input from a CSV file. Our script then update the network settings , stopps TSM (we have that) and update the RHN with the newly created machine.

CSV input file. basevm, vcname, vmname etc are cells on line 1 in Excel. Input values are on cells on line 2 in Excel i.e. basevm = TMP_RH5.4_64. vcname is a friendly name in vCenter5. Should however be the DNS name but at my current client they use uppercase letters of the hostname with Environment attached to name i.e. DNSM1-DEV1 but the dns name (linux hostname) is dnsm1.

basevm,vcname,vmname,custspec,ipaddress,subnet,gateway,pdns,sdns,vlan,location,vcpu,vmemory

TMP_RH5.4_64,MyVMinvCenter,linuxhostname,custspec,10.10.10.10,255.255.255.0,10.10.10.254,
10.10.10.100,10.10.10.101,VLAN_415,Folder,2,8192
Read more »

vSphere 5 – Find Datastore with space during clone

We have a script that clones an existing environment into a new one. This is being used as a Pre-Prod environment. During our clone we try to find out which server has most RAM free and also which Datastore has space available to host our new server(s).

We check if the ‘source’ machine to clone is either on SATA or SAS. Then we check the datastore with most space available. Our disks are named VMFS_SAN_SATA or VMFS_SAN without the SATA part.
Read more »

vSphere 5 – Find Server with most free RAM

When we clone our machines we wanted to put our new clones on the server (esxi5 host) that was least charged at the moment. I found out a way to calculate this with the formula below. It will always try to find the host with most RAM Free. I have another script calculating which Datastore has the most free space avail.
Read more »

vSphere 5 – Kickstart config

Here is a simple kickstart script that could be used in conjunction with Ivo Beerens Windows Server tftpd setup found here.

The default file in pxelinux.0 directory could look like this. When presented with the initial Boot Menu you high lite Your server, press [Tab] and remove everything after the 3 +++ sign including them. Since we have a fixed IP below we do not need the IP etc from the DHCP.
Read more »

vSphere 5 – Insert host into vCenter during Kickstart

I am working with VMware (vSphere4/5) at the moment. It’s quite an impressive setup at my current client. During my time i have come across a lot of documentation written by some master minds in this business. Most of the time i have copied their scripts and tweaked them to my own needs. Here i will share many of my scripts so that someone else can benefit!

First one out is a script that we did after setting up a tftpd32 (Ivo Beerens Windows Server tftpd setup found here) environment in Windows Server 2008. We wanted to see if we could inject the ESXi5 host during kickstart into vCenter 5. This was easier said than done of course but after some searching i found Virtuallyghetto. Browsing around i found this page explaining it all. After some trial and error i finally got it working.
Read more »

Solaris 10 – AnonFTP

This document will describe the process on how to setup an Anonymous FTP Server in Solaris 10 manually.

Anonymous FTP can be set up under Solaris by performing the following steps. Remember, however, that Anonymous FTP opens up your system to allow anonymous users to perform file transfers. In general, Anonymous FTP should be considered a security concern and should be enabled only if it is absolutely necessary.
Also, to allow FTP to work properly in a chroot environment, make sure that the file system containing the FTP home directory is not mounted as nosuid.
Read more »

Solaris 8 – Lost root password

Yeah, it does happen. So what do you do when you have had that fantastic long vacation and you’re back in the office and you realize that you forgot your root password on your Solaris server.

Here’s how
Read more »

Solaris 8 – Remove SDS

This document will describe the process and steps involved in removing the Solstice Disk Suite on SUN V240.
Read more »

Solaris 8 – Disk Mirroring (Solstice Disk Suite)

System design
The system running is a SUN V240 with 2 internal 72 GB disks, c0t0d0 and c1t1d0. These disks are mirrored with Solstice Disk Suite 4.2.1. One master disk was installed containing all needed patches and software. The installation procedure within explains steps taken in order to ‘clone’ a running system with single disk into a full blown DiskSuite Mirrored system using custom scripts and commands on CLI.

Read more »