Skip to main content

vzdump: create KVM backups with an specific name

With Proxmox VE, the virtual environment I am using, you can configure KVM backups, but you are going to get dump files like this:


The names of these files are not very representative and you should rename them if you want to easily identify your KVM backups in your storage.

I am using this command for KVM backups to get the files with their server names:

# vzdump --compress  --snapshot --storage pve-backups --maxfiles 2 --stdout 117 > /mnt/pve/pve-backups/myserver_YYYY_MM_DD.tgz

You can put this command in a cron if you want.

To restore the machine simply run:

# qmrestore /mnt/pve/pve-backups/myserver_YYYY_MM_DD.tgz 117

Bacula: Device is BLOCKED waiting to create a volume

I’m using Bacula server 5.2.3 for backing up my data, actually backing up more than 20 servers. The last days I am getting this message in bacula server from one of my jobs:

12-ene 10:46 bacula-sd JobId 5799: Job Backup-server15.2012-01-12_09.41.51_28 is waiting. Cannot find any appendable volumes.
Please use the "label" command to create a new Volume for:
    Storage:      "FileStorage-server15" (/pools/vol0/server15)
    Pool:         server15-file
    Media type:   File-server15

My backups are disk based, each server has it’s own storage and device, and are configured to label volumes automatically. I am getting this error only from one of my jobs, the others are finishing correctly.

I’ve rechecked all configuration for this client, looking for errors but it had the same settings than the others clients and in the past has been running ok. I’ve checked also, that LabelMedia option has set to yes in it’s device config:

Device {
  Name = FileStorage-server15
  Media Type = File-server15
  Archive Device = /pools/vol0/server15
  LabelMedia = yes;                   # lets Bacula label unlabeled media
  Random Access = Yes;
  AutomaticMount = yes;               # when device opened, read it
  RemovableMedia = no;
  AlwaysOpen = no;

When I listed the pool’s volumes for this client I could see one volume in APPEND state, I have configured bacula to use one volume per job.

*list media pool=server15-file

| MediaId | VolumeName            | VolStatus | Enabled | VolBytes       | VolFiles | VolRetention | Recycle | Slot | InChanger | MediaType    | LastWritten         |
|   7,178 | disk-server157178      | APPEND    |       1 |              0 |        0 |    1,209,600 |       0 |    0 |         0 | File-server15 | 0000-00-00 00:00:00 |

I’ve checked that this volume does not exist physically in disk, so I’ve manually purged this volume in bacula catalog. Anyway when a new job is run it has to create a new volume in bacula catalog.

*purge volume=disk-server157178 yes

When I’ve relaunched this job again, a new volume has been added and the job has finished Ok.
I don’t know exactly why I’ve reached this situation, may be because a few days ago I’ve run out of disk space, but I am not sure.

VLAN tagging on Linux for KVM

Today, I’m going to explain my config for KVM server to get network connectivity on guests machines using tagged vlans to get independent networks. As virtual platform I am using Proxmox ve. Proxmox is a great platform to administer KVM and OpenVZ machines, actually it is based on Debian Lenny, but very soon will be available the 2.0 version based on Debian Squeeze and with many great features.

I have connected my kvm server network interfaces to two different switches and the switch ports configured in trunk mode only accepting traffic for my tagged vlans. For vlan configuration I am using vlan package in debian, rather than specify them like eth0.X, I prefer to configure them using this tool.

To install vlan package simply run:

 # apt-get install vlan

Above the two network interfaces I have configured a bond interface in active-backup mode. My /etc/network/interfaces file looks like this:

iface eth0 inet manual
iface eth1 inet manual

auto bond0
iface bond0 inet manual
        slaves eth0 eth1
        bond_miimon 100
        bond_mode active-backup

auto vlan50
iface vlan50 inet manual
        vlan_raw_device bond0

auto vlan60
iface vlan60 inet manual
       vlan_raw_device bond0

auto vlan100
iface vlan100 inet manual
       vlan_raw_device bond0

auto vmbr0
iface vmbr0 inet static
        bridge_ports vlan100
        bridge_stp off
        bridge_fd 0

auto vmbr50
iface vmbr50 inet static
        bridge_ports vlan50
        bridge_stp off
        bridge_fd 0

auto vmbr60
iface vmbr60 inet static
        bridge_ports vlan60
        bridge_stp off
        bridge_fd 0

I have three bridges configured, vmbr0 (with vlan 100), required to access proxmox web interface, and vmbr50 and vmbr60, each of them accessing to their vlans to provide access to guests. The bridge vmbr0 is the only bridge that has an IP address configured, because is the only interface I’m going to use to access to the kvm server.

Now, it is easy to provide network connectivity to the kvm guests machines, simply you have to link their network interfaces to the bridge you want depending on, to that vlan you want they get access.

For example, part of one of my kvm machine config file looks like this:

vlan60: virtio=DE:17:7C:C3:CE:B2
vlan50: virtio=B2:0A:19:3E:72:4D

This is automatically added using proxmox ve web interface.

Rename linux network interfaces

Sometimes it can be useful to have network interfaces with an recognizable name, rather than eth0, eth1,… with which you can easily identify to which networks they are connected. For example, if you have a server connected to many networks and vlans you can identify the network/vlan based on interface name, eth50 for vlan50, eth100 for vlan100,… or you can simply rename interface to vlan50, vlan100 directly.

In Debian you should install ifrename package and create the file /etc/iftab with this format:

$ cat /etc/iftab 
eth50  mac F2:A8:C0:77:82:94
eth55  mac 4E:DF:22:FD:71:EA

In Redhat/CentOS you can rename /etc/sysconfig/network-scripts/ifcfg-eth0 to /etc/sysconfig/network-scripts/ifcfg-XXXX and edit file specifying this name. For example, I have my ifcfg-eth50 script like this:


In Ubuntu, I did not try it but I think you can edit the file /etc/udev/rules.d/70-persistent-net.rules and change the name of interface according to its mac address.

Access to your switch or router through serial cable

To access to your switch or router through a serial cable you can use tools like kermit or minicom.

To access with kermit in a debian machine you can simple install it with:

# apt-get install ckermit

To run kermit I use this config file in my home directory

$ cat .kermrc
set carrier-watch off
set handshake none
set flow-control none
set line /dev/ttyS0

Once you have connected the serial cable on ttyS0 you can run kermit command:

$ kermit
C-Kermit 8.0.211, 10 Apr 2004, for Linux
 Copyright (C) 1985, 2004,
  Trustees of Columbia University in the City of New York.
Type ? or HELP for help.
(/user/) C-Kermit>

Now, simple type connect kermit command to access to your router:

(/user/) C-Kermit>connect
Connecting to /dev/ttyS0, speed 9600
 Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.


This is simple way to access to your router or switch and configure it.

Notice: Undefined variable: wp_sh_class_name in /home/ on line 1002

Notice: Undefined variable: wp_sh_class_name in /home/ on line 1002

Warning: Use of undefined constant XML - assumed 'XML' (this will throw an Error in a future version of PHP) in /home/ on line 1048

Deprecated: Function create_function() is deprecated in /home/ on line 64