Friday, March 11, 2016

VSphere | Advanced snapshot trobuleshooting - Part 3 - Example: Invalid snapshot configuration

Unable to consolidate because of invalid snapshot configuration

This is Part 3 of the short tutorial series:
vSphere | Advanced snapshot troubleshooting

This is much more advanced than our previous example.  You will see these two errors if you attempt to consolidate, clone or migrate the VM:

Detected and invalid snapshot configuration

or

... vmdk was not found

VSphere | Advanced snapshot trobuleshooting - Part 2 - Example: Unable to consolidate because the file is locked

This is Part 2 of the short tutorial series:
vSphere | Advanced snapshot troubleshooting

Virtual Machine consolidation attempts result with bellow error:
Unable to access file since it is locked

VSphere | Advanced snapshot trobuleshooting - Part 1 - The ESXi shell is your friend

I am writing this article as an extension to my previous post A VM is showing disk size of 0B where I will attempt to make a general explanation on how to troubleshoot and successfully solve snapshots and consolidation problems in your vSphere with a number of examples. Because the general article was so big, I decided to split it into three parts. This Part 1, is where I am describing the commands which are used to solve most of the snapshot problems and in the next two parts I will describe the process of troubleshooting via examples.


Saturday, February 13, 2016

Linux | Don't reboot after adding a new disk on a VM

It is quite common practice when adding a new drive to a Linux system to reboot the system afterwards so that the server can re-scan its hardware and detect the change. However, every now and then we get to make changes to a server that we don't want to reboot it for some reason. Or maybe you are lazy, like me and don't want to wait 1 min to reboot. In any case, bellow is a way to make your system re-scan the hardware and detect the changes.


Thursday, February 4, 2016

Linux | How to search for a particular string in multiple files

Every now and then I find myself into a situation where I have to search for a particular string from a set of files, and every time I have to remind myself again.

As the old proverb says: "The fool remembers, the smart writes down."

That is why I decided to write this down, so that I can come back and find it again.

# grep -rnw '/path/to/somewhere/' -e "pattern"

Here -r or -R is recursive, -n is line number and -w stands match the whole word. We can also add -l (lower-case L) to just give the file name of matching files.

So in my current example, I work on Nagios and I want to find the file containing that check_snmp command i would type:

# grep -rnw '/etc/nagios/objects/' -e 'check_snmp'

Which will produce the output:

/etc/nagios/objects/commands.cfg:147:# 'check_snmp' command definition
/etc/nagios/objects/commands.cfg:149:        command_name    check_snmp

From here we can basically see the file where check_snmp is defined along with the line number of that file.


Extending the command with --include or --exclude parameter we can create neatly commands to also search for files with particular extension. The bellow command will check only .cfg or .conf files.

# grep --include=\*.{cfg,conf} -rnw '/etc/nagios/objects/' -e 'check_snmp'

# grep --exclue=\*.0 -rnw '/etc/nagios/objects/' -e 'check_snmp'

And as always:

RTDM!

# man grep


Tuesday, January 19, 2016

CentOS V2V | Hyper-V to VMware - The easy way

I had a task to export a Hyper-V, CentOS 6 VM and deploy it to a vSphere cluster. Due to the nature of the VM we had to preserve it because the VM was already set up and it was too long for us to build a new one with the same settings.

Before start I would like to point out that if this is a Linux VM you are doing, then because there will be a complete hardware change you may end up with unbootable clone, which can be fixed. This did not happen to me though, but in the end of this article I will also point those things out as potential issues.


Sunday, December 27, 2015

Linux | Guidelines for setting up a Linux Server as a VM

These are just plain guidelines for setting up a Linux server as a virtual machine. As time passes I keep seeing the same mistakes from fellow admins, over and over again so I decided to mention some of it.

Feel free to add anything else in the comments or point me out should I am making a mistake somewhere along the way ;)

First things first, you have to decide what will be the use of the VM that you are creating? Will it be a file server, or a web server, or a database server? Perhaps it will be a dedicated VM for a couple of users. No matter your choice, if you are setting up the server as a virtual machine in you infrastructure you have to keep in mind a few things so these are just a few golden rules for setting up a Linux VM so that you don't end up crying later when things go bad.