This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-users] Backup in a Xen

On Tue, 2007-03-27 at 22:34 +0100, Alan Pearson wrote:
> Albert,
> Could you explain block-attach ?

[X-Posted to xen-users as others might find this useful.]

The xm command have sub-commands called "block-attach" and
"block-detach".  The xm man page explains them (although I think
"block-detach" has inaccurate documentation the last I checked).
Basically they let you hotplug/unplug a (virtual) block device to a
domU.  This is done from the dom0.  So basically what I do is:

dom0# lvcreate -L1G -s -n mydomU sata1/mydomU-snap
dom0# xm block-attach amandaserver phy:sata1/mydomU-snap
dom0# blkid=$(xm block-list amandaserver| tail -n 1| awk '{ print
$1; }')

"xm block-list" lists the block devices attached to a domain.  I'm
making the assumption that the last item in the list is the one most
recently attached.  So far this is has worked but I haven't seen it
actually documented so the behavior could change.  Unfortunately you
have to block-detach by block id instead of the actual device/filename
so we need to keep track of the block id.

After the snapshot has been created and block-attached to the Amanda
server.  The backup server server fscks the newly attached devices,
mounts them, does its backups, and unmounts the attached snapshots.
Then from dom0:

dom0# xm block-detach amandaserver $blkid
dom0# lvremove -f sata1/mydomU-snap

I've described how one would do this from the command line.  Of course
my actual backups use scripts.  I can post those if you want. The
command-line description hopefully gives you the basic idea though.

You can also hot-attach network devices, but I haven't played with that.
Albert W. Hopkins

Xen-users mailing list

<Prev in Thread] Current Thread [Next in Thread>