Author Archives: James Coyle

How to make a new OpenVZ template from an existing template for Proxmox

Get Social!

openvz-logo-150px_new_3The kind folks over at OpenVZ.org have created a rift of templates which we can use as a starting point for our template. It is possible however, to create your own template from scratch based on your favorite Linux distribution – that will be coming in a later blog post.

The starting point for this blog post is to have downloaded a template and started it up in a container. If you don’t have any templates you can download one from OpenVZ. If you use Proxmox as your hypervisor you can download one via the web gui by clicking on your storage, clicking and finally Templates.

So, as I say, you need to have a container up and running and for this post we are going to assume it is running under the VMID of 100. Make any required changes to the template such as:

  • apt-get update && apt-get upgrade (for Debian based containers).
  • yum update (for anything RedHat).

When you are ready to create the template, turn of the container by using the GUI’s Shutdown button or issuing the command halt in the containers terminal.

The next thing to do is to remove the network interface. It doesn’t matter if you use veth or venet – just use the web gui and remove the network device. Proxmox container network remove

Once this is complete, login via SSH to the Proxmox server and cd to the root directory of the container. If you have the default setup, this will be /var/lib/vz/private/100.

ssh root@proxmoxserver
cd /var/lib/vz/private/100

Issue the tar command to create the template archive (remember to keep the . on the end, it’s important!). You can change the container template name to anything you like, but I have found it best to conform to the following formula:

operatingsystem-version-archtype-description.tar.gz

tar -cvzpf /var/lib/vz/template/cache/oracle-6-x86_64-intitial.tar.gz .

That’s it! You can now select the container when creating a template from either the GUI or using CLI commands.

I have made a patch for the Proxmox web GUI to add this functionality to the the interface. See my GUI changes blog post for more information.


Limit backup I/O bandwidth

Category : How-to

Get Social!

proxmox_logoWhen backing up in Proxmox, especially on the lower end of the server market, the backup process can cause your system to almost grind to a halt. Luckily, there is a config change which we can make to limit the bandwidth of the backup process to make sure there is sufficient bandwidth for everything else.

The setting cannot be changed using the web gui, you must log into your Proxmox server using SSH. Once you have logged in, open the config file:

vi /etc/vzdump.conf

Find the line which contains bwlimit, remove the hash and append the value of KB/s which you would like the backup limiting to. The below example limits the backup process to 40000 KB/s.

bwlimit 40000

To calculate how many KB/s you need will take trial and error to see what affect speeds have on your system. Something which is helpful however, is converting MBs (Megabytes) into KB/s (Kilobytes). The formula is simple – just multiply the MB value by 1024 as there are 1024 KB in a MB.

MB/s * 1024 = KB/s

If you want a transfer speed of 10 MB/s you would use a bwlimit value of 10240 as the below example shows.

10 MB/s * 1024 = 10240 KB/s

Proxmox 2.3 is now available!

Tags :

Category : Tech News

Get Social!

proxmox_logoThere is a new version of Proxmox now available for download. Version 2.3 offers some new features, mostly around KVM. Some of the notable improvements are:

  • update qemu-kvm to 1.4.0
  • extend memory GUI to support ballooning
  • implement auto-ballooning
  • add HD resize feature to expand disks
  • update to latest Debian version 6.0.7
  • qcow2 as default storage format, cache=none (previously raw)
  • KVM64 as default CPU type (previously qemu64)
  • e1000 as default NIC (previously rtl8139)
  • task history per VM
  • Node Summary: added “KSM sharing” and “CPU Socket count”
  • enable/disable tablet for VM on GUI without stop/start of VM (you can use vmmouse instead, for lower CPU usage, works on modern Linux and on all Windows VMs as long as you install the vmmouse drivers)

See the Proxmox Wiki post for more details of the update.

For any 2.x version of Proxmox, you can update via apt-get by using the below commands in a terminal. Before updating, make sure all your VM’s have been stopped. Run the below commands on each server in your cluster.

apt-get update
apt-get dist-upgrade

Restart all Proxmox servers to complete the installation.


Proxmox VE 1.x is now End of Life (EoL)

Get Social!

proxmox_logoVersion 1.x of Proxmox VE is now end of life. This means that Proxmox will no longer be supported, bugs will not be fixed and security fixes will not be released. You will still receive the standard rift of Debian 6 patches and updates from the Debian repositories.

If you are still on version 1.x of Proxmox VE you should upgrade to Proxmox 2.2 as soon as possible. See the official Proxmox wiki on upgrading.

http://pve.proxmox.com/wiki/Upgrade_from_1.9_to_2.0

See our blog post on installing Proxmox 2 – Yes, I know it’s version 2.1 but, the steps are the same for Proxmox 2.2.


More Proxmox 2.2 updates available!

Category : Tech News

Get Social!

proxmox_logoThere are several updates in the Proxmox 2.2 repository available for download. This update introduces updates to software used by Proxmox, such as QEMU 1.3, and many bug fixes.

See the Proxmox Forum post for more details of the update.

For any 2.x version of Proxmox, you can update via apt-get by using the below commands in a terminal. Before updating, make sure all your VM’s have been stopped. Run the below commands on each server in your cluster.

apt-get update
apt-get dist-upgrade

Restart all Proxmox servers to complete the installation.


Backup ESXi 5.x running virtual machine

Category : How-to

Get Social!

ESXi does not provide an option to backup a running virtual machine, without paying VMware a substantial amount of money. You can get round this by turning off the guest and copying the VMDK however this requires downtime for the guest. You cannot copy the VMDK while the guest is running because the VMDK virtual disk cannot be copied while it is in use. As this is likely to be the boot disk for the virtual machine, stopping disk activity without turning the instance off is impossible. The below simple script creates a snapshot of the guest which forces the guest to write all new changes to a new file instead of writing them to the virtual disk. This frees the disk to be copied. Once the copy has completed, the snapshot is removed writing all changes since the backup started back to the virtual disk.

This script contains little error checking and requires a few conditions to be met in order to complete successfully.
• No device maps for physical disks must exist in the instance
• ‘Independent’ disks must not exist in the instance
• The parameters of the script must be completed correctly.

There are 2 lines in the script which must be configured. Open the script using a text editor and change the below variables to match your preferences.
#Config
BASE_PATH=”PATH_TO_VIRTUAL_MACHINES”
BACKUP_ROOT=”PATH_TO_SAVE_BACKUP”

Example
#Config
BASE_PATH=”/vmfs/volumes/datastore1/Machines/”
BACKUP_ROOT=”/vmfs/volumes/datastore1/Backup/”

Copy the script to the below location on your ESXi server. The file name of the script should be VMbackupBash E.G. /usr/bin/VMbackupBash

To run the script, type
VMbackupBash [MACHINE_FOLDER_TO_BACKUP]
The machine name must be the name of the folder in BASE_PATH which contains the instance to backup.

#!/bin/bash
#Backup VMware instance

echo ""
echo "-------------------------------"
echo "- VM Backup Script -"
echo "- James Coyle -"
echo "-------------------------------"
echo ""

#Config
#root path to where your running instances are stored.
BASE_PATH="/vmfs/volumes/datastore1/Machines/"

#root path to where you would like to save the backup
BACKUP_ROOT="/vmfs/volumes/datastore1/Backup/"

#Do not edit
if [ "$1" ]; then
MACHINE=$1

else
#MACHINE=$1
echo "Enter machine name: "
read MACHINE

fi

BACKUP_APPEND=$(date +"%Y%m%d-%H%M%S")
MACHINE_PATH="$BASE_PATH$MACHINE/"
BACKUP_PATH="$BACKUP_ROOT$MACHINE$BACKUP_APPEND/"

if [ -d $MACHINE_PATH ] && [ -d $BACKUP_ROOT ]; then

cd $MACHINE_PATH

VIMID=`vim-cmd vmsvc/getallvms | egrep -o "[0-9]+[ ]+$MACHINE" | cut -d" " -f1`

if [ -z VIMID ]; then
echo "Could not get VM ID."
vim-cmd vmsvc/getallvms

echo ""
echo "Enter vimid of $MACHINE"
read VIMID
echo ""
echo ""

fi

#Get existing files
FILE_ARRAY=`find $MACHINE_PATH -type f`

I=0
for T in $FILE_ARRAY[@]
do
#echo "$I[$T]"
I=$((I+1))
done

echo "- Backup info"
echo "-------------------------------"
echo " Machine path: $MACHINE_PATH"
echo " Backup path: $BACKUP_PATH"
echo " Using VM ID: $VIMID."
echo " Machine name: $MACHINE."
echo " Files in Machine folder: $I."
echo ""

echo "- Starting backup"
echo "-------------------------------"
mkdir $BACKUP_PATH

echo " Creating snapshot..."
vim-cmd vmsvc/snapshot.create $VIMID tempbackupsnapshot
echo " Snapshot complete."
IFS='
'
for A in $FILE_ARRAY
do
if [ -n "`echo \"$A\" | egrep '.vmdk|.nvram|.vmx'`" ] ; then
FILESIZE=$(stat -c%s "$A")
echo " Copying file: $A - Size: $FILESIZE bytes"
cp "$A" "$BACKUP_PATH"

else
echo " Skipping file: $A"

fi

done

#Remove snapshot
echo " Removing snapshot..."
vim-cmd vmsvc/snapshot.removeall $VIMID
echo " Snapshot removed."

echo " Starting compression..."
tar -czpf "$BACKUP_ROOT/$MACHINE-$BACKUP_APPEND.tgz" "$BACKUP_PATH"
echo " Compression complete."

echo " Removing backup temp..."
rm -rf "$BACKUP_PATH"
echo " Removed temp files."

echo ""
echo "-------------------------------"
echo " Backup Complete!"
echo "-------------------------------"

else
echo ""
echo ""
echo "-------------------------------"
echo " Error"
echo "-------------------------------"
echo " Folder $MACHINE_PATH or $BACKUP_ROOT does not exists"
#exit 1
fi

Visit our advertisers

Quick Poll

Are you using Docker.io?

Visit our advertisers