msgbartop
A chronological documentation test project, nothing serious, really!
msgbarbottom

15 Jul 2015 Virtualize physical Ubuntu linux server

This post describes how to create a bit for bit copy of a Ubuntu 14.04 LTS server using tools like gddrescue and qemu from a Ubuntu Live-CD. This procedure can actually be used to create a copy of any operating system, not just Ubuntu.

This could probably have been done more easily and faster using VMware vCenter Converter Standalone Client but I have experienced that not all linux flavours can be converted easily.

To perform such an operation you need several things.

  • Extra harddrive – same size or bigger than used disk space
  • Access to the linux packages gddrescue, qemu-imgThe first thing you should do to reduce the time ddrescue uses to copy the data is to remove unneeded files and folders as well as removing harddrives that you do not want to copy.

Creating the disk image

# ddrescue --nosplit /dev/sda imagefile.img imagefile.log

The –nosplit option copies the disk without retrying or splitting the file and is also “fast”.
Remember to place the imagefile.img on another harddisk than you are imageing to avoid filling your disk.

Convert the img file to a VWware VMDK disk file

# qemu-img -p convert -f raw sda.img -O vmdk sda.vmdk

Options used
-p gives you a nice progress indication of the conversion
-f raw tells us that we a trying to convert a raw disk image
-O vmdk describes the output format of the new disk image, in this example a VMware VMDK-file

qemu-img (1.5.0) supports a wide range of formats like vvfat vpc vmdk vhdx vdi sheepdog sheepdog sheepdog rbd raw host_cdrom host_floppy host_device file qed qcow2 qcow parallels nbd nbd nbd dmg tftp ftps ftp https http cow cloop bochs blkverify blkdebug.

Tags: , , , , , ,

Posted by

15 Jul 2015 VMware ESXi host tips

Some of my VMware notes in short form, just publishing it since it has been in my drafts folder too long.

Remove virtual adapter ala vmk0
# esxcli network ip interface remove -i vmk1

Configure IP on vmk
# esxcli network ip interface ipv4 set -i vmk3 -I 10.255.2.37 -N 255.255.255.0 -t static

List vmk
# esxcli network ip interface ipv4 get

# esxcfg-route

# esxcli software vib list

Remove vib on VMware host
# esxcli software vib remove -n=”vcloud-agent”

Removing of inaccessible NFS datastore
# esxcli storage nfs list

On the ESXi host
# /etc/init.d/storageRM stop

In the vSphere Client
“Rescan All” storage på host

# /etc/init.d/storageRM start

In vSphere Client
Remove inaccessible datastore

Check MTU values on ESXi host
# esxcli network nic list
Name PCI Device Driver Link Speed Duplex MAC Address MTU Description
—— ————- —— —- —– —— —————– —- —————————————————————-
vmnic0 0000:002:00.0 bnx2 Up 1000 Full a4:aa:aa:ab:aa:33 1500 Broadcom Corporation Broadcom NetXtreme II BCM5709 1000Base-T
vmnic1 0000:002:00.1 bnx2 Up 1000 Full a4:ae:aa:ab:aa:35 1500 Broadcom Corporation Broadcom NetXtreme II BCM5709 1000Base-T
vmnic2 0000:003:00.0 bnx2 Down 0 Half a4:ae:aa:ab:aa:37 1500 Broadcom Corporation Broadcom NetXtreme II BCM5709 1000Base-T
vmnic3 0000:003:00.1 bnx2 Down 0 Half a4:ae:aa:ab:aa:39 1500 Broadcom Corporation Broadcom NetXtreme II BCM5709 1000Base-T
vmnic4 0000:045:00.0 ixgbe Up 10000 Full a0:ae:aa:ab:aa:4c 1500 Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection
vmnic5 0000:045:00.1 ixgbe Up 10000 Full a0:ae:ba:ab:aa:4d 1500 Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection
vmnic6 0000:046:00.0 ixgbe Up 10000 Full a0:ae:aa:ab:aa:e0 1500 Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection
vmnic7 0000:046:00.1 ixgbe Up 10000 Full a0:ae:aa:ab:aa:e1 1500 Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection

Install NetApp plugin on ESXi host
# cd /vmfs/volumes/
# esxcli software vib install -d file://$PWD/NetAppNasPlugin.v20.zip

VAAI
On ESXi 5.x hosts, to determine if VAAI is enabled, run these commands and check if Int Value is set to 1 (enabled):

# esxcli system settings advanced list -o /DataMover/HardwareAcceleratedMove
# esxcli system settings advanced list -o /DataMover/HardwareAcceleratedInit
# esxcli system settings advanced list -o /VMFS3/HardwareAcceleratedLocking

DELL
Dell support: generate DSET file. Requires that DELL OpenManage is installed on the ESXi host
C:\Program Files (x86)\Dell\AdvDiags\DSET\bin>DellSystemInfo.exe -s 10.255.2.3 8 -u root -p password -d hw,sw -r c:\temp\dell\dset-20131115.zip

DELL OpenManage (ESXi host)
# /opt/dell/srvadmin/bin
# ./dataeng status

Tags: , , , ,

Posted by

26 May 2015 Installing Open vSwitch on CentOS 7

This post describes how to install the most recent version of Open vSwitch (ovs) on CentOS 7 and might be the base for future posts about using KVM as virtualization platform.

openvswitch-diagramOpen vSwitch is a production quality open source software switch designed to be used as a vswitch in virtualized server environments. A vswitch forwards traffic between different VMs on the same physical host and also forwards traffic between VMs and the physical network.

Install the needed packages (as root user)

# yum -y install wget openssl-devel kernel-devel

Install development tools

# yum groupinstall "Development Tools"

Add a ovswitch user

# adduser ovswitch

Download and unpack the openvswitch source code (as ovswitch user)

$ su - ovswitch
$ mkdir -p ~/rpmbuild/SOURCES
$ cd ~/rpmbuild/SOURCES
$ wget http://openvswitch.org/releases/openvswitch-2.3.1.tar.gz
$ tar xfz openvswitch-2.3.1.tar.gz

We will modify the openvswitch spec-file and use the kernel module CentOS provides instead of creating a new one.

$ sed 's/openvswitch-kmod, //g' openvswitch-2.3.1/rhel/openvswitch.spec > openvswitch-2.3.1/rhel/openvswitch_no_kmod.spec

Create a RPM-file to ease future package operations like upgrade

$ rpmbuild -bb --nocheck ~/openvswitch-2.3.1/rhel/openvswitch_no_kmod.spec
$ exit

Now is the time to install the RPM-package (as root)

# yum localinstall /home/ovswitch/rpmbuild/RPMS/x86_64/openvswitch-2.3.1-1.x86_64.rpm

If you have not disabled SElinux then you will see the following SELinux issues when you try to start the openvswitch service

install: cannot change owner and permissions of ‘/etc/openvswitch': No such file or directory and Creating empty database /etc/openvswitch/conf.db ovsdb-tool: I/O error: /etc/openvswitch/conf.db: failed to lock lockfile (No such file or directory)

This is one way to fix this issue

# mkdir /etc/openvswitch
# semanage fcontext -a -t openvswitch_rw_t "/etc/openvswitch(/.*)?"
# restorecon -Rv /etc/openvswitch

We are now ready to start the openvswitch service

# service openvswitch start
# chkconfig openvswitch on

Verify that we have installed openvswitch and that it is available

# virsh version
Compiled against library: libvirt 1.2.8
Using library: libvirt 1.2.8
Using API: QEMU 1.2.8
Running hypervisor: QEMU 1.5.3
# lsmod |grep openvswitch
openvswitch            70611  0 
gre                    13796  1 openvswitch
vxlan                  37409  1 openvswitch
libcrc32c              12644  2 xfs,openvswitch
# ovs-vsctl show
...
    Bridge "ovsbr1"
        Port "ovsbr1"
            Interface "ovsbr1"
                type: internal
    Bridge "ovsbr0"
        Port "enp0s25"
            Interface "enp0s25"
        Port "ovsbr0"
            Interface "ovsbr0"
                type: internal
    ovs_version: "2.3.1"

We are now ready to create a network bridge, but that will (maybe) be described in a future post of mine.

Tags: , , , , , ,

Posted by

05 Sep 2014 Backup VMware ESXi using BazaarVCB

This post describes how you can backup your VMware ESXi home installation with free license using BazaarVCB if you do not have a vCenter Server available. Bazaarvcb is the fastest backup solution I have used on the free VMware hypervisor.
Download the latest version from the download page.

The backup script is run by crontab every night and looks like this

#!/bin/bash
bazaarvcbPath="/media/backup/bazaarvcb-0.9.7b-linux-i386/bazaarvcb"
backupsPath="/media/backup"
hostname="192.168.0.222"
username="root"
password="password"
rollOut="30"
vmNames="vm-guest1 vm-guest2 vm-guest3"

for VM in $vmNames; do
        `$bazaarvcbPath backup -H $hostname -u $username -p $password --roll-out $rollOut $VM $backupsPath/$VM`
done

The backups are full so make sure you have enough disk space available.

bazaarvcb options

$ bazaarvcb -h
usage: bazaarvcb [-h]  ...

optional arguments:
  -h, --help   show this help message and exit

valid commands:
    checkhash  check .hsh files integrity in one directory
    listvm     list registered VMs on the ESXi host
    queryvm    display VMs informations
    listbackup
               search for backups in local and remote directories
    querybackup
               display report file of one particular
    backup     backup a VM
    restore    restore a backup

Open TCP port 31031 in your firewall to ensure that you have a high transfer rate, otherwise the backup will be transferred over SSH protocol and will be capped in speed to about 7MB/s (on the free hypervisor).
Bazaarvcb cannot backup a VM with snapshot(s).

Warning!
I have not tested this on a host connected to a vCenter server and can not confirm that it will work or not.

Tags: , , ,

Posted by

10 Jul 2013 Mount VMware virtual disk VMDK-file in a physical linux machine

This example has been used on a machine with VMware Workstation 9 installed locally.
To mount a VMDK-file you can use the VMware command vmware-mount like this

$ sudo vmware-mount /path/to/vmdk/file/name-of-vmdk-file.vmdk 1 /path/to/mount/point
In the example above we have mounted partition 1 in the VMDK-file from the disk /path/to/vmdk/file/name-of-vmdk-file.vmdk
The files are now accessible from the mount point /path/to/mount/point.

This has been tested in Ubuntu Linux 12.04 LTS.
This command is also available in the Windows version of VMware Workstation.

Tags: , , , ,

Posted by