Backup Your MySQL Database Daily!

21/05/2014 // 0 Comments

Here is quick guide to backup your MySQL database daily: This guide is prepared on Ubuntu 12.04LTS, MySQL 5.5. Save this script anywhere in your database server:

* Edit the red texts for your environment. This script will use /home/username/mysqlbackup folder to save the backup files. It will delete the backup files which are 7 days old. It will hold 8 backup files. Make the the script file executable:

Test the script by running manually before adding to your crontab.

Add the script to crontab to run it daily:

This job will run at 03:00 everyday.

How to extend LVM disks in vCenter

13/05/2014 // 0 Comments

LVM disk extension can be a challenging experience for who are not familiar with unix environment.  I will try to explain it as simple as possible in this guide. Heads up: You need to reboot the virtual machine twice! There is no live-extension way for LVM in vSphere environment. If you want to do it live-extension, you need to add new VMDK hard disk to the VM and extend in the LVM console. I will write about that later. This guide is based on Ubuntu 12.04 LTS.   1. Enter your VM’s “Edit Properties” menu. Choose your hard drive and give more space as you want: 2. In the same window, click “Options” tab, choose “Boot Options” and enable “Force BIOS Setup” on the right side: 3. Click “OK”. 4. Go to g-parted web site and download the ISO file from there: 5. Right click on your VM and click “Open Console”. Click the “Connect CDROM” button on top right and choose “Connect to ISO image on local disk”. 6. Choose your g-parted ISO file and click “OK”. 7. Now reboot your VM. You will see the BIOS screen. Go to “Boot” tab. Using UP-DOWN arrow select “CD-ROM drive” and bring it before Hard Drive using “+” sign on your keyboard. Go to Exit tab and select “Exit Saving Changes”. This will reboot your virtual machine. 8. You will see boot screen of g-parted. Click “Enter” for G-Parted Live. (You can hit Enter for default selections for 9-10-11 steps) 9. Choose “Don’t touch keymap” for Configuring console-data. 10. It will ask for language selection. Type your language number and hit Enter. Default is 33 (English). 11. Choose G-Parted mod, default is “0”. 12. G-parted will boot and Device manager screen will be shown in the screen. Now select LVM device which’s File System is “extended”. […]

Generate User Password in Ubuntu Cloud Image

12/05/2014 // 0 Comments

When you boot standard Ubuntu Cloud image in the Openstack, no password or user generated in the image by default. You can configure your Ubuntu Cloud image to set a static password or generate a password in the first boot of the image. You need to configure metadata service in the Openstack in order to use this. I suggest you to do this jobs in your Glance server, your images will be saved to this server anyway.   Firstly, download your Ubuntu cloud image from this link: Install guestfish in your server. This server probably will be your Glance image server. :

In order to edit the image file open it with guestfish:

Then, start your image file:

Find the image local disk:

Mount the image disk to guestfish root:

Now, you can edit /etc/cloud/cloud.cfg file by using vi editor. I wanted to set random password for ubuntu user, so I added these lines to the cloud.cfg file: for 12.04 LTS images, you can set your static password or randomize:

for 14.04 LTS images I have not tried to randomize the password yet, but static password can be set with this commands:

Be careful to comment out the “lock_passwd: True” raw in the cloud.cfg file. It will not allow you to login if you do not remove it. Save cloud.cfg file and exit from guestfish. That’s it! Import this modified image to Openstack and Ubuntu password will be randomly created or static password will be set . If you randomized the password it will be printed to Console-log of the instance:

guestfish operation referance: Here are some examples in cloud.cfg file:

Openstack: Icehouse with Ubuntu 14.04LTS

08/05/2014 // 0 Comments

Openstack’s new version Icehouse was released with the new Ubuntu 14.04 LTS on 17th of April. Trove (Database as a service) package was added to Openstack with this version. Check Trove here: As far as I read in the release notes, there is no major change on other services. I will  install the new version and write about it in the future. Check the release notes: 

VLAN tagging on Bonding interfaces for Ubuntu Servers

06/05/2014 // 0 Comments

Firstly, install vlan and bonding packages on the Ubuntu server:

Enter these lines on /etc/modules because we want to enable the modules at startup.

If there is no network connection, you need to install these packages from CDROM or install these packages while OS setup. This configuration can be used for bonding and VLAN tagging on server. You can define additional VLAN interfaces. This configuration if for Active-Passive interfaces. We need to define primary interface as seen in eth0. If you do not want to configure your physical switch or do not want to struggle with your network administrator, this is the best way. When eth0 is lost, your secondary interface (eth1 in this example) will be used. If you want to use active-active setup, the best way is to setup LACP bonding, but you need to configure your physical switch ports for LACP.

bond0 is your bonding interface. bond0.430 is your VLAN tagged bonding interface. 430 is your VLAN. If you want to check bonding status, you can check here: