Reinhard Brandstädter
2007-Mar-27 12:54 UTC
[Xen-users] modifying file-systems in Dom0 while mounted read-only in DomU
Hello, I was quite surprised this worked: I started two virtual machines that both use the same physical partition residing on a SAN (exported read-only by the Xen configuration). While both machines were running I mounted the partition in the Dom0 and changed some files there. These changes were NOT visible in the DomUs, but when I shut down one of the DomUs and started it again with ''xm create'' it had the changes, while the other DomU didn''t. So while it''s not possible to create DomUs with disks that are currently mounted in the Dom0, it is possible to mount disks in the Dom0 that are currently in use by a DomU? Although this is a nice feature - in my case these two DomUs are forming a cluster and the common configuration resides on the read-only disk - it seems dangerous to me. Although with this feature I could seamless change the configuration of the cluster :-) : - mount the partitition in Dom0 - restart one DomU and let it gain the service with changed configuration - restart the second DomU with the new configuration Is there a reason why this is possible? Maybe it isn''t dangerous at all? Reinhard _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Luciano Miguel Ferreira Rocha
2007-Mar-27 13:10 UTC
Re: [Xen-users] modifying file-systems in Dom0 while mounted read-only in DomU
On Tue, Mar 27, 2007 at 02:54:46PM +0200, Reinhard Brandstädter wrote:> So while it''s not possible to create DomUs with disks that are currently > mounted in the Dom0, it is possible to mount disks in the Dom0 that are > currently in use by a DomU?That''s essentially the same thing.> Although this is a nice feature - in my case these two DomUs are forming a > cluster and the common configuration resides on the read-only disk - it seems > dangerous to me. > > Although with this feature I could seamless change the configuration of the > cluster :-) : > - mount the partitition in Dom0 > - restart one DomU and let it gain the service with changed configuration > - restart the second DomU with the new configurationYou should be able to see new data without rebooting by droping cache: echo 3 > /proc/sys/vm/drop_caches But I suggest using a cluster filesystem instead (OCFS2, GFS, etc.). Then the changes will be visible everywhere you mount the filesystem. IIRC, you''ll have to specify the virtual disk to xen with ''...,w!'' to allow multiple mounting of the same partition in read/write mode. -- lfr 0/0 _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Petersson, Mats
2007-Mar-27 13:17 UTC
RE: [Xen-users] modifying file-systems in Dom0 while mounted read-only in DomU
> -----Original Message----- > From: xen-users-bounces@lists.xensource.com > [mailto:xen-users-bounces@lists.xensource.com] On Behalf Of > Reinhard Brandstädter > Sent: 27 March 2007 13:55 > To: xen-users@lists.xensource.com > Subject: [Xen-users] modifying file-systems in Dom0 while > mounted read-only in DomU > > Hello, > > I was quite surprised this worked: > I started two virtual machines that both use the same > physical partition > residing on a SAN (exported read-only by the Xen configuration). > While both machines were running I mounted the partition in > the Dom0 and > changed some files there. These changes were NOT visible in > the DomUs, but > when I shut down one of the DomUs and started it again with > ''xm create'' it > had the changes, while the other DomU didn''t. > > So while it''s not possible to create DomUs with disks that > are currently > mounted in the Dom0, it is possible to mount disks in the > Dom0 that are > currently in use by a DomU? > > Although this is a nice feature - in my case these two DomUs > are forming a > cluster and the common configuration resides on the read-only > disk - it seems > dangerous to me. > > Although with this feature I could seamless change the > configuration of the > cluster :-) : > - mount the partitition in Dom0 > - restart one DomU and let it gain the service with changed > configuration > - restart the second DomU with the new configuration > > Is there a reason why this is possible? Maybe it isn''t > dangerous at all?The reason why is simply because the check for "is this already mounted elsewhere" is done when the guest being created. Since Dom0 can use the regular "mount command", to mount it later on and mount isn''t aware complications such that Xen introduces to the world, it''s allowing you to do it. As to the "danger": If the filesystem is mounted read-only by DomU, it''s not so bad, but if it''s a read/write file-system in DomU, then it''s definitely bad. However, even if it''s read-only, you can''t know for sure what the DomU is going to do with the file-system, and it may well get inconsistant data simply because it reads some new data and uses that in conjunction with some data that is cached (and since DomU knows it''s a read-only file-system, it doesn''t need to check if the data on disk has changed). This sort of inconsitant data usage can cause all sorts of problems, ranging from bad data used by application(s) to system crash or hang. -- Mats> > Reinhard > > _______________________________________________ > 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
Reinhard Brandstädter
2007-Mar-28 07:02 UTC
Re: [Xen-users] modifying file-systems in Dom0 while mounted read-only in DomU
Hi,> > Although this is a nice feature - in my case these two DomUs are forming > > a cluster and the common configuration resides on the read-only disk - it > > seems dangerous to me. > > > > Although with this feature I could seamless change the configuration of > > the cluster :-) : > > - mount the partitition in Dom0 > > - restart one DomU and let it gain the service with changed configuration > > - restart the second DomU with the new configuration > > You should be able to see new data without rebooting by droping cache: > echo 3 > /proc/sys/vm/drop_cachesFor the purposes I''d use this feature that works great. I understand the dangers imposed by this procedure (as Luciano mentioned them earlier). But I''d only use it if the services are shut down on the VMs, flush the cache and force a "reload" of the contents. This saves me from rebooting the VMs> > But I suggest using a cluster filesystem instead (OCFS2, GFS, etc.). Then > the changes will be visible everywhere you mount the filesystem.Well I thought of that, but a cluster filesystem would mean more complexity in the VMs, which I want to avoid. And after all my VMs don''t need to write to that partition in any case, and it would be quite a overhead setting up a CFS if all participants except one only have read-only access.> IIRC, you''ll have to specify the virtual disk to xen with ''...,w!'' to > allow multiple mounting of the same partition in read/write mode.Thats exactly what I want to avoid :-) Reinhard _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users