• kvm live backup

    Live backup of your VM running in KVM under Ubuntu using qcow2 disk images

    # First of all disable apparmor to allow access

    # View disks

    # Suspend the domain (This is optional. I do this so that the condition of virtual machines remains unchanged during the backup.)

    # Create snapshot

    # or

    # View snapshots

    # View disks (it must be running on snapshots)

    # Copy drives to backup dir

    # Perform active blockcommit by live merging contents

    # View disks (it must be running on normal drives)

    # Unsuspend the domain

    # View snapshots again

    # Delete snapshots

    # View snapshots to check

    # Delete snapshot files

  • Installing PostgreSQL BDR

    Install PostgreSQL BDR

    For those who get the error:

    The following packages have unmet dependencies:
    postgresql-bdr-9.4: Depends: postgresql-bdr-client-9.4 but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.

    The following packages have unmet dependencies:
    postgresql-bdr-client-9.4: Depends: libpq5 (>= 9.4.4) but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.

    That’s my solution based on https://wiki.postgresql.org/wiki/Apt and http://packages.2ndquadrant.com/bdr/apt/

  • Building an LXC Server

    Building an LXC Server on Ubuntu with ZFS and a container with public IP address

    First update Ubuntu

    Setup ZFS

    Configure LXC

    Configure ZFS

    Create ZFS pool:

    Keep in mind that deduplication takes much more memory and sometimes CPU.

    The rule of Thumb says to have 1GB of Ram per TB of Data. For deduplicated ZPools you actually should have 5 GB of Ram for 1TB of Data. I don’t use it.

    Turn on compression and create fs:

    To configure LXC to use ZFS as the backing store and set the default LXC path, add the following to /etc/lxc/lxc.conf:

    Creating a Container

    Create the first container by doing:

    Setup Bridged Network

    Important Commands

    Show bridge interfaces:

    Simple Bridge

    This setup can be used to connect multiple network interfaces. The bridge acts as a switch: each additional network interface is directly connected to the physical network.

    Edit /etc/network/interfaces, remove eth0, add br0.

    For dynamic IP:

    For static IP:

    reboot server

    Is all OK?

    Edit /tank/lxc/containers/node.name/config

    start the node:

    connect to the node:

    On the lxc node /etc/network/interfaces:

    It’s possible to use static IP address in node config and use dhcp inside the node, that works too.

    But IPv6 didn’t work inside the node, I disabled it and then the node stopped receiving IP address at all.

    I had to use static IP.

    I’m going to solve this problem later.

  • Life with Solaris

  • SmartOS zone that will serve up SmartOS

    PXE Booting SmartOS from SmartOS zone


    We’ve bought a new Supermicro server – chassis and four blades. The provider installed Ubuntu on one of them, and from this I have already set up SmartOS on three other blades. As you know, host machine running on SmartOS boots from PXE server. But I don’t need a separate blade running on Linux, so to ensure safety I decided that each blade could be used as a loader for the rest of them. It was possible to deploy Linux on each host in KVM, but I found a better solution – to deploy PXE server in native SmartOS zone. Isn’t that wonderful when SmartOS can boot SmartOS?

    Here’s how to set up a simple PXE server in a SmartOS zone that will serve up SmartOS

    create pxe-server.json with following:
    Zone Configuration

    Setting up TFTP

    Use zlogin to log into the zone:

    In the zone:

    Setting up DHCP (using Dnsmasq)

    Edit /opt/local/etc/dnsmasq.conf

    Setting up the tftpboot directory

    Ben Rockwood provides a version of undionly.kpxe on his site. Run the following to get the PXE chainload binaries in place:

    At this point a generic PXE boot server is complete. iPXE will still expect smartos.ipxe, but that can be created with whatever content is needed. For those interested in booting SmartOS, what follows are the steps to provide SmartOS boot services on this server.

    Providing SmartOS PXE Boot Services

    A template iPXE config is useful both upfront and when updating to new platform releases. Create /tftpboot/smartos.ipxe.tpl with the following content (-B smartos=true is essential, otherwise logins will fail):

    Deploy/Update to the latest SmartOS platform release

    The steps in this section work for both initial deployment and upgrades as Joyent releases them.

    Next get the latest SmartOS platform and massage it into a workable shape for our iPXE config:

    (Just now URL https://download.joyent.com/pub/iso/platform-latest.tgz is invalid, 404… )

    Make sure PXE boot is enabled and that it is the first in the boot sequence.


    Thanks to Alain O’Dea for his notes about his experience in setting up Ubuntu Server 12.04.1 LTS as a PXE server to boot SmartOS and big thanks to Ben Rockwood for creating and maintaining the PXE Booting SmartOS wiki page. Without their instructions I would not have done it.

    Enjoy and stay tuned!