Skip to main content

Updating VMware Tools quickly multiple Linux servers

Ever want to update a bunch of servers quickly?   ESX updates come once every 2-3 months (give or take) and it can be annoying to update all of the servers.  What I do is I will pull down the update and place it on a webserver that is accessible.  You can even change this step to SCP but that involves setting up SSH keys for a simple file grab.

You'll have to initiate the VMtools update at least once, so you can pull down the files from VMWare vSphere.  I place the new updates in the same location each time, symlinking the new files to "vmtools-linux-latest.tar.gz".

Once the initial "prep" is done, I'll usually use SSH from my management server where the SSH keys are already setup to each box then SSH using a text file like so:

cat "/path/to/textfile.txt" | while read a; do ssh root@$a /path/to/vmware_tools_update.sh; sleep 5; done

I put 'sleep 5' in between each iteration so I can kill the script if I need to.   CTRL+C while the update is running will only kill the update and move onto the next server.

Script "vmware_tools_update.sh":

#!/bin/bash

WGET="`which wget`"

if [ -z "`which wget`" ]; then
if [ -z "`which yum`" ]; then
echo "YUM utility is not installed.  Will attempt to install."
yum install -y wget
fi
fi

# Only these Linux distro's
RES="`cat /etc/*release |egrep -i \"centos|red hat|fedora|ubuntu\"`"
EXITCODE="$?"

if [ $EXITCODE -gt 0 ]; then
   echo "Cannot use this utility here (Wrong distro)."
   exit
fi

wget --no-check-certificate -q "https://public.webserver.com/files/vmtools-linux-latest.tar.gz" -P /tmp
if [ "$?" -gt 0 ]; then
echo "wget of vmtools-linux-latest.tar.gz failed."
exit
fi

#cleanup
rm -rf /tmp/vmware-*
tar xvzf /tmp/vmtools-linux-latest.tar.gz -C /tmp
rm /tmp/vmtools-linux-latest.tar.gz
/tmp/vmware-tools-distrib/vmware-install.pl -default
rm -rf /tmp/vmware-*

echo "vmtools updated on `hostname`" | mailx -s "`hostname`: vmtools updated" youremail@here.com

Comments

Popular posts from this blog

Starting vmtoolsd as a service on Red Hat / CentOS

If you're like me;  you may manage virtual servers within vSphere.. Linux ones.  Red Hat ones, in particular, but this applies to CentOS as well.

A long, long time ago, in a galaxy far away, the vmware-tools setup procedure installed the necessary init script for you.  Lately though, for new images that I've been building - those init scripts aren't getting installed by the vmware tools installation package.  So they don't start up on reboot.  VMware based backups failed; clock were going askew, you name it.   I need that daemon started on reboot.

Without a SysV init script handy, I had to roll my own.. and this is the result;  despite having worked with Linux for well over 15 years, setting up SysV init scripts remain somewhat of a black art.  The ones on our older system were more complicated than we needed.  I was aiming for something simpler and portable.

With RHEL 7, the rumor mills are abuzz with systemd so that may change. But, I'm a practical system admini…

Attempting to use dd on Mac OSX? Resource Busy?

If you're trying to use the dd command to image a usb disk or another device and you're running into an error that looks like:

# dd: /dev/disk#: Resource busy

There is a simple solution.

Use OSX's Disk Utility and unmount any of the partitions you have mounted on that particular disk without unmounting or ejecting the disk itself.

Afterwards, attempt the dd command again.

Update:  

Attempting to use the umount utility in Mac OSX will result in a "Resource busy -- try 'diskutil unmount'".  The command-line equivalent would be:

# sudo diskutil unmount /Volumes/<disk in question>

E.g.  

# sudo diskutil unmount /Volumes/FLASHUSB

NetApp: Disabling snapshot for a volume on Data OnTAP

This is one of those things that isn't always very obvious. Sometimes, you need to disable snapshots for a volume.

Why in the world would someone want to disable a perfectly good feature of NetApp NAS Storage? Server/data migration for one. Disabling it temporarily will prevent the volume from filling up the snapshot directory. Maybe your volume doesn't need snapshots (data always changing, and can not be recoverable even with snapshots- such as oracle data dirs, in which case snapshots are useless).
You have to perform simple but important tasks. If your volume has a schedule, turn it off.

somefiler> snap sched rootvol Volume rootvol: 2 4 8@2,4,6,12,164
somefiler> snap sched rootvol 0 0 0 
somefiler> snap sched rootvol Volume rootvol: 0 0 0

That takes care of that. Next step is to disable the automatic snapshot option.

somefiler> vol options rootvol nosnap on

Now if you issue vol options rootvol You should see an option that says nosnap=on.

Lastly, you'l…