thomas veymont
2011-Jul-20 15:22 UTC
[CentOS-virt] how to add file-based disk space to a guest
hi there, I'm following these documentations to add a file-based disk volume to a KVM guest under Centos 6.0 : http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization/chap-Virtualization-Storage_Volumes.html as instructed, I created a "pool" then a "volume", file-based, e.g : mkdir /mnt/raid/kvm_pool1 virsh # pool-define-as pool1 dir - - - - "/mnt/raid/kvm_pool1" virsh # pool-autostart pool1 virsh # vol-create-as pool1 volume1 20G --allocation 15G --format qcow2 now I want to associate "volume1" to my guest OS. Following this doc: http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization/sect-Virtualization-Virtualized_block_devices-Adding_storage_devices_to_guests.html - why does this ask me to create a file with "dd" ? it's already been created before with the virsh pool commands, isn't it? Seems to me I'm bypassing the libvirt/virsh layer if I do that. - after that, the doc tells me to do some stuff with guest XML files. Is'nt there some specific commands provided by virsh to associate a managed Pool to a managed Guest ? - in this case, should I use the virsh "attach-disk" command ? thanks. -- Tom
thomas veymont
2011-Jul-26 09:26 UTC
[CentOS-virt] how to add file-based disk space to a guest
anyone may help on that topic ? thanks 2011/7/20 thomas veymont <thomas.veymont at gmail.com>:> hi there, > > I'm following these documentations to add a file-based disk volume to > a KVM guest under Centos 6.0 : > http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization/chap-Virtualization-Storage_Volumes.html > > as instructed, I created a "pool" then a "volume", file-based, e.g : > > mkdir /mnt/raid/kvm_pool1 > virsh # pool-define-as pool1 dir - - - - "/mnt/raid/kvm_pool1" > virsh # pool-autostart pool1 > virsh # vol-create-as pool1 volume1 20G --allocation 15G --format qcow2 > > now I want to associate "volume1" to my guest OS. Following this doc: > > http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization/sect-Virtualization-Virtualized_block_devices-Adding_storage_devices_to_guests.html > > - why does this ask me to create a file with "dd" ? it's already been > created before with the virsh pool commands, isn't it? Seems to > me I'm bypassing the libvirt/virsh layer if I do that. > > - after that, the doc tells me to do some stuff with guest XML files. > Is'nt there some specific commands provided by > virsh to associate a managed Pool to a managed Guest ? > > - in this case, should I use the virsh "attach-disk" command ? > > thanks. > -- > Tom >
thomas veymont
2011-Aug-03 13:08 UTC
[CentOS-virt] how to add file-based disk space to a guest
thanks for your answer, sure I could use the GUI but I wanted, somehow, to understand how to do it with the shell commands (useful in some situation). Tom> >Trey Dockendorf treydock at gmail.com >Tue Jul 26 19:44:06 EDT 2011 > >I'm not aware of a virsh attach disk command but if you duplicate the >entries for the existing disk you can then add the new one...something like >this... > ># virsh -c qemu:///system edit VMname > > ?<disk type='file' device='disk'> >? ? ?<driver name='qemu' type='qcow2' cache='none'/> >? ? ?<source file='/var/lib/libvirt/images/vmname_var.qcow2'/> >? ? ?<target dev='vda' bus='virtio'/> >? ? ?<address type='pci' domain='0x0000' bus='0x00' slot='0x04' >function='0x0'/> >? ?</disk> > >You will have to adjust the values of course. > >Why not try doing this with virt-manager? ?When I started using KVM (after >moving from ESXi) I had trouble with all the commands and finding everything >I needed, but virt-manager works great. > >- Trey >2011/7/20 thomas veymont <thomas.veymont at gmail.com>:> hi there, > > I'm following these documentations to add a file-based disk volume to > a KVM guest under Centos 6.0 : > http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization/chap-Virtualization-Storage_Volumes.html > > as instructed, I created a "pool" then a "volume", file-based, e.g : > > mkdir /mnt/raid/kvm_pool1 > virsh # pool-define-as pool1 dir - - - - "/mnt/raid/kvm_pool1" > virsh # pool-autostart pool1 > virsh # vol-create-as pool1 volume1 20G --allocation 15G --format qcow2 > > now I want to associate "volume1" to my guest OS. Following this doc: > > http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization/sect-Virtualization-Virtualized_block_devices-Adding_storage_devices_to_guests.html > > - why does this ask me to create a file with "dd" ? it's already been > created before with the virsh pool commands, isn't it? Seems to > me I'm bypassing the libvirt/virsh layer if I do that. > > - after that, the doc tells me to do some stuff with guest XML files. > Is'nt there some specific commands provided by > virsh to associate a managed Pool to a managed Guest ? > > - in this case, should I use the virsh "attach-disk" command ? > > thanks. > -- > Tom >