Re: How to boot a VM using read-only disks

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: How to boot a VM using read-only disks

Eric Tessler
Why not just mount it read only from an init script?
Regards,
Ted
(response)
 
That won't work for me, the disk is outside of the VM - I want to be able to configure the disk through the VM configuration file. What I want is multiple VMs to use the same secondary disk as read-only, with each of them having their own boot disk (I don't want to mount the secondary disks through init scripts in the VM as they do not have access to domain-0).
 
Has anyone here ever tried this or is this some sort of XEN bug???
 
Any help would be greatly appreciated.
 
Thanks,
Eric

Eric Tessler <[hidden email]> wrote:
I want to boot a VM that contains 2 disks: the main boot disk and a secondary disk.  However, I want the secondary disk to be read-only.  In my XEN VM configuration file, if I specify the secondary disk as read-only (using the "r" option) the VM fails to boot.  It looks like during boot the OS is trying to write to the secondary disk.  If I configure the secondary disk to be read-write in the XEN VM config file, the VM boots without any problems (the secondary disk is indeed read-only, however I also want to be able to boot it in that way, I don't want the OS writing to it).  Note that in my VM boot disk image (file backed), the fstab is updated correctly -with both disks specified and the secondary disk as read-only.
 
Here is how my disks are specified in the XEN VM config file for clarifiction:
 
disk=[ 'phy:/dev/loop0,/dev/hda1,w',
          'phy:/dev/loop1,/dev/hda2,r' ]
 
(both file backed disks are bound to loop devices)
 
Has anyone tried this before and got it working???
 
Eric
 


Yahoo! for Good
Click here to donate to the Hurricane Katrina relief effort.


Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
_______________________________________________
Xen-users mailing list
[hidden email]
http://lists.xensource.com/xen-users
Reply | Threaded
Open this post in threaded view
|

Re: Re: How to boot a VM using read-only disks

Steve Dobbelstein
Eric Tessler <[hidden email]> wrote on 10/11/2005 02:56:14 PM:

> Why not just mount it read only from an init script?
> Regards,
> Ted
> (response)
>
> That won't work for me, the disk is outside of the VM - I want to be
> able to configure the disk through the VM configuration file. What I
> want is multiple VMs to use the same secondary disk as read-only,
> with each of them having their own boot disk (I don't want to mount
> the secondary disks through init scripts in the VM as they do not
> have access to domain-0).
>
> Has anyone here ever tried this or is this some sort of XEN bug???
>
> Any help would be greatly appreciated.
>
> Thanks,
> Eric
>
> Eric Tessler <[hidden email]> wrote:
> I want to boot a VM that contains 2 disks: the main boot disk and a
> secondary disk.  However, I want the secondary disk to be read-only.
> In my XEN VM configuration file, if I specify the secondary disk as
> read-only (using the "r" option) the VM fails to boot.  It looks
> like during boot the OS is trying to write to the secondary disk.
> If I configure the secondary disk to be read-write in the XEN VM
> config file, the VM boots without any problems (the secondary disk
> is indeed read-only, however I also want to be able to boot it in
> that way, I don't want the OS writing to it).  Note that in my VM
> boot disk image (file backed), the fstab is updated correctly -with
> both disks specified and the secondary disk as read-only.
>
> Here is how my disks are specified in the XEN VM config file for
clarifiction:
>
> disk=[ 'phy:/dev/loop0,/dev/hda1,w',
>           'phy:/dev/loop1,/dev/hda2,r' ]
>
> (both file backed disks are bound to loop devices)
>
> Has anyone tried this before and got it working???

We do something very similar in our testing and it has been working fine.
We use LVM logical volumes as the backing devices rather than loop devices.
We have a logical volume for / for each VM and one logical volume for /usr
which is used read-only by all the VMs.  The line in the Xen VM config file
looks like:
disk = ['phy:/dev/virt-blkdev-backend/dom1,sda1,w',
'phy:/dev/virt-blkdev-backend/usr,sda2,r']

The /etc/fstab in the VM mounts sda1 on / and sda2 on /usr:
/dev/sda1               /                       ext3    defaults        1 1
/dev/sda2               /usr                    ext3    ro              0 0

What are you mounting hda2 to in the VM?  Is your OS in the VM trying to
write something to that mount?

Steve D.


_______________________________________________
Xen-users mailing list
[hidden email]
http://lists.xensource.com/xen-users
Reply | Threaded
Open this post in threaded view
|

Re: Re: How to boot a VM using read-only disks

Eric Tessler
Thanks - I found my problem - in the fstab I was specifying my read only disks with a pass number of 1 which was causing fsck to fail. Read only disks should have the pass number set to 0.
 
Thanks,
 
Eric

Steve Dobbelstein <[hidden email]> wrote:
Eric Tessler wrote on 10/11/2005 02:56:14 PM:

> Why not just mount it read only from an init script?
> Regards,
> Ted
> (response)
>
> That won't work for me, the disk is outside of the VM - I want to be
> able to configure the disk through the VM configuration file. What I
> want is multiple VMs to use the same secondary disk as read-only,
> with each of them having their own boot disk (I don't want to mount
> the secondary disks through init scripts in the VM as they do not
> have access to domain-0).
>
> Has anyone here ever tried this or is this some sort of XEN bug???
>
> Any help would be greatly appreciated.
>
> Thanks,
> Eric
>
> Eric Tessler wrote:
> I want to boot a VM that contains 2 disks: the main boot disk and a
> secondary disk. However, I want the secondary disk to be read-only.
> In my XEN VM configuration file, if I specify the secondary disk as
> read-only (using the "r" option) the VM fails to boot. It looks
> like during boot the OS is trying to write to the secondary disk.
> If I configure the secondary disk to be read-write in the XEN VM
> config file, the VM boots without any problems (the secondary disk
> is indeed read-only, however I also want to be able to boot it in
> that way, I don't want the OS writing to it). Note that in my VM
> boot disk image (file backed), the fstab is updated correctly -with
> both disks specified and the secondary disk as read-only.
>
> Here is how my disks are specified in the XEN VM config file for
clarifiction:
>
> disk=[ 'phy:/dev/loop0,/dev/hda1,w',
> 'phy:/dev/loop1,/dev/hda2,r' ]
>
> (both file backed disks are bound to loop devices)
>
> Has anyone tried this before and got it working???

We do something very similar in our testing and it has been working fine.
We use LVM logical volumes as the backing devices rather than loop devices.
We have a logical volume for / for each VM and one logical volume for /usr
which is used read-only by all the VMs. The line in the Xen VM config file
looks like:
disk = ['phy:/dev/virt-blkdev-backend/dom1,sda1,w',
'phy:/dev/virt-blkdev-backend/usr,sda2,r']

The /etc/fstab in the VM mounts sda1 on / and sda2 on /usr:
/dev/sda1 / ext3 defaults 1 1
/dev/sda2 /usr ext3 ro 0 0

What are you mounting hda2 to in the VM? Is your OS in the VM trying to
write something to that mount?

Steve D.


Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
_______________________________________________
Xen-users mailing list
[hidden email]
http://lists.xensource.com/xen-users