how do I create an appropriate drive for a libvirt virtual machine?












2















I am trying to use virt-install to create a CentOS 7 virtual machine in a CentOS 7 host. Towards that end, I have been reading the virt-install documentation at the RHEL web site, and I have also been reading man virt-install and virt-install --help. I saw several types of syntax for the --disk argument in the documentation, so I picked one and came up with the syntax below, which is throwing an error. How can I create an appropriate virtual drive that can be used by the virt-install command?



Here is what I have so far:



[root@localhost home]# virt-install --name=public-centos7 --disk path=/home/publicvm --graphics none --vcpus=2 --memory=2048 --cdrom /media/usb/CentOS-7-x86_64-DVD-1503-01.iso --network bridge=br0 --os-type=linux --os-variant=rhel7.0
WARNING CDROM media does not print to the text console by default, so you likely will not see text install output. You might want to use --location.See the man page for examples of using --location with CDROM media

Starting install...
ERROR internal error: process exited while connecting to monitor: 2015-10-08T19:53:08.694875Z qemu-kvm: -drive file=/home/publicvm,if=none,id=drive-virtio-disk0,format=dir: 'dir' invalid format

Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
virsh --connect qemu:///system start public-centos7
otherwise, please restart your installation.
[root@localhost home]#


Note that /home/publicvm is just a directory within the partition mounted at /home. It uses the ext4 file system.



Note: The iso file is on a usb in ntfs format. I downloaded a library to enable CentOS 7 to mount the ntfs usb from the terminal, and I checked to make sure I could read the contents of /media/usb before running the above commands. I do not imagine that this is in any way relevant to the ERROR message about the drive, however, I am adding this due to the WARNING about the cdrom command above.










share|improve this question

























  • Try giving the --disk option a complete filename, not just a directory. IIRC if the file doesn't already exist, you have to specify the size in GB too. e.g. --disk /home/publicvm/myvm.img,size=10. and maybe try --location /media/usb/CentOS-7-x86_64-DVD-1503-01.iso rather than --cdrom ...

    – cas
    Oct 8 '15 at 22:56











  • please show mount | grep /media/usb and ls -l /media/usb/CentOS-7-x86_64-DVD-1503-01.iso

    – cas
    Oct 9 '15 at 0:03











  • BTW, you may find the GUI virt-manager easier than constructing a valid virt-install command-line by hand.

    – cas
    Oct 9 '15 at 0:04











  • perms are good, no reason why root shouldn't be able to open that .iso file. ok, forget about --location, go back to --cdrom.

    – cas
    Oct 9 '15 at 0:31











  • this is best continued in chat. please join me in chat.stackexchange.com/rooms/26/unix-and-linux

    – cas
    Oct 9 '15 at 0:34
















2















I am trying to use virt-install to create a CentOS 7 virtual machine in a CentOS 7 host. Towards that end, I have been reading the virt-install documentation at the RHEL web site, and I have also been reading man virt-install and virt-install --help. I saw several types of syntax for the --disk argument in the documentation, so I picked one and came up with the syntax below, which is throwing an error. How can I create an appropriate virtual drive that can be used by the virt-install command?



Here is what I have so far:



[root@localhost home]# virt-install --name=public-centos7 --disk path=/home/publicvm --graphics none --vcpus=2 --memory=2048 --cdrom /media/usb/CentOS-7-x86_64-DVD-1503-01.iso --network bridge=br0 --os-type=linux --os-variant=rhel7.0
WARNING CDROM media does not print to the text console by default, so you likely will not see text install output. You might want to use --location.See the man page for examples of using --location with CDROM media

Starting install...
ERROR internal error: process exited while connecting to monitor: 2015-10-08T19:53:08.694875Z qemu-kvm: -drive file=/home/publicvm,if=none,id=drive-virtio-disk0,format=dir: 'dir' invalid format

Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
virsh --connect qemu:///system start public-centos7
otherwise, please restart your installation.
[root@localhost home]#


Note that /home/publicvm is just a directory within the partition mounted at /home. It uses the ext4 file system.



Note: The iso file is on a usb in ntfs format. I downloaded a library to enable CentOS 7 to mount the ntfs usb from the terminal, and I checked to make sure I could read the contents of /media/usb before running the above commands. I do not imagine that this is in any way relevant to the ERROR message about the drive, however, I am adding this due to the WARNING about the cdrom command above.










share|improve this question

























  • Try giving the --disk option a complete filename, not just a directory. IIRC if the file doesn't already exist, you have to specify the size in GB too. e.g. --disk /home/publicvm/myvm.img,size=10. and maybe try --location /media/usb/CentOS-7-x86_64-DVD-1503-01.iso rather than --cdrom ...

    – cas
    Oct 8 '15 at 22:56











  • please show mount | grep /media/usb and ls -l /media/usb/CentOS-7-x86_64-DVD-1503-01.iso

    – cas
    Oct 9 '15 at 0:03











  • BTW, you may find the GUI virt-manager easier than constructing a valid virt-install command-line by hand.

    – cas
    Oct 9 '15 at 0:04











  • perms are good, no reason why root shouldn't be able to open that .iso file. ok, forget about --location, go back to --cdrom.

    – cas
    Oct 9 '15 at 0:31











  • this is best continued in chat. please join me in chat.stackexchange.com/rooms/26/unix-and-linux

    – cas
    Oct 9 '15 at 0:34














2












2








2








I am trying to use virt-install to create a CentOS 7 virtual machine in a CentOS 7 host. Towards that end, I have been reading the virt-install documentation at the RHEL web site, and I have also been reading man virt-install and virt-install --help. I saw several types of syntax for the --disk argument in the documentation, so I picked one and came up with the syntax below, which is throwing an error. How can I create an appropriate virtual drive that can be used by the virt-install command?



Here is what I have so far:



[root@localhost home]# virt-install --name=public-centos7 --disk path=/home/publicvm --graphics none --vcpus=2 --memory=2048 --cdrom /media/usb/CentOS-7-x86_64-DVD-1503-01.iso --network bridge=br0 --os-type=linux --os-variant=rhel7.0
WARNING CDROM media does not print to the text console by default, so you likely will not see text install output. You might want to use --location.See the man page for examples of using --location with CDROM media

Starting install...
ERROR internal error: process exited while connecting to monitor: 2015-10-08T19:53:08.694875Z qemu-kvm: -drive file=/home/publicvm,if=none,id=drive-virtio-disk0,format=dir: 'dir' invalid format

Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
virsh --connect qemu:///system start public-centos7
otherwise, please restart your installation.
[root@localhost home]#


Note that /home/publicvm is just a directory within the partition mounted at /home. It uses the ext4 file system.



Note: The iso file is on a usb in ntfs format. I downloaded a library to enable CentOS 7 to mount the ntfs usb from the terminal, and I checked to make sure I could read the contents of /media/usb before running the above commands. I do not imagine that this is in any way relevant to the ERROR message about the drive, however, I am adding this due to the WARNING about the cdrom command above.










share|improve this question
















I am trying to use virt-install to create a CentOS 7 virtual machine in a CentOS 7 host. Towards that end, I have been reading the virt-install documentation at the RHEL web site, and I have also been reading man virt-install and virt-install --help. I saw several types of syntax for the --disk argument in the documentation, so I picked one and came up with the syntax below, which is throwing an error. How can I create an appropriate virtual drive that can be used by the virt-install command?



Here is what I have so far:



[root@localhost home]# virt-install --name=public-centos7 --disk path=/home/publicvm --graphics none --vcpus=2 --memory=2048 --cdrom /media/usb/CentOS-7-x86_64-DVD-1503-01.iso --network bridge=br0 --os-type=linux --os-variant=rhel7.0
WARNING CDROM media does not print to the text console by default, so you likely will not see text install output. You might want to use --location.See the man page for examples of using --location with CDROM media

Starting install...
ERROR internal error: process exited while connecting to monitor: 2015-10-08T19:53:08.694875Z qemu-kvm: -drive file=/home/publicvm,if=none,id=drive-virtio-disk0,format=dir: 'dir' invalid format

Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
virsh --connect qemu:///system start public-centos7
otherwise, please restart your installation.
[root@localhost home]#


Note that /home/publicvm is just a directory within the partition mounted at /home. It uses the ext4 file system.



Note: The iso file is on a usb in ntfs format. I downloaded a library to enable CentOS 7 to mount the ntfs usb from the terminal, and I checked to make sure I could read the contents of /media/usb before running the above commands. I do not imagine that this is in any way relevant to the ERROR message about the drive, however, I am adding this due to the WARNING about the cdrom command above.







centos rhel virtual-machine libvirtd






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 9 '15 at 2:08







CodeMed

















asked Oct 8 '15 at 20:06









CodeMedCodeMed

1,8482472104




1,8482472104













  • Try giving the --disk option a complete filename, not just a directory. IIRC if the file doesn't already exist, you have to specify the size in GB too. e.g. --disk /home/publicvm/myvm.img,size=10. and maybe try --location /media/usb/CentOS-7-x86_64-DVD-1503-01.iso rather than --cdrom ...

    – cas
    Oct 8 '15 at 22:56











  • please show mount | grep /media/usb and ls -l /media/usb/CentOS-7-x86_64-DVD-1503-01.iso

    – cas
    Oct 9 '15 at 0:03











  • BTW, you may find the GUI virt-manager easier than constructing a valid virt-install command-line by hand.

    – cas
    Oct 9 '15 at 0:04











  • perms are good, no reason why root shouldn't be able to open that .iso file. ok, forget about --location, go back to --cdrom.

    – cas
    Oct 9 '15 at 0:31











  • this is best continued in chat. please join me in chat.stackexchange.com/rooms/26/unix-and-linux

    – cas
    Oct 9 '15 at 0:34



















  • Try giving the --disk option a complete filename, not just a directory. IIRC if the file doesn't already exist, you have to specify the size in GB too. e.g. --disk /home/publicvm/myvm.img,size=10. and maybe try --location /media/usb/CentOS-7-x86_64-DVD-1503-01.iso rather than --cdrom ...

    – cas
    Oct 8 '15 at 22:56











  • please show mount | grep /media/usb and ls -l /media/usb/CentOS-7-x86_64-DVD-1503-01.iso

    – cas
    Oct 9 '15 at 0:03











  • BTW, you may find the GUI virt-manager easier than constructing a valid virt-install command-line by hand.

    – cas
    Oct 9 '15 at 0:04











  • perms are good, no reason why root shouldn't be able to open that .iso file. ok, forget about --location, go back to --cdrom.

    – cas
    Oct 9 '15 at 0:31











  • this is best continued in chat. please join me in chat.stackexchange.com/rooms/26/unix-and-linux

    – cas
    Oct 9 '15 at 0:34

















Try giving the --disk option a complete filename, not just a directory. IIRC if the file doesn't already exist, you have to specify the size in GB too. e.g. --disk /home/publicvm/myvm.img,size=10. and maybe try --location /media/usb/CentOS-7-x86_64-DVD-1503-01.iso rather than --cdrom ...

– cas
Oct 8 '15 at 22:56





Try giving the --disk option a complete filename, not just a directory. IIRC if the file doesn't already exist, you have to specify the size in GB too. e.g. --disk /home/publicvm/myvm.img,size=10. and maybe try --location /media/usb/CentOS-7-x86_64-DVD-1503-01.iso rather than --cdrom ...

– cas
Oct 8 '15 at 22:56













please show mount | grep /media/usb and ls -l /media/usb/CentOS-7-x86_64-DVD-1503-01.iso

– cas
Oct 9 '15 at 0:03





please show mount | grep /media/usb and ls -l /media/usb/CentOS-7-x86_64-DVD-1503-01.iso

– cas
Oct 9 '15 at 0:03













BTW, you may find the GUI virt-manager easier than constructing a valid virt-install command-line by hand.

– cas
Oct 9 '15 at 0:04





BTW, you may find the GUI virt-manager easier than constructing a valid virt-install command-line by hand.

– cas
Oct 9 '15 at 0:04













perms are good, no reason why root shouldn't be able to open that .iso file. ok, forget about --location, go back to --cdrom.

– cas
Oct 9 '15 at 0:31





perms are good, no reason why root shouldn't be able to open that .iso file. ok, forget about --location, go back to --cdrom.

– cas
Oct 9 '15 at 0:31













this is best continued in chat. please join me in chat.stackexchange.com/rooms/26/unix-and-linux

– cas
Oct 9 '15 at 0:34





this is best continued in chat. please join me in chat.stackexchange.com/rooms/26/unix-and-linux

– cas
Oct 9 '15 at 0:34










1 Answer
1






active

oldest

votes


















4














As discovered in chat, the solution is:



Copy your .ISO image to /var/lib/libvirt/images and run virt-install like so:



virt-install --name=public-centos7 
--disk path=/home/publicvm/some.img,size=10
--graphics none
--vcpus=2
--memory=2048
--location /var/lib/libvirt/images/CentOS-7-x86_64-DVD-1503-01.iso
--network bridge=br0
--os-type=linux
--os-variant=rhel7.0
--extra-args console=ttyS0


If there is a failed previous attempt still running, you need to delete and undefine it first using virsh:



virsh destroy public-centos7
virsh undefine public-centos7





share|improve this answer





















  • 1





    Also note --extra-args required to produce the console for configuring the guest OS in a downstream step.

    – CodeMed
    Oct 9 '15 at 2:06











  • Why on earth does this work? Been so annoyed, it worked after finding this post.

    – Darius
    Feb 7 '17 at 8:56











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f234855%2fhow-do-i-create-an-appropriate-drive-for-a-libvirt-virtual-machine%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









4














As discovered in chat, the solution is:



Copy your .ISO image to /var/lib/libvirt/images and run virt-install like so:



virt-install --name=public-centos7 
--disk path=/home/publicvm/some.img,size=10
--graphics none
--vcpus=2
--memory=2048
--location /var/lib/libvirt/images/CentOS-7-x86_64-DVD-1503-01.iso
--network bridge=br0
--os-type=linux
--os-variant=rhel7.0
--extra-args console=ttyS0


If there is a failed previous attempt still running, you need to delete and undefine it first using virsh:



virsh destroy public-centos7
virsh undefine public-centos7





share|improve this answer





















  • 1





    Also note --extra-args required to produce the console for configuring the guest OS in a downstream step.

    – CodeMed
    Oct 9 '15 at 2:06











  • Why on earth does this work? Been so annoyed, it worked after finding this post.

    – Darius
    Feb 7 '17 at 8:56
















4














As discovered in chat, the solution is:



Copy your .ISO image to /var/lib/libvirt/images and run virt-install like so:



virt-install --name=public-centos7 
--disk path=/home/publicvm/some.img,size=10
--graphics none
--vcpus=2
--memory=2048
--location /var/lib/libvirt/images/CentOS-7-x86_64-DVD-1503-01.iso
--network bridge=br0
--os-type=linux
--os-variant=rhel7.0
--extra-args console=ttyS0


If there is a failed previous attempt still running, you need to delete and undefine it first using virsh:



virsh destroy public-centos7
virsh undefine public-centos7





share|improve this answer





















  • 1





    Also note --extra-args required to produce the console for configuring the guest OS in a downstream step.

    – CodeMed
    Oct 9 '15 at 2:06











  • Why on earth does this work? Been so annoyed, it worked after finding this post.

    – Darius
    Feb 7 '17 at 8:56














4












4








4







As discovered in chat, the solution is:



Copy your .ISO image to /var/lib/libvirt/images and run virt-install like so:



virt-install --name=public-centos7 
--disk path=/home/publicvm/some.img,size=10
--graphics none
--vcpus=2
--memory=2048
--location /var/lib/libvirt/images/CentOS-7-x86_64-DVD-1503-01.iso
--network bridge=br0
--os-type=linux
--os-variant=rhel7.0
--extra-args console=ttyS0


If there is a failed previous attempt still running, you need to delete and undefine it first using virsh:



virsh destroy public-centos7
virsh undefine public-centos7





share|improve this answer















As discovered in chat, the solution is:



Copy your .ISO image to /var/lib/libvirt/images and run virt-install like so:



virt-install --name=public-centos7 
--disk path=/home/publicvm/some.img,size=10
--graphics none
--vcpus=2
--memory=2048
--location /var/lib/libvirt/images/CentOS-7-x86_64-DVD-1503-01.iso
--network bridge=br0
--os-type=linux
--os-variant=rhel7.0
--extra-args console=ttyS0


If there is a failed previous attempt still running, you need to delete and undefine it first using virsh:



virsh destroy public-centos7
virsh undefine public-centos7






share|improve this answer














share|improve this answer



share|improve this answer








edited 18 mins ago









mlissner

125119




125119










answered Oct 9 '15 at 2:04









cascas

39.4k455103




39.4k455103








  • 1





    Also note --extra-args required to produce the console for configuring the guest OS in a downstream step.

    – CodeMed
    Oct 9 '15 at 2:06











  • Why on earth does this work? Been so annoyed, it worked after finding this post.

    – Darius
    Feb 7 '17 at 8:56














  • 1





    Also note --extra-args required to produce the console for configuring the guest OS in a downstream step.

    – CodeMed
    Oct 9 '15 at 2:06











  • Why on earth does this work? Been so annoyed, it worked after finding this post.

    – Darius
    Feb 7 '17 at 8:56








1




1





Also note --extra-args required to produce the console for configuring the guest OS in a downstream step.

– CodeMed
Oct 9 '15 at 2:06





Also note --extra-args required to produce the console for configuring the guest OS in a downstream step.

– CodeMed
Oct 9 '15 at 2:06













Why on earth does this work? Been so annoyed, it worked after finding this post.

– Darius
Feb 7 '17 at 8:56





Why on earth does this work? Been so annoyed, it worked after finding this post.

– Darius
Feb 7 '17 at 8:56


















draft saved

draft discarded




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f234855%2fhow-do-i-create-an-appropriate-drive-for-a-libvirt-virtual-machine%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

サソリ

広島県道265号伴広島線

Setup Asymptote in Texstudio