it-news \(Josef Lahmer\)
2007-May-18 11:28 UTC
[Xen-users] snapshot - backup for xen vm''s
dear list, is there a way to make a lvm-snapshot of an running xen-vm to implement a function like "snapshot-backup"? #) make snapshot #) mount snapshot #) copy files #) umount snapshot #) remove snapshot eg (http://tldp.org/HOWTO/LVM-HOWTO/snapshots_backup.html) regards josy interessting: How to mount a XenVM filesystem on XenServer Host: http://kb.xensource.com/entry.jspa?categoryID=14&externalID=162 ------------------------ Schöne Bücher stilvoll kennzeichnen - mit dem persönlichen Exlibris. Individuell gestaltet, hochwertig verarbeitet, bequem bestellbar. Die Geschenksidee für leidenschaftliche Leser und Sammler! www.mein-exlibris.at - entwickelt und produziert von gugler*. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
it-news (Josef Lahmer) schrieb:> dear list, > > is there a way to make a lvm-snapshot of an running xen-vm to implement a function like "snapshot-backup"? >- Connect to mysql of VM and issue "FLUSH TABLES WITH READ LOCK;FLUSH LOGS"> #) make snapshot- Connect to mysql of VM and issue "UNLOCK tables"> #) mount snapshot > #) copy files > #) umount snapshot > #) remove snapshot > > eg (http://tldp.org/HOWTO/LVM-HOWTO/snapshots_backup.html) > > regards > josy > > interessting: How to mount a XenVM filesystem on XenServer Host: > http://kb.xensource.com/entry.jspa?categoryID=14&externalID=162Hello ! I do this every day. I added two points to your plan which I do with a small perl script to get consistent Backups of my mysql Databases. I also create/destroy the snapshot via this skript and mount the snapshot volume. If you are interested I can send it via Mail. For the backups I backup the mounted snapshot of the VM via dirvish (http://dirvish.org) to another Server. I do this also via VPN with different machines. In my dirvish configuration I have my perl skript as "pre-client" and "post-client" skript which get started via ssh and key Authentication. Bye -- __________________________________________________ Ralf Schenk fon (02 41) 9 91 21-0 fax (02 41) 9 91 21-59 rs@databay.de Databay AG Hüttenstraße 7 D-52068 Aachen www.databay.de Vorstand: Jens Conze, Ralf Schenk, Aresch Yavari Aufsichtsratvorsitzender: Ansgar Vögeli Sitz/Amtsgericht Aachen HRB:8437 USt-IdNr.: DE 210844202 Databay - einfach machen. _________________________________________________ _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Ralf Schenk wrote:> it-news (Josef Lahmer) schrieb: > >> dear list, >> >> is there a way to make a lvm-snapshot of an running xen-vm to implement a function like "snapshot-backup"? >> >> > - Connect to mysql of VM and issue "FLUSH TABLES WITH READ LOCK;FLUSH LOGS" > >> #) make snapshot >> > - Connect to mysql of VM and issue "UNLOCK tables" > >> #) mount snapshot >> #) copy files >> #) umount snapshot >> #) remove snapshot >> >> eg (http://tldp.org/HOWTO/LVM-HOWTO/snapshots_backup.html) >> >> regards >> josy >> >> interessting: How to mount a XenVM filesystem on XenServer Host: >> http://kb.xensource.com/entry.jspa?categoryID=14&externalID=162 >> > > Hello ! > > I do this every day. I added two points to your plan which I do with a > small perl script to get consistent Backups of my mysql Databases. I > also create/destroy the snapshot via this skript and mount the snapshot > volume. If you are interested I can send it via Mail. >Could I talk you into publishing that tool on the list, please? Or sending me a copy to save me some work? _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Nico Kadel-Garcia schrieb:> Ralf Schenk wrote: >> it-news (Josef Lahmer) schrieb: >> >>> dear list, >>> >>> is there a way to make a lvm-snapshot of an running xen-vm to >>> implement a function like "snapshot-backup"? >>> >>> >> - Connect to mysql of VM and issue "FLUSH TABLES WITH READ LOCK;FLUSH >> LOGS" >> >>> #) make snapshot >>> >> - Connect to mysql of VM and issue "UNLOCK tables" >> >>> #) mount snapshot >>> #) copy files >>> #) umount snapshot >>> #) remove snapshot >>> >>> eg (http://tldp.org/HOWTO/LVM-HOWTO/snapshots_backup.html) >>> >>> regards >>> josy >>> >>> interessting: How to mount a XenVM filesystem on XenServer Host: >>> http://kb.xensource.com/entry.jspa?categoryID=14&externalID=162 >>> >> >> Hello ! >> >> I do this every day. I added two points to your plan which I do with a >> small perl script to get consistent Backups of my mysql Databases. I >> also create/destroy the snapshot via this skript and mount the snapshot >> volume. If you are interested I can send it via Mail. >> > Could I talk you into publishing that tool on the list, please? Or > sending me a copy to save me some work? >Hello, there is no secret except that I''m not a real programming guy in the few lines.... Bye -- __________________________________________________ Ralf Schenk fon (02 41) 9 91 21-0 fax (02 41) 9 91 21-59 rs@databay.de Databay AG Hüttenstraße 7 D-52068 Aachen www.databay.de Vorstand: Jens Conze, Ralf Schenk, Aresch Yavari Aufsichtsratvorsitzender: Ansgar Vögeli Sitz/Amtsgericht Aachen HRB:8437 USt-IdNr.: DE 210844202 Databay - einfach machen. _________________________________________________ _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
it-news (Josef Lahmer) wrote:> is there a way to make a lvm-snapshot of an running xen-vm to implement a function like "snapshot-backup"? > > #) make snapshot > #) mount snapshot > #) copy files > #) umount snapshot > #) remove snapshot > > eg (http://tldp.org/HOWTO/LVM-HOWTO/snapshots_backup.html) > > regards > josy > > interessting: How to mount a XenVM filesystem on XenServer Host: > http://kb.xensource.com/entry.jspa?categoryID=14&externalID=162 > >If you : - use an LV (NOT files) on dom0 as storage for domU''s block device - use partitions on domU (NOT LVM) Then both link are applicable right away, in the sense that : - you create an LVM-snapshot of the LV used by domU - use kpartx to create block device nodes for partitions on that LVM-snapshot - mount the partitions - copy files - umount partitions - remove LVM snapshot Personally, I prefer using dom0-LVM directly as partitions on domU (i.e. all partitioning and LVM is handled by dom0). But that will also mean I can''t install domU using Anaconda (in the case of RHEL), I have to manually copy it form an exisisting physical machine. yum --installroot should work, but you need to do some extra configurations afterwards. Yast install to directory on SUSE should also work. Regards, Fajar _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Fajar A. Nugraha wrote:> it-news (Josef Lahmer) wrote: > >> is there a way to make a lvm-snapshot of an running xen-vm to implement a function like "snapshot-backup"? >> >> #) make snapshot >> #) mount snapshot >> #) copy files >> #) umount snapshot >> #) remove snapshot >> >> eg (http://tldp.org/HOWTO/LVM-HOWTO/snapshots_backup.html) >> >> regards >> josy >> >> interessting: How to mount a XenVM filesystem on XenServer Host: >> http://kb.xensource.com/entry.jspa?categoryID=14&externalID=162 >> >> >> > > If you : > - use an LV (NOT files) on dom0 as storage for domU''s block device > - use partitions on domU (NOT LVM) > > Then both link are applicable right away, in the sense that : > - you create an LVM-snapshot of the LV used by domU > - use kpartx to create block device nodes for partitions on that > LVM-snapshot > - mount the partitions > - copy files > - umount partitions > - remove LVM snapshot > > Personally, I prefer using dom0-LVM directly as partitions on domU (i.e. > all partitioning and LVM is handled by dom0). But that will also mean I > can''t install domU using Anaconda (in the case of RHEL), I have to > manually copy it form an exisisting physical machine. > yum --installroot should work, but you need to do some extra > configurations afterwards. > Yast install to directory on SUSE should also work. >Unfortunately, that piece of over-hyped installatiion obscurity known as libvirt does not allow you options to do this, and mandates the use of pygrub. This means that you must have a /dev/xdva device, and grub itself only works if you have a disk, not if you only have partitions. Anaconda is also not your friend: but it''s possible to do RPM or yum installs into a target directory to build your initial OS images on a partition, edit your configuration files there, and boot that. Just beware that "touch" commands in certain RPM post-install scripts will hang and need to be slapped in the head to allow the yum installation to complete. I''ll publish my widget for this when I have a few cycles. It''s also very, very helpful to have enough disk in the partiton to mirror the *whole* RedHat or Fedora installation directory. But doing things this way also allows you to do all your updates at the same time, with a chroot command, which I consider a *huge* bonus. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Nico Kadel-Garcia wrote:> Fajar A. Nugraha wrote: >> it-news (Josef Lahmer) wrote: >> >>> is there a way to make a lvm-snapshot of an running xen-vm to >>> implement a function like "snapshot-backup"? >>>[snip]>> >> If you : >> - use an LV (NOT files) on dom0 as storage for domU''s block device >> - use partitions on domU (NOT LVM) >> >> Then both link are applicable right away[snip]> Unfortunately, that piece of over-hyped installatiion obscurity known > as libvirt does not allow you options to do this, and mandates the use > of pygrub. This means that you must have a /dev/xdva device, and grub > itself only works if you have a disk, not if you only have partitions.pygrub works perfectly with partition-only setup (at least on RHEL5). You could take a virt-manager-based installation, copy the files to partition-only-domU setup, modify grub.conf and fstab, and have a working system. I know this seems like an extra unnecessary step (install-copy-modify instead of just install). Which is why my prefered method is to create a template (in tar.gz, with some host-specific stuff like ssh host key removed), so the next "installation" can simply be a tar xvfz.> It''s also very, very helpful to have enough disk in the partiton to > mirror the *whole* RedHat or Fedora installation directory.I''m not sure what you mean here. I''d prefer to have a local copy of yum repository (including RH installation directory). It''s on local network, accessed via http, but it doesn''t have to be on dom0. That way it scales well if you have lots of dom0s. Regards, Fajar _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Fajar A. Nugraha wrote:> Nico Kadel-Garcia wrote: > >> Fajar A. Nugraha wrote: >> >>> it-news (Josef Lahmer) wrote: >>> >>> >>>> is there a way to make a lvm-snapshot of an running xen-vm to >>>> implement a function like "snapshot-backup"? >>>> >>>> > [snip] > >>> If you : >>> - use an LV (NOT files) on dom0 as storage for domU''s block device >>> - use partitions on domU (NOT LVM) >>> >>> Then both link are applicable right away >>> > [snip] > >> Unfortunately, that piece of over-hyped installatiion obscurity known >> as libvirt does not allow you options to do this, and mandates the use >> of pygrub. This means that you must have a /dev/xdva device, and grub >> itself only works if you have a disk, not if you only have partitions. >> > pygrub works perfectly with partition-only setup (at least on RHEL5). > You could take a virt-manager-based installation, copy the files to > partition-only-domU setup, modify grub.conf and fstab, and have a > working system. > > I know this seems like an extra unnecessary step (install-copy-modify > instead of just install). Which is why my prefered method is to create a > template (in tar.gz, with some host-specific stuff like ssh host key > removed), so the next "installation" can simply be a tar xvfz. >It is a painful extra step. Pygrub doesn''t read the MBR off of the para-virtualized image? I''ve used the "jailtime" tarballs for CentOS: they''re fairly reasonable, but are cluttered with disk images rather than simply providing a tarball and letting the installer set up their own partitions.>> It''s also very, very helpful to have enough disk in the partiton to >> mirror the *whole* RedHat or Fedora installation directory. >> > I''m not sure what you mean here. I''d prefer to have a local copy of yum > repository (including RH installation directory). It''s on local network, > accessed via http, but it doesn''t have to be on dom0. That way it scales > well if you have lots of dom0s. > > Regards, > > Fajar >Mirror the whole RedHat DVD or network install site. Copy it to local disk on the domain creating machine: you want this all to happen on local disk, *NOT* over a network! Make a new partition, and mount it. Copy the whole thing over to /var/cache/yum/base/packages and work from there to install whatever you want, usually with yum. Do an alternative root directory RPM or Yum installation into that directory. But using yum, it downloads the files: it''s vastly faster to simply copy them over and use a "file:///" based URL, rather than the classic HTTP or FTP URL''s. be already available or wind up downloaded into /var/cache/yum in the target directory, but you have a huge advantage in being able to do the updates or add-on packages at OS image install time, rather than wending your way through Some folks try to set up teeny-tiny little Xen partitions for firewalls or other resource limited setups, so they might not have the space to do this stunt comfortably. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Nico Kadel-Garcia wrote:> Fajar A. Nugraha wrote: >>> Unfortunately, that piece of over-hyped installatiion obscurity known >>> as libvirt does not allow you options to do this, and mandates the use >>> of pygrub. This means that you must have a /dev/xdva device, and grub >>> itself only works if you have a disk, not if you only have partitions. >>> >> pygrub works perfectly with partition-only setup (at least on RHEL5). >> > Pygrub doesn''t read the MBR off of the para-virtualized image? >No. Grub does, pygrub doesn''t. Pygrub simply checks the presence of /boot/grub/menu.lst on domU and reads it. You don''t need to have grub installed on domU to have pygrub work, you just need that file.> I''ve used the "jailtime" tarballs for CentOS: they''re fairly > reasonable, but are cluttered with disk images rather than simply > providing a tarball and letting the installer set up their own > partitions. >I see. I haven''t used those (partly because I don''t need to). My tarball simply contains the content of domU root fs. You still need to setup the partitions manually. This was the best option for me (compared to disk images, virt-manager, yum --installroot, etc.) but it might not be suitable for everybody.>>> It''s also very, very helpful to have enough disk in the partiton to >>> mirror the *whole* RedHat or Fedora installation directory. >> I''m not sure what you mean here. I''d prefer to have a local copy of yum >> repository (including RH installation directory). It''s on local network, >> accessed via http, but it doesn''t have to be on dom0. That way it scales >> well if you have lots of dom0s. >> > Mirror the whole RedHat DVD or network install site. Copy it to local > disk on the domain creating machine: you want this all to happen on > local disk, *NOT* over a network! Make a new partition, and mount it. > Copy the whole thing over to /var/cache/yum/base/packages and work > from there to install whatever you want, usually with yum. Do an > alternative root directory RPM or Yum installation into that > directory. But using yum, it downloads the files: it''s vastly faster > to simply copy them over and use a "file:///" based URL, rather than > the classic HTTP or FTP URL''s. be already available or wind up > downloaded into /var/cache/yum in the target directory, but you have a > huge advantage in being able to do the updates or add-on packages at > OS image install time, rather than wending your way through >In my setup I use a local yum repository via http. I have several installation methods, actually : - for PV domUs : use tar.gz templates. - for HVM domUs and physical machine : Use custom RH installer, either via CD/DVD or network (PXE) install. The tar.gz fast is signifcantly faster than rpm-based install (including yum --installroot), even when the RPMS is on local disk (I tried this before), partly due to the fact that RPM needs extra steps (dep resolution, pre/post install scripts, etc.) other than simply writing files like the tar.gz. It has all necessary add-on packages included. You still need to do a "yum-upgrade" afterwards, but the total time required is still a lot faster. The custom RH installer is basically the standard RHEL 5 installer with a kickstart file that adds additional yum repository and installs some local packages. It check files from CD/DVD (if available) and network repository, chooses the newest version, and performs the installation. This way it performs updates and installs add-on packages at OS image install time. The CD/DVD is created from an ISO image that is updated weekly to contain only the newest packages in addition to add-on packages. You still get newest packages at install time even if you use an old DVD since it will automatically compare the local version with the one on network repository and choose whichever is newest. Network BW is not an issue since I''m working on local, 1Gbps network. Besides, "Mirror the whole RedHat DVD or network install site. Copy it to local disk on the domain" would use up that BW anyway. Again, this was the best option for me but it might not be suitable for everybody. Regards, Fajar _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Fajar A. Nugraha wrote:> Nico Kadel-Garcia wrote: > > >> Mirror the whole RedHat DVD or network install site. Copy it to local >> disk on the domain creating machine: you want this all to happen on >> local disk, *NOT* over a network! Make a new partition, and mount it. >> Copy the whole thing over to /var/cache/yum/base/packages and work >> from there to install whatever you want, usually with yum. Do an >> alternative root directory RPM or Yum installation into that >> directory. But using yum, it downloads the files: it''s vastly faster >> to simply copy them over and use a "file:///" based URL, rather than >> the classic HTTP or FTP URL''s. be already available or wind up >> downloaded into /var/cache/yum in the target directory, but you have a >> huge advantage in being able to do the updates or add-on packages at >> OS image install time, rather than wending your way through >> >> > In my setup I use a local yum repository via http. > I have several installation methods, actually : > - for PV domUs : use tar.gz templates. > - for HVM domUs and physical machine : Use custom RH installer, either > via CD/DVD or network (PXE) install. >Working via HTTP is usually far, far slower than working via local file access to simply copy the repository. It''s even *faster* if you don''t build your partition first, use "cp -al" to copy the repository to the chrooted /var/cache/yum/packages, and run a chrooted "yum clean all" when you''r edopne. Then you build the tarball from a directory, not a partition.> The tar.gz fast is signifcantly faster than rpm-based install (including > yum --installroot), even when the RPMS is on local disk (I tried this > before), partly due to the fact that RPM needs extra steps (dep > resolution, pre/post install scripts, etc.) other than simply writing > files like the tar.gz. It has all necessary add-on packages included. > You still need to do a "yum-upgrade" afterwards, but the total time > required is still a lot faster. >Oh, yes. I''ve done..... roughly 15,000 Linux servers in one month that way. I referred to the RPM/Yum games as ways of building your initial tarballs, without having to worry about a machine or environment to get that initial install into.> The custom RH installer is basically the standard RHEL 5 installer with > a kickstart file that adds additional yum repository and installs some > local packages. It check files from CD/DVD (if available) and network > repository, chooses the newest version, and performs the installation. > This way it performs updates and installs add-on packages at OS image > install time. The CD/DVD is created from an ISO image that is updated > weekly to contain only the newest packages in addition to add-on > packages. You still get newest packages at install time even if you use > an old DVD since it will automatically compare the local version with > the one on network repository and choose whichever is newest. >Yup, I''ve used that sort of technique myself and highly approve of it. You do need to keep it vaguely up-to-date to keep installations fast: I''ve used it for network booting Beowulf clusters, which got wiped and re-installed every time they rebooted.> Network BW is not an issue since I''m working on local, 1Gbps network. > Besides, "Mirror the whole RedHat DVD or network install site. Copy it > to local disk on the domain" would use up that BW anyway. Again, this > was the best option for me but it might not be suitable for everybody. >Nah, you leave it on a build machine from which you generate your tarballs, or do it on your HTTP server. The download directory is left around for the next session, not downloaded each time. It avoids the HTTP download time you mentioned above. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
it-news \(Josef Lahmer\)
2007-May-29 07:59 UTC
AW: [Xen-users] snapshot - backup for xen vm''s
dear ralf schenk, dear Fajar, i''ve useing the xensource installation iso which does lvm on dom0 by default and i am quite happy with this installation. now i''m using backup from vm with mounting an archive nfs-server store and copy the important files. thank you very mutch for your helpful information getting a 24h available machine. :-) regards from austria, josy _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Does this snapshot backup idea work with image? I didn''t put guest system as partition, I put them as image, one huge image. Does this backup way work with image? cause I don''t wanna to save /restore everytime when I backup the guest system. It takes 10 mins downtime! cheers! it-news (Josef Lahmer) wrote:>dear ralf schenk, >dear Fajar, > >i''ve useing the xensource installation iso which does lvm on dom0 by default and i am quite happy with this installation. > >now i''m using backup from vm with mounting an archive nfs-server store and copy the important files. > >thank you very mutch for your helpful information getting a 24h available machine. :-) > >regards from austria, >josy > > > >_______________________________________________ >Xen-users mailing list >Xen-users@lists.xensource.com >http://lists.xensource.com/xen-users > >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Fajar A. Nugraha
2007-Jun-04 05:50 UTC
Re: AW: [Xen-users] snapshot - backup for xen vm''s
Xin Chen wrote:> > Does this snapshot backup idea work with image? > > I didn''t put guest system as partition, I put them as image, one huge > image. Does this backup way work with image? >"backup from vm with mounting an archive nfs-server", like Josef did, works pretty much for any kind of setup since you''re doing backups from domU (not 0). But in that case you don''t create a snapshot first. An example whre this might be good, is if you only have small files which rarely changed (think php web pages, config files, etc.). An example where this might be BAD : - You have mysql or oracle - Store data on LARGE datafiles (say several hundred MBs) - Your database server is busy, accessed and updated all the time - You "backup" the datafile by copying it to remote nfs server while the db server is running Which leads to unrecoverable, inconsistent database. My initial suggestion to Josef''s question was to use LVMs for domU storage, and use LVM snapshot to create a "consistent" view of the filesystem at that time. If you use file-backed image domU, stored on domU filesystem, then you can still use LVM snapshots. It just requires a few different steps. Assuming your dom0 is stored on LVM (not partition): - create an LVM snapshot of dom0''s fileystem - mount that snapshot - backup your image from that snapshot Note that in this case you backup the entire domU HD image, and NOT their content. If your domU uses LVM setup (inside the domU), then this is pretty much the only option you have. You can backup the disk image, but not the content directly. However, If you use those file-based disk images as direct partitions on domU, you can mount the file from that snapshot to get their content. If your domU use partition setup (not LVM setup), you can use kpartx and create block device entries.> cause I don''t wanna to save /restore everytime when I backup the guest > system. It takes 10 mins downtime! >You don''t have to. Not if you just want to backup the disk image or its content. Regards, Fajar> cheers! > > it-news (Josef Lahmer) wrote: > >> dear ralf schenk, >> dear Fajar, >> >> i''ve useing the xensource installation iso which does lvm on dom0 by >> default and i am quite happy with this installation. >> >> now i''m using backup from vm with mounting an archive nfs-server >> store and copy the important files. >>_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Fajar A. Nugraha
2007-Jun-04 05:50 UTC
Re: AW: [Xen-users] snapshot - backup for xen vm''s
Xin Chen wrote:> > Does this snapshot backup idea work with image? > > I didn''t put guest system as partition, I put them as image, one huge > image. Does this backup way work with image? >"backup from vm with mounting an archive nfs-server", like Josef did, works pretty much for any kind of setup since you''re doing backups from domU (not 0). But in that case you don''t create a snapshot first. An example whre this might be good, is if you only have small files which rarely changed (think php web pages, config files, etc.). An example where this might be BAD : - You have mysql or oracle - Store data on LARGE datafiles (say several hundred MBs) - Your database server is busy, accessed and updated all the time - You "backup" the datafile by copying it to remote nfs server while the db server is running Which leads to unrecoverable, inconsistent database. My initial suggestion to Josef''s question was to use LVMs for domU storage, and use LVM snapshot to create a "consistent" view of the filesystem at that time. If you use file-backed image domU, stored on domU filesystem, then you can still use LVM snapshots. It just requires a few different steps. Assuming your dom0 is stored on LVM (not partition): - create an LVM snapshot of dom0''s fileystem - mount that snapshot - backup your image from that snapshot Note that in this case you backup the entire domU HD image, and NOT their content. If your domU uses LVM setup (inside the domU), then this is pretty much the only option you have. You can backup the disk image, but not the content directly. However, If you use those file-based disk images as direct partitions on domU, you can mount the file from that snapshot to get their content. If your domU use partition setup (not LVM setup), you can use kpartx and create block device entries.> cause I don''t wanna to save /restore everytime when I backup the guest > system. It takes 10 mins downtime! >You don''t have to. Not if you just want to backup the disk image or its content. Regards, Fajar> cheers! > > it-news (Josef Lahmer) wrote: > >> dear ralf schenk, >> dear Fajar, >> >> i''ve useing the xensource installation iso which does lvm on dom0 by >> default and i am quite happy with this installation. >> >> now i''m using backup from vm with mounting an archive nfs-server >> store and copy the important files. >>_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Fajar A. Nugraha
2007-Jun-04 05:52 UTC
Re: AW: [Xen-users] snapshot - backup for xen vm''s
Xin Chen wrote:> > Does this snapshot backup idea work with image? > > I didn''t put guest system as partition, I put them as image, one huge > image. Does this backup way work with image? >"backup from vm with mounting an archive nfs-server", like Josef did, works pretty much for any kind of setup since you''re doing backups from domU (not 0). But in that case you don''t create a snapshot first. An example whre this might be good, is if you only have small files which rarely changed (think php web pages, config files, etc.). An example where this might be BAD : - You have mysql or oracle - Store data on LARGE datafiles (say several hundred MBs) - Your database server is busy, accessed and updated all the time - You "backup" the datafile by copying it to remote nfs server while the db server is running Which leads to unrecoverable, inconsistent database. My initial suggestion to Josef''s question was to use LVMs for domU storage, and use LVM snapshot to create a "consistent" view of the filesystem at that time. If you use file-backed image domU, stored on domU filesystem, then you can still use LVM snapshots. It just requires a few different steps. Assuming your dom0 is stored on LVM (not partition): - create an LVM snapshot of dom0''s fileystem - mount that snapshot - backup your image from that snapshot Note that in this case you backup the entire domU HD image, and NOT their content. If your domU uses LVM setup (inside the domU), then this is pretty much the only option you have. You can backup the disk image, but not the content directly. However, If you use those file-based disk images as direct partitions on domU, you can mount the file from that snapshot to get their content. If your domU use partition setup (not LVM setup), you can use kpartx and create block device entries.> cause I don''t wanna to save /restore everytime when I backup the guest > system. It takes 10 mins downtime! >You don''t have to. Not if you just want to backup the disk image or its content. Regards, Fajar> cheers! > > it-news (Josef Lahmer) wrote: > >> dear ralf schenk, >> dear Fajar, >> >> i''ve useing the xensource installation iso which does lvm on dom0 by >> default and i am quite happy with this installation. >> >> now i''m using backup from vm with mounting an archive nfs-server >> store and copy the important files. >>_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Thanks a lot! It really helps. Let me summarise some backup ideas here: (only for file-backed image Dom U) Dom 0: LVM Dom U: file-backed image, LVM inside Dom U. Backup dom U: idea 1: given by Petersson Mats # xm save domU somefile # cp domU.img domU.img.bak # cp somefile somefile.bak # xm restore somefile note: save / restore for full-virtual is only available in Xen 3.10. idea 2: given by Fajar, correct me if I misunderstand. 1), assume I put all guest images in dom 0 /var/lib/xen/images (image1, image2 ...) each image is a guest system. 2), make snapshot for /var/lib/xen/images. question: if image1 is 10G, image2 is 20G, how large the snapshot needs? 30G enough? I am quit sure how snapshot works when it is a very big image file. 3), mount snapshot 4), copy image1 .... copy image2....... 5), umount 6), remove snapshot. question: the image1.bak actually is a backup of a running guest system, when I start the system by this image1.bak, the system is gonna be OK? It is like a reboot a running system, isn''t it? correct me. plz. or maybe some reference for my stupid question. --- compare: idea 1 seems easier to do, but the system would be unavailable for 10 or more mins, copy 10G file isn''t so quick..... idea 2 seems more complicate, but it make the system running 24 hours. Is there any better ideas for backing up xen guest file based dom U ? please advise. Thanks a lot for all kind people in the xen-list. cheers, x Fajar A. Nugraha wrote:>Xin Chen wrote: > > >>Does this snapshot backup idea work with image? >> >>I didn''t put guest system as partition, I put them as image, one huge >>image. Does this backup way work with image? >> >> >> >"backup from vm with mounting an archive nfs-server", like Josef did, >works pretty much for any kind of setup since you''re doing backups from >domU (not 0). But in that case you don''t create a snapshot first. > >An example whre this might be good, is if you only have small files >which rarely changed (think php web pages, config files, etc.). > >An example where this might be BAD : >- You have mysql or oracle >- Store data on LARGE datafiles (say several hundred MBs) >- Your database server is busy, accessed and updated all the time >- You "backup" the datafile by copying it to remote nfs server while the >db server is running >Which leads to unrecoverable, inconsistent database. > >My initial suggestion to Josef''s question was to use LVMs for domU >storage, and use LVM snapshot to create a "consistent" view of the >filesystem at that time. > >If you use file-backed image domU, stored on domU filesystem, then you >can still use LVM snapshots. It just requires a few different steps. >Assuming your dom0 is stored on LVM (not partition): >- create an LVM snapshot of dom0''s fileystem >- mount that snapshot >- backup your image from that snapshot > >Note that in this case you backup the entire domU HD image, and NOT >their content. If your domU uses LVM setup (inside the domU), then this >is pretty much the only option you have. You can backup the disk image, >but not the content directly. > >However, >If you use those file-based disk images as direct partitions on domU, >you can mount the file from that snapshot to get their content. >If your domU use partition setup (not LVM setup), you can use kpartx and >create block device entries. > > > >>cause I don''t wanna to save /restore everytime when I backup the guest >>system. It takes 10 mins downtime! >> >> >> >You don''t have to. Not if you just want to backup the disk image or its >content. >Regards, > >Fajar > > > > >>cheers! >> >>it-news (Josef Lahmer) wrote: >> >> >> >>>dear ralf schenk, >>>dear Fajar, >>> >>>i''ve useing the xensource installation iso which does lvm on dom0 by >>>default and i am quite happy with this installation. >>> >>>now i''m using backup from vm with mounting an archive nfs-server >>>store and copy the important files. >>> >>> >>> > > >_______________________________________________ >Xen-users mailing list >Xen-users@lists.xensource.com >http://lists.xensource.com/xen-users > >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Chris Richardson
2007-Jun-19 02:42 UTC
Re: AW: [Xen-users] snapshot - backup for xen vm''s
I run our images on a clustered fs ocfs2 to be exact and use a san to supply the space along with alowing me to share the fs between multiple servers. the reason i do this is live migration is a breeze using san/ocfs2 and using the sans internal snapshots provide backup. -Chris Xin Chen wrote:> Thanks a lot! It really helps. > > Let me summarise some backup ideas here: (only for file-backed image > Dom U) > > Dom 0: LVM > Dom U: file-backed image, LVM inside Dom U. > > Backup dom U: > > idea 1: given by Petersson Mats > > # xm save domU somefile > # cp domU.img domU.img.bak > # cp somefile somefile.bak > # xm restore somefile > > note: save / restore for full-virtual is only available in Xen 3.10. > > idea 2: given by Fajar, correct me if I misunderstand. > > 1), assume I put all guest images in dom 0 /var/lib/xen/images > (image1, image2 ...) each image is a guest system. > 2), make snapshot for /var/lib/xen/images. question: if image1 is > 10G, image2 is 20G, how large the snapshot needs? 30G enough? I am > quit sure how snapshot works when it is a very big image file. > 3), mount snapshot > 4), copy image1 .... copy image2....... > 5), umount > 6), remove snapshot. > question: the image1.bak actually is a backup of a running guest > system, when I start the system by this image1.bak, the system is > gonna be OK? It is like a reboot a running system, isn''t it? correct > me. plz. or maybe some reference for my stupid question. > > --- > compare: idea 1 seems easier to do, but the system would be > unavailable for 10 or more mins, copy 10G file isn''t so quick..... > idea 2 seems more complicate, but it make the system running 24 hours. > > Is there any better ideas for backing up xen guest file based dom U ? > please advise. > > Thanks a lot for all kind people in the xen-list. > > cheers, > x > > > > > Fajar A. Nugraha wrote: > >> Xin Chen wrote: >> >> >>> Does this snapshot backup idea work with image? >>> >>> I didn''t put guest system as partition, I put them as image, one huge >>> image. Does this backup way work with image? >>> >>> >> "backup from vm with mounting an archive nfs-server", like Josef did, >> works pretty much for any kind of setup since you''re doing backups from >> domU (not 0). But in that case you don''t create a snapshot first. >> >> An example whre this might be good, is if you only have small files >> which rarely changed (think php web pages, config files, etc.). >> >> An example where this might be BAD : >> - You have mysql or oracle >> - Store data on LARGE datafiles (say several hundred MBs) >> - Your database server is busy, accessed and updated all the time >> - You "backup" the datafile by copying it to remote nfs server while the >> db server is running >> Which leads to unrecoverable, inconsistent database. >> >> My initial suggestion to Josef''s question was to use LVMs for domU >> storage, and use LVM snapshot to create a "consistent" view of the >> filesystem at that time. >> >> If you use file-backed image domU, stored on domU filesystem, then you >> can still use LVM snapshots. It just requires a few different steps. >> Assuming your dom0 is stored on LVM (not partition): >> - create an LVM snapshot of dom0''s fileystem >> - mount that snapshot >> - backup your image from that snapshot >> >> Note that in this case you backup the entire domU HD image, and NOT >> their content. If your domU uses LVM setup (inside the domU), then this >> is pretty much the only option you have. You can backup the disk image, >> but not the content directly. >> >> However, >> If you use those file-based disk images as direct partitions on domU, >> you can mount the file from that snapshot to get their content. >> If your domU use partition setup (not LVM setup), you can use kpartx and >> create block device entries. >> >> >> >>> cause I don''t wanna to save /restore everytime when I backup the guest >>> system. It takes 10 mins downtime! >>> >>> >> You don''t have to. Not if you just want to backup the disk image or its >> content. >> Regards, >> >> Fajar >> >> >> >> >>> cheers! >>> >>> it-news (Josef Lahmer) wrote: >>> >>> >>>> dear ralf schenk, >>>> dear Fajar, >>>> >>>> i''ve useing the xensource installation iso which does lvm on dom0 by >>>> default and i am quite happy with this installation. >>>> >>>> now i''m using backup from vm with mounting an archive nfs-server >>>> store and copy the important files. >>>> >>>> >> >> >> _______________________________________________ >> Xen-users mailing list >> Xen-users@lists.xensource.com >> http://lists.xensource.com/xen-users >> >> > > > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-usersThe information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete this material from any computer. In accordance with industry regulations, all messages are retained and are subject to monitoring. This message has been scanned for viruses and dangerous content and is believed to be clean. Securities offered through Cantella & Co., Inc., Member NASD/SIPC. Home Office: 2 Oliver Street, 11th Floor, Boston, MA 02109 Telephone: (617)521-8630 _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
It seems more complicate for me :-) Is there more details on this? I search the list and found: The same code is also used for migration, where it''s essentially just passing the guest image over to another machine. Live migration also uses the same bits of code, with the difference that the guest isn''t paused initially, instead it runs on and the page-table management is put into "log-dirty" mode. The log-dirty mode allows changes to guest memory to be tracked, and the changes are then transmitted to the new machine. Once the number of changes are small enough, the guest is paused and the last few changes sent to the new machine, and the new machine performs the "restore" part of save/restore. This allows for a very short break in the operations - under good circumstances in the range of a few dozen milliseconds of down-time. ---- by Petersson Mats, Could this be used in backing up? Is there more details about this? Thanks! x Chris Richardson wrote:> I run our images on a clustered fs ocfs2 to be exact and use a san to > supply the space along with alowing me to share the fs between > multiple servers. the reason i do this is live migration is a breeze > using san/ocfs2 and using the sans internal snapshots provide backup. > > -Chris > > Xin Chen wrote: > >> Thanks a lot! It really helps. >> >> Let me summarise some backup ideas here: (only for file-backed image >> Dom U) >> >> Dom 0: LVM >> Dom U: file-backed image, LVM inside Dom U. >> >> Backup dom U: >> >> idea 1: given by Petersson Mats >> >> # xm save domU somefile >> # cp domU.img domU.img.bak >> # cp somefile somefile.bak >> # xm restore somefile >> >> note: save / restore for full-virtual is only available in Xen 3.10. >> >> idea 2: given by Fajar, correct me if I misunderstand. >> >> 1), assume I put all guest images in dom 0 >> /var/lib/xen/images (image1, image2 ...) each image is a guest >> system. >> 2), make snapshot for /var/lib/xen/images. question: if image1 is >> 10G, image2 is 20G, how large the snapshot needs? 30G enough? I am >> quit sure how snapshot works when it is a very big image file. >> 3), mount snapshot >> 4), copy image1 .... copy image2....... >> 5), umount >> 6), remove snapshot. >> question: the image1.bak actually is a backup of a running guest >> system, when I start the system by this image1.bak, the system is >> gonna be OK? It is like a reboot a running system, isn''t it? correct >> me. plz. or maybe some reference for my stupid question. >> >> --- >> compare: idea 1 seems easier to do, but the system would be >> unavailable for 10 or more mins, copy 10G file isn''t so quick..... >> idea 2 seems more complicate, but it make the system running 24 hours. >> >> Is there any better ideas for backing up xen guest file based dom U ? >> please advise. >> >> Thanks a lot for all kind people in the xen-list. >> >> cheers, >> x >> >> >> >> >> Fajar A. Nugraha wrote: >> >>> Xin Chen wrote: >>> >>> >>>> Does this snapshot backup idea work with image? >>>> >>>> I didn''t put guest system as partition, I put them as image, one huge >>>> image. Does this backup way work with image? >>>> >>>> >>> >>> "backup from vm with mounting an archive nfs-server", like Josef did, >>> works pretty much for any kind of setup since you''re doing backups from >>> domU (not 0). But in that case you don''t create a snapshot first. >>> >>> An example whre this might be good, is if you only have small files >>> which rarely changed (think php web pages, config files, etc.). >>> >>> An example where this might be BAD : >>> - You have mysql or oracle >>> - Store data on LARGE datafiles (say several hundred MBs) >>> - Your database server is busy, accessed and updated all the time >>> - You "backup" the datafile by copying it to remote nfs server while >>> the >>> db server is running >>> Which leads to unrecoverable, inconsistent database. >>> >>> My initial suggestion to Josef''s question was to use LVMs for domU >>> storage, and use LVM snapshot to create a "consistent" view of the >>> filesystem at that time. >>> >>> If you use file-backed image domU, stored on domU filesystem, then you >>> can still use LVM snapshots. It just requires a few different steps. >>> Assuming your dom0 is stored on LVM (not partition): >>> - create an LVM snapshot of dom0''s fileystem >>> - mount that snapshot >>> - backup your image from that snapshot >>> >>> Note that in this case you backup the entire domU HD image, and NOT >>> their content. If your domU uses LVM setup (inside the domU), then this >>> is pretty much the only option you have. You can backup the disk image, >>> but not the content directly. >>> >>> However, >>> If you use those file-based disk images as direct partitions on domU, >>> you can mount the file from that snapshot to get their content. >>> If your domU use partition setup (not LVM setup), you can use kpartx >>> and >>> create block device entries. >>> >>> >>> >>>> cause I don''t wanna to save /restore everytime when I backup the guest >>>> system. It takes 10 mins downtime! >>>> >>>> >>> >>> You don''t have to. Not if you just want to backup the disk image or its >>> content. >>> Regards, >>> >>> Fajar >>> >>> >>> >>> >>>> cheers! >>>> >>>> it-news (Josef Lahmer) wrote: >>>> >>>> >>>> >>>>> dear ralf schenk, >>>>> dear Fajar, >>>>> >>>>> i''ve useing the xensource installation iso which does lvm on dom0 by >>>>> default and i am quite happy with this installation. >>>>> >>>>> now i''m using backup from vm with mounting an archive nfs-server >>>>> store and copy the important files. >>>>> >>>>> >>>> >>> >>> >>> _______________________________________________ >>> Xen-users mailing list >>> Xen-users@lists.xensource.com >>> http://lists.xensource.com/xen-users >>> >>> >> >> >> _______________________________________________ >> Xen-users mailing list >> Xen-users@lists.xensource.com >> http://lists.xensource.com/xen-users > > > > > > The information transmitted is intended only for the person or entity > to which it is addressed and may contain confidential and/or > privileged material. Any review, retransmission, dissemination or > other use of, or taking of any action in reliance upon, this information > by persons or entities other than the intended recipient is prohibited. > If you received this in error, please contact the sender and delete this > material from any computer. > > In accordance with industry regulations, all messages are retained and > are subject to monitoring. > This message has been scanned for viruses and dangerous content and is > believed to be clean. > Securities offered through Cantella & Co., Inc., Member NASD/SIPC. > Home Office: 2 Oliver Street, 11th Floor, Boston, MA 02109 > Telephone: (617)521-8630 >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Fajar A. Nugraha
2007-Jun-19 05:47 UTC
Re: AW: [Xen-users] snapshot - backup for xen vm''s
Xin Chen wrote:> idea 2: given by Fajar, correct me if I misunderstand. > > 1), assume I put all guest images in dom 0 /var/lib/xen/images > (image1, image2 ...) each image is a guest system. > 2), make snapshot for /var/lib/xen/images. question: if image1 is > 10G, image2 is 20G, how large the snapshot needs? 30G enough? I am > quit sure how snapshot works when it is a very big image file.For LVM snapshots, you have to allocate enough space to accomodate CHANGES only. For example : - if you have 30G total of data (in this case disk image) to backup - backup process is estimated to take 1 hour - in that 1 hour, it is estimated that would be 5 GB changes then you only need to allocate 5GB or so for the snapshot. The command "lvs" will show you how much space is used for snapshot. You need to make sure that the snapshot isn''t 100% full. Example : # lvs LV VG Attr LSize Origin Snap% Move Log Copy% rootlv rootvg owi-ao 10.00G rootsnaplv rootvg swi-ao 1.00G rootlv 0.06 In this case the original filesystem is 10GB, and I allocate 1 GB for the snapshot, from which only 0.06 is used.> 3), mount snapshot > 4), copy image1 .... copy image2....... > 5), umount > 6), remove snapshot. > question: the image1.bak actually is a backup of a running guest > system, when I start the system by this image1.bak, the system is > gonna be OK? It is like a reboot a running system, isn''t it?Exactly. To be more specific, it will be like if you run "reboot -f", or a reboot in the event of power failure. There will be some automatic log-replay (if you use journaling filesystem), but if your system can survive a power failure then it can survive the snapshot-backup-restore. Regards, Fajar _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Fajar A. Nugraha wrote:>Xin Chen wrote: > > >>idea 2: given by Fajar, correct me if I misunderstand. >> >>1), assume I put all guest images in dom 0 /var/lib/xen/images >>(image1, image2 ...) each image is a guest system. >>2), make snapshot for /var/lib/xen/images. question: if image1 is >>10G, image2 is 20G, how large the snapshot needs? 30G enough? I am >>quit sure how snapshot works when it is a very big image file. >> >> >For LVM snapshots, you have to allocate enough space to accomodate >CHANGES only. For example : >- if you have 30G total of data (in this case disk image) to backup >- backup process is estimated to take 1 hour >- in that 1 hour, it is estimated that would be 5 GB changes > >then you only need to allocate 5GB or so for the snapshot. The command >"lvs" will show you how much space is used for snapshot. You need to >make sure that the snapshot isn''t 100% full. Example : > ># lvs > LV VG Attr LSize Origin Snap% Move Log Copy% > rootlv rootvg owi-ao 10.00G > rootsnaplv rootvg swi-ao 1.00G rootlv 0.06 > >In this case the original filesystem is 10GB, and I allocate 1 GB for >the snapshot, from which only >0.06 is used. > > > >>3), mount snapshot >>4), copy image1 .... copy image2....... >>5), umount >>6), remove snapshot. >>question: the image1.bak actually is a backup of a running guest >>system, when I start the system by this image1.bak, the system is >>gonna be OK? It is like a reboot a running system, isn''t it? >> >> >Exactly. To be more specific, it will be like if you run "reboot -f", or >a reboot in the event of power failure. There will be some automatic >log-replay (if you use journaling filesystem), but if your system can >survive a power failure then it can survive the snapshot-backup-restore. > > >Hi Fajar, Thanks a lot for making this clear! In this case, the snapshot is still on risk of rebooting issue. So idea 1(save/restore) is safer but has system down time. idea 2 is 24 hours running but on a rebooting risk. Isn''t there a better idea of backing up xen guest images? what about the live-imigration? Can we use that? All comments welcome. x>Regards, > >Fajar > >>_______________________________________________ >Xen-users mailing list >Xen-users@lists.xensource.com >http://lists.xensource.com/xen-users > >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users