From: Mark Williamson Subject: Re: consistent LVM snapshot of domUs from dom0 Date: Sat, 8 Dec 2007 23:03:08 +0000 Message-ID: <200712082303.10011.mark.williamson@cl.cam.ac.uk> References: <200712081826.23257.mark.williamson@cl.cam.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Mike Sun Cc: nikola.ciprich@linuxbox.cz, xen-devel@lists.xensource.com, Nikola Ciprich List-Id: xen-devel@lists.xenproject.org > Thanks for the question Nikola and the answer Mark, I was wondering > the same thing. > > Here's another scenario. What if dom0 has a mounted LVM filesystem, > and a file-backed VBD located on that filesystem is used as the root > filesystem by a domU. Would LVM snapshots of the mounted LVM > filesystem provide consistent checkpoints? I believe the filesystem on the LVM volume should be consistent (as long as you're using one of the common Linux filesystems which can be frozen for a snapshot to take place). However, the guest filesystem in the file-backed VBD will not be consistent: if you try to mount that VBD it will be in an unclean and possibly inconsistent state. The only way you can guarantee a consistent view of a guest filesystem is with the guest's co-operation, either by using a network or cluster filesystem, or (as Nik has suggested) by explicitly asking for the domain to freeze its filesystem state for a while. Cheers, Mark > In looking at how xm suspend works, it seems that only memory state is > saved and nothing is done to ensure the guest domain puts its > filesystem into a consistent state, though I'm not completely certain > about that. > > Mike > > On Dec 8, 2007 1:26 PM, Mark Williamson wrote: > > > I'd like to ask a question regarding LVM snapshots: > > > normally if You make a snapshot of mounted LVM partition, DM > > > infrastructure handles putting fs into consistent state using VFS > > > infrastructure. BUT, does it work even if I make snapshot of LV used by > > > XEN? > > > > If your LVM is running in dom0 and you snapshot the storage used by a > > domU then, no, it won't snapshot the domU's filesystem automatically. > > > > > If not, I guess it should not be that hard to fix, I guess we just need > > > to notify domU kernel to call needed VFS function to put fs into > > > consistent state prior to creating snapshot. > > > > Yep. > > > > > Can somebody comment on it, eventually correct me if I'm wrong? > > > > You're quite right. I've just had a look at it and it looks quite > > feasible to do this. The obvious simple way to implement it would be to > > add an xm command that causes a domain to freeze its filesystems into a > > consistent state and then return when that is done. > > > > e.g. > > > > xm create mydomain > > xm fs_freeze mydomain > > > > xm fs_unfreeze mydomain > > > > Ideally the backup operation would just take a snapshot e.g. using LVM or > > qcow. With a bit more tools / storage integration we could have an "xm > > safesnapshot" command that would create a coherent snapshot of the disk. > > > > It would be awesome. > > > > Cheers, > > Mark > > > > -- > > Dave: Just a question. What use is a unicyle with no seat? And no > > pedals! Mark: To answer a question with a question: What use is a > > skateboard? Dave: Skateboards have wheels. > > Mark: My wheel has a wheel! > > > > > > _______________________________________________ > > Xen-devel mailing list > > Xen-devel@lists.xensource.com > > http://lists.xensource.com/xen-devel -- Dave: Just a question. What use is a unicyle with no seat? And no pedals! Mark: To answer a question with a question: What use is a skateboard? Dave: Skateboards have wheels. Mark: My wheel has a wheel!