How to backup a Domu filesystem (on LVM) from Dom0 on Fedora 8 ?

View: New views
6 Messages — Rating Filter:   Alert me  

How to backup a Domu filesystem (on LVM) from Dom0 on Fedora 8 ?

by Anne Facq :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello

I use XEN on Fedora 8 with Domu on a LVM partition.

Before, on Fedora Core 6, I could backup each Domu by directly mounting
the filesystem of the Domu (mount /dev/vg00/lvfoo /mnt) and then running
dump on it.

On Fedora 8, I can't mount directly the filesystem of the Domu, so I
backup the filesystem of the Domu using the dd command (dd
if=/dev/vg00/lvfoo of=/var/xen/lvfoo.img)
But the backup with dd is longer and takes more disk space than the
backup with dump, as dd copies unused blocks.

Is there a better method to backup a Domu filesystem from Dom0 on Fedora 8 ?

Thanks in advance

Anne Facq


--
Fedora-xen mailing list
Fedora-xen@...
https://www.redhat.com/mailman/listinfo/fedora-xen

Re: How to backup a Domu filesystem (on LVM) from Dom0 on Fedora 8 ?

by Aaron Clark-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Anne Facq wrote:
> Hello
>
> I use XEN on Fedora 8 with Domu on a LVM partition.
>
> Before, on Fedora Core 6, I could backup each Domu by directly mounting
> the filesystem of the Domu (mount /dev/vg00/lvfoo /mnt) and then running
> dump on it.
>
> On Fedora 8, I can't mount directly the filesystem of the Domu, so I

Pardon if this is a dumb question, but why not?

> backup the filesystem of the Domu using the dd command (dd
> if=/dev/vg00/lvfoo of=/var/xen/lvfoo.img)
> But the backup with dd is longer and takes more disk space than the
> backup with dump, as dd copies unused blocks.
>
> Is there a better method to backup a Domu filesystem from Dom0 on Fedora
> 8 ?

I suppose you could use the img2qcow tool (possibly directly on
/dev/vg00/lvfoo) to get a qcow file instead of a raw image.  However, I
vaguely remember seeing somewhere that the qcow created by the xen tools
is not necessarily 100% compatible with other qcow tools.

HTH,
Aaron

--
Fedora-xen mailing list
Fedora-xen@...
https://www.redhat.com/mailman/listinfo/fedora-xen

Re: How to backup a Domu filesystem (on LVM) from Dom0 on Fedora 8 ?

by Anne Facq :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Aaron Clark wrote:

> Anne Facq wrote:
>> Hello
>>
>> I use XEN on Fedora 8 with Domu on a LVM partition.
>>
>> Before, on Fedora Core 6, I could backup each Domu by directly
>> mounting the filesystem of the Domu (mount /dev/vg00/lvfoo /mnt) and
>> then running dump on it.
>>
>> On Fedora 8, I can't mount directly the filesystem of the Domu, so I
>
> Pardon if this is a dumb question, but why not?

Because in Dom0 the device for a paravirt Domu (/dev/vg00/lvfoo in my
case) is mapped to a virtual disk /dev/xvda (I created the Domu with
virt-install), and the only way I found to mount this Domu filesystem,
is to :
- get the size of the boot sector of /dev/vg00/lvfoo
        (with fdisk -ul /dev/vg00/lvfoo)
        = 63
- compute the offset (multiply by block size)
- specify this offset to the mount command :
mount -o offset=32256 /dev/vg00/lvfoo /mnt/

As I can't specify an offset to dump, the command "dump 0 -f lvfoo.dump
/mnt" doesn't work.

>> backup the filesystem of the Domu using the dd command (dd
>> if=/dev/vg00/lvfoo of=/var/xen/lvfoo.img)
>> But the backup with dd is longer and takes more disk space than the
>> backup with dump, as dd copies unused blocks.
>>
>> Is there a better method to backup a Domu filesystem from Dom0 on
>> Fedora 8 ?
>
> I suppose you could use the img2qcow tool (possibly directly on
> /dev/vg00/lvfoo) to get a qcow file instead of a raw image.  However, I
> vaguely remember seeing somewhere that the qcow created by the xen tools
> is not necessarily 100% compatible with other qcow tools.

Thanks for you help, I'm going to have a look at it.

Regards,

Anne Facq


--
Fedora-xen mailing list
Fedora-xen@...
https://www.redhat.com/mailman/listinfo/fedora-xen

Re: How to backup a Domu filesystem (on LVM) from Dom0 on Fedora 8 ?

by Gerd Hoffmann-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Anne Facq wrote:

> Because in Dom0 the device for a paravirt Domu (/dev/vg00/lvfoo in my
> case) is mapped to a virtual disk /dev/xvda (I created the Domu with
> virt-install), and the only way I found to mount this Domu filesystem,
> is to :
> - get the size of the boot sector of /dev/vg00/lvfoo
>     (with fdisk -ul /dev/vg00/lvfoo)
>     = 63
> - compute the offset (multiply by block size)
> - specify this offset to the mount command :
> mount -o offset=32256 /dev/vg00/lvfoo /mnt/

Uh, oh, quite complicated and error prone.  Can be done much easier.

Option (1): Use kpartx, it will create device mapper mappings for your
partitions.  Try "kpartx -v -a /dev/vg00/lvfoo", should give you
/dev/vg00/lvfoop[1234].  "kpartx -d ... " removes the mappings.

Option (2): (works only with xen kernel): Configure the device as
virtual disk *in Domain-0*: "xm block-attach 0 phy:/dev/vg00/lvfoo xvda
w".  Gives you /dev/xvda[1234].  "xm block-detach ..." removes it.

HTH,
  Gerd

--
Fedora-xen mailing list
Fedora-xen@...
https://www.redhat.com/mailman/listinfo/fedora-xen

Re: How to backup a Domu filesystem (on LVM) from Dom0 on Fedora 8 ?

by Markus Armbruster :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Anne Facq <annefacq@...> writes:

> Aaron Clark wrote:
>> Anne Facq wrote:
>>> Hello
>>>
>>> I use XEN on Fedora 8 with Domu on a LVM partition.
>>>
>>> Before, on Fedora Core 6, I could backup each Domu by directly
>>> mounting the filesystem of the Domu (mount /dev/vg00/lvfoo /mnt)
>>> and then running dump on it.
>>>
>>> On Fedora 8, I can't mount directly the filesystem of the Domu, so
>>> I
>>
>> Pardon if this is a dumb question, but why not?
>
> Because in Dom0 the device for a paravirt Domu (/dev/vg00/lvfoo in my
> case) is mapped to a virtual disk /dev/xvda (I created the Domu with
> virt-install), and the only way I found to mount this Domu filesystem,
> is to :
> - get the size of the boot sector of /dev/vg00/lvfoo
> (with fdisk -ul /dev/vg00/lvfoo)
> = 63
> - compute the offset (multiply by block size)
> - specify this offset to the mount command :
> mount -o offset=32256 /dev/vg00/lvfoo /mnt/
>
> As I can't specify an offset to dump, the command "dump 0 -f lvfoo.dump
> /mnt" doesn't work.

Shot from the hip: losetup with the offset?

[...]

--
Fedora-xen mailing list
Fedora-xen@...
https://www.redhat.com/mailman/listinfo/fedora-xen

Re: How to backup a Domu filesystem (on LVM) from Dom0 on Fedora 8 ?

by Anne Facq :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Gerd Hoffmann wrote:

> Anne Facq wrote:
>> Because in Dom0 the device for a paravirt Domu (/dev/vg00/lvfoo in my
>> case) is mapped to a virtual disk /dev/xvda (I created the Domu with
>> virt-install), and the only way I found to mount this Domu filesystem,
>> is to :
>> - get the size of the boot sector of /dev/vg00/lvfoo
>>     (with fdisk -ul /dev/vg00/lvfoo)
>>     = 63
>> - compute the offset (multiply by block size)
>> - specify this offset to the mount command :
>> mount -o offset=32256 /dev/vg00/lvfoo /mnt/
>
> Uh, oh, quite complicated and error prone.  Can be done much easier.
>
> Option (1): Use kpartx, it will create device mapper mappings for your
> partitions.  Try "kpartx -v -a /dev/vg00/lvfoo", should give you
> /dev/vg00/lvfoop[1234].  "kpartx -d ... " removes the mappings.
>
> Option (2): (works only with xen kernel): Configure the device as
> virtual disk *in Domain-0*: "xm block-attach 0 phy:/dev/vg00/lvfoo xvda
> w".  Gives you /dev/xvda[1234].  "xm block-detach ..." removes it.

Many thanks for this solution, it helps me a lot.

If this can help someone, here are the steps to backup a Domu
(filesystem on LVM in backend and on xvda in frontend) with the dump
command from Dom0 (Fedora 8), using one of the 2 solutions you advised,
kpartx :

----------------------------------------------------------------

# The DomU named "foo" must be stopped before dump
xm shutdown -w foo

# Creates device mapper mappings /dev/mapper/lvfoop[1234] for
/dev/vg00/lvfoo
kpartx -v -a /dev/vg00/lvfoo

# Mounts temporarly the filesystem to backup
mount /dev/mapper/lvfoop1 /mnt/lvfoo/

# Launches the dump
/sbin/dump 0 -L FULL_foo -f /BACKUP-XEN/foo.colddump /mnt/lvfoo/

# Umount the filesystem
umount /mnt/lvfoo/

# Removes the mappings
kpartx -d /dev/vg00/lvfoo

# Unmount the filesystem
umount /mnt/lvfoo

# The DomU can now be restarted
xm create --config /var/lib/xend/....

----------------------------------------------------------------

Regards,

Anne Facq

--
Fedora-xen mailing list
Fedora-xen@...
https://www.redhat.com/mailman/listinfo/fedora-xen