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.

Monday, December 21, 2015

CentOS 7 | Installation and setup of Icinga2 monitoring service - Part 2 - Setting up the Icinga Web 2 interface

This is part 2 of the tutorial where I'll be setting up the Icinga Web 2 web fronted from where we can log into our Icinga2 server and actually monitor our infrastructure.

If you came here from Google than you can find Part 1 here.

CentOS 7 | Installation and setup of Icinga2 monitoring service - Part 1

Knowing that there is a newer fancier Nagios fork called Icinga I always wanted to try it out, but
I really haven't got the time to do that. Finally when I got the time I realized that online guides for that are missing too. Being a CentOS supporter, I decided that during that process i could write a tutorial for CentOS 7.

This is the part 1 of the tutorial where I'll be going through the steps for preparing the server and setting up the Icinga2 service. In part two I'll be going through the steps for installing and setting up the Icingaweb2 web service which basically is one of the several available Incinga2 front-end applications.

Sunday, December 13, 2015

vSphere | Virtual Machine that is neither powered on nor powered off

I had a very interesting problem with a VM for which I concluded being in a phantom state, that is a VM that is neither powered on, nor powered off. No matter what you try to do to the VM you always end up with error message that says:

The attempted operation cannot be performed in the current state: Powered ON.

The thing is, that if you try to access the console, the machine is not powered on. Even more, if you open the VMRC you could end up seeing an error message:

Unable to connect to the MKS: The operation is not allowed in the current state.

So what should I do? I decided to hit the ESXi Shell. VMware has a pretty nice KB article and even a video on what to do when you encounter this problem:


Connect to the host using an SSH client and try the steps described into that article. However if the VM still cannot be powered off than you must reboot the ESXi host in order to refresh the VM state.

If this happens too often then you must consider moving everything off that host, as this probably indicates problems with the host itself.

Saturday, December 12, 2015

vSphere | A VM is showing disk size of 0B

Being given a task to figure out and clean up the mess of a poorly maintained vSphere Infrastructure a while ago, i encountered a very strange problem.

They informed me that the Veeam Backup failed for that VM, and the error message was:

Virtual disk configuration change detected, resetting CBT failed Details: A general system error occurred: 
Creating VM snapshot
Error: A general system error occurred: 

Wednesday, September 23, 2015

Convert Linux LVM partitions back to normal partitions

There are number of questions online regarding this issue, but I haven't found a concrete solution just untill recently, when I had a task to make a P2V Conversion of a CentoOS Server. If you happen to have a system with a logical volume (LV) but for whatever reasons at a later time you decide that you want to transfer that LV or convert it back to normal partition eg. /dev/sdc1 than I discovered a very easy procedure which can help you to do just that.

You will need a spare drive or a partition with the same size (or bigger) to do that. First make sure that you have your drive ready and with at least one partition table that is the exact same size, or larger then the original LV.

On my system the logical volume is located at: /dev/VolGroup00/LogVol00.
You can use dd to convert the LV back to normal partition.

The procedure to convert the LV to a normal partition is as follows.

# dd if=/dev/VolGroup00/LogVol00 of=/dev/sdc1 bs=4M

Depending on the size of your partitions you will have to wait for some time. Also keep in mind that dd does not produce any output except if something goes wrong. In my case the disks were 230G (the original LV) and 250G (the other disk) respectively, so I've waited for 3 hours at least.

After the process is finished you can mount the /dev/sdc1 partition and you will be able to see all of your files inside. The output of df -h or fdisk -l will show 230G of space instead of 250G as we made a clone of the LV partition.

If you still want to continue to use your old drive where the LV was, than just format that old drive/partition /dev/sdb1 (in my case) and make that same transfer again but in reverse order.

# dd if=/dev/sdc1 of=/dev/sdb1 bs=4M


Tuesday, September 22, 2015

Virtualizing CentOS 5 physical servers with LVM configuration

Somewhere on the internet was written:

Virtualizing a physical Linux server is a combination of knowledge, experience and luck.

Recently I had a the task for a client to virtualize a CentOS 5 Linux server. After searching on Google about it, I was disappointed to see so many posts of people having problems with it, especially those who had physical Linux servers with LVM configurations. If you research about a bit, you will be surprised on how many production CentOS 5 servers exist which run with their default installations with one large physical volume and one swap partition. The things are even worse if the boot partition is also on that same logical volume.

Unfortunately there are still many forgotten production Linux servers today which run CentOS 5. The things are even worse, because in smaller companies, those servers are set up and forgotten, and even those admins who once administered those servers are gone and not working for that company for years. What happens is when you try to virtualize Linux server with similar configuration described above with the VMware converter, the process usually terminates at 97% with error:

FAILED: An error occurred during the conversion:
'Partition number must be set for the boot volume'

Another common example is also found in this VMware KB article.

When you try to power on this crippled VM you'll end up with one of the two things.
  1. The VM will behave as it is an empty VM (just created with no OS)
  2. The system will try to boot, you will see the GRUB loading screen, and after a while when the kernel starts you will see a kernel panic message.
Both of this problems are completely solvable. Since you already have the main volume with everything inside (databases, software etc..) you just need to make sure that now you have to repair the  key parts from which every Linux operates boots and operates - the boot partition.

Saturday, July 11, 2015

CentOS 7 | Disable and enable the firewall

"Hey Tom, I am just doing this tutorial article about setting up my Apache server but damn I did everything twice and I still can't access my server from outside but the service is working?!"


Every now and then I get these questions from people who just installed their CentOS 7 server and now they are trying to setup their whatever network service.

The pain my friends is the firewall on the CentOS 7 machine that comes installed by default.

There are two solutions for this, both with advantages and disadvantages.