Skip to main content

Bloggers

Gert: blog
Mario: blog
Bert: blog
Guy: blog
Maarten: blog

Maarten's Blog

Syndicate content
open-future
Updated: 43 min 30 sec ago

Restore Amanda Backup

Mon, 2010-02-08 12:35

I'm writing this blogpost so I can quickly find the needed commands to restore a file from an amanda backup. Below is a procedure on how to extract the LocalSettings.php file. The /data/amanda/tapes is the directory where the virtual tapes are located. The host is backup, amanda org is Daily.

[root@backup backup]# amrecover Daily -s backup -t backup \
-d file:/data/amanda/tapes
AMRECOVER Version 2.5.0p2. Contacting server on backup ...
220 backup AMANDA index server (2.5.0p2) ready.
200 Access OK
Setting restore date to today (2009-12-02)
200 Working date set to 2009-12-02.
Scanning /data/amanda/holding...
200 Config set to Daily.
200 Dump host set to backup.vsco.be.
Trying disk / ...
Trying disk rootfs ...
Can't determine disk and mount point from $CWD '/backup'
amrecover>

ok now we can start by specifying which file is needed to restore.

amrecover> sethost web.vsco.be
200 Dump host set to web.vsco.be.

First the disk (you can view all disks with the command listdisk):

amrecover> setdisk /data
200 Disk set to /data.

amrecover> setdate 2009-11-30
200 Working date set to 2009-11-30.

amrecover> ls
2009-11-30 www/
2009-11-30 lost+found/
2009-11-30 home/

amrecover> cd www/wiki
/backup/data/www/wiki

Now add the file/files you want to restore (wildcars can be used)

amrecover> add LocalSettings.php
Added /www/wiki/LocalSettings.php

amrecover> extract

Extracting files using tape drive null: on host backup.
The following tapes are needed: Daily-005

Restoring files into directory /backup
Continue [?/Y/n]? Y

Extracting files using tape drive null: on host backup.
Load tape Daily-005 now
Continue [?/Y/n/s/t]?

Now we have to mount the correct tape, either by changing the soft link in /backup/amanda/tapes/

Or with the amtape command, do this in another shell, and keep your amrecover shell open:

[root@backup backup]# su - amanda
-bash-3.2$ amtape Daily current
changer: got exit: 0 str: 14 18 1
changer_query: changer return was 18 1
changer_query: searchable = 0
amtape: scanning current slot in tape-changer rack:
changer: got exit: 0 str: 14 file:/data/amanda/tapes
slot 14: date 20091202 label Daily-014

We can see we are currently on slot 14 which contains tape Daily-014

-bash-3.2$ amtape Daily show
changer: got exit: 0 str: 14 18 1
changer_query: changer return was 18 1
changer_query: searchable = 0
amtape: scanning all 18 slots in tape-changer rack:
changer_find: looking for NULL changer is searchable = 0
changer: got exit: 0 str: 14 file:/data/amanda/tapes
slot 14: date 20091202 label Daily-014
changer: got exit: 0 str: 15 file:/data/amanda/tapes
slot 15: not an amanda tape (Read 0 bytes)
changer: got exit: 0 str: 16 file:/data/amanda/tapes
slot 16: not an amanda tape (Read 0 bytes)
changer: got exit: 0 str: 17 file:/data/amanda/tapes
slot 17: not an amanda tape (Read 0 bytes)
changer: got exit: 0 str: 18 file:/data/amanda/tapes
slot 18: not an amanda tape (Read 0 bytes)
changer: got exit: 0 str: 1 file:/data/amanda/tapes
slot 1: date 20091119 label Daily-001
changer: got exit: 0 str: 2 file:/data/amanda/tapes
slot 2: date 20091120 label Daily-002
changer: got exit: 0 str: 3 file:/data/amanda/tapes
slot 3: date 20091121 label Daily-003
changer: got exit: 0 str: 4 file:/data/amanda/tapes
slot 4: date 20091122 label Daily-004
changer: got exit: 0 str: 5 file:/data/amanda/tapes
slot 5: date 20091123 label Daily-005
changer: got exit: 0 str: 6 file:/data/amanda/tapes
slot 6: date 20091124 label Daily-006
changer: got exit: 0 str: 7 file:/data/amanda/tapes
slot 7: date 20091125 label Daily-007
changer: got exit: 0 str: 8 file:/data/amanda/tapes
slot 8: date 20091126 label Daily-008
changer: got exit: 0 str: 9 file:/data/amanda/tapes
slot 9: date 20091127 label Daily-009
changer: got exit: 0 str: 10 file:/data/amanda/tapes
slot 10: date 20091128 label Daily-010
changer: got exit: 0 str: 11 file:/data/amanda/tapes
slot 11: date 20091129 label Daily-011
changer: got exit: 0 str: 12 file:/data/amanda/tapes
slot 12: date 20091130 label Daily-012
changer: got exit: 0 str: 13 file:/data/amanda/tapes
slot 13: date 20091201 label Daily-013

We need the tape in slot 5

-bash-3.2$ amtape Daily slot 5
changer: got exit: 0 str: 5 file:/data/amanda/tapes
amtape: changed to slot 5 on file:/data/amanda/tapes
-bash-3.2$ amtape Daily current
changer: got exit: 0 str: 5 18 1
changer_query: changer return was 18 1
changer_query: searchable = 0
amtape: scanning current slot in tape-changer rack:
changer: got exit: 0 str: 5 file:/data/amanda/tapes
slot 5: date 20091123 label Daily-005

Ok now we can continue our extract in the amrecover shell.

amrecover> extract

Extracting files using tape drive file:/data/amanda/tapes on host backup.
The following tapes are needed: Daily-005

Restoring files into directory /backup
Continue [?/Y/n]?

Extracting files using tape drive file:/data/amanda/tapes on host backup.
Load tape Daily-005 now
Continue [?/Y/n/s/t]?
./www/wiki/LocalSettings.php
amrecover> exit

[root@backup backup]# ls -al ./www/wiki/LocalSettings.php
-r-------- 1 48 48 5220 Nov 6 11:15 ./www/wiki/LocalSettings.php

Categories: Planet

Xen attach disk live

Thu, 2010-01-28 17:04

I had to resize a lvm-volume with swap on a xen domU without bringing it down. I'm just making a small how-to so I don't forget it in the future.

On the host create a swapfile big enough to get the currently used swap in it.
dd if=/dev/zero of=swapfile bs=1k count=1500000
mkswap swapfile
swapon swapfile
swapoff /dev/xvdb1

On the Dom0 Xen-server:
xm block-detach server01 /dev/xvdb1
lvresize /dev/vg0/server01_swap -L 2G
mkswap /dev/vg0/server01_swap
xm block-attach server01 phy:/dev/vg0/server01_swap /dev/xvdb1 w

Categories: Planet

Xen with a lot of disks

Thu, 2009-11-19 12:33

I got an error yesterday when trying to create a xen virtual machine with a lot of disks.
I had to add 32 disks on the machine, which would be used to backup the hard drives.
The error was Unable to find number for device (sdq1). I had devices up to sdab1, but he already stuck at the sdq1.
How to work around this problem you ask? Really easy it seems: Just use other device "types" for the disks beginning at sdq1. So sdq1 became hda1.
And all went well.
Viva Xen!!

Categories: Planet

dist-upgrade broke my debian squeeze

Wed, 2009-10-21 09:02

As I was doing updates yesterday I ran into some serious problem. How this happened:
Well I did an apt-get upgrade which first of all broke my nvidia driver. I also had messages like: udev: missing sysfs features; please update the kernel or disable the kernel's
CONFIG_SYSFS_DEPRECATED option; udev may fail to work correctly.
So I did a dist-upgrade to fix the nvidia problem and the sysfs message. This upgraded to kernel 2.6.30-2-686 and broke my system.
During the boot debian was unable to find my lvm volumes. Quite annoying as my /usr is also an lvm partition. First I though I had a corrupt filesystem.

I downloaded the latest system rescue cd from http://www.sysresccd.org. In the rescue prompt all seemed fine, I could mount my lvm's without any problem. So it wasn't a problem with the partitions. I booted again in my broken install and then saw that there were no entries under /dev/mapper. I checked and the dmsetup packages wasn't installed. So I installed it running apt-get install dmsetup in a chrooted environment with the rescue cd.
apt-get install dmsetup
Then the sh*t began, dmsetup was in conflict with devicekit-disks. No problem I though I'll just continue and apt-get will delete the needed packages. But I wasn't paying attention (was already late). It removed all the gnome libraries which meant that my gnome programs were also uninstalled (revelation, virt-manager, ...).
Luckily I don't use gnome as window manager. But this didn't solve my problem, still unable to find the lvm's. I chrooted again in my rescue environment. And found out that there were no lvm commands available.
apt-get install lvm2
This solved my problem, and I was able to boot again. Maybe a lesson to be learned was not to blindly upgrade when you are in sid.
So watch out when doing a dist-upgrade on debian sid. Especially if you have gnome!

I found some info on http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=550434 .

Categories: Planet

selinux not giving errors

Fri, 2009-10-09 10:46

Sometime you have problems with selinux, but you don't see any error messages in the audit.log. Using the following command will give you more output in the log:

semodule -b /usr/share/selinux/targeted/enableaudit.pp

Categories: Planet

Sound problems debian squeeze

Sat, 2009-10-03 17:26

I upgraded to debian squeeze some time ago. In debian lenny I sometimes had problems with the sound card not being found.
On lenny I used alsaconf to rescan the cards and reload the modules needed for them.
It seems now that the alsaconf script isn't included anymore in the alsa-utils package. At first all seemed ok in squeeze, I always had sound. But today, the sound card wasn't detected.

I have an Intel onboard card:
Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller

So how do we fix this? Not that hard it seems, just force the reload of the sound modules:

debian:/# alsa force-reload
Terminating processes: 3435.
Unloading ALSA sound driver modules: snd-seq-dummy snd-seq-oss snd-seq-midi snd-seq-midi-event snd-seq snd-pcm-oss snd-mixer-oss snd-hda-intel snd-usb-audio snd-pcm snd-usb-lib snd-rawmidi snd-hwdep snd-timer snd-seq-device snd-page-alloc.
Loading ALSA sound driver modules: snd-hda-intel snd-usb-audio snd-seq-dummy snd-pcm-oss snd-mixer-oss snd-seq-oss snd-pcm snd-usb-lib snd-hwdep snd-seq-midi snd-rawmidi snd-seq-midi-event snd-seq snd-timer snd-seq-device snd-page-allocWARNING: All config files need .conf: /etc/modprobe.d/nvidia-kernel-nkc, it will be ignored in a future release.

This will also kill any programs locking the sound modules (in my case on KDE is was kmix).

KDE detected the change and switched to the right sound card. It was using my webcam as sound card before.

Categories: Planet
Premium Drupal Themes by Adaptivethemes