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.

  • 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, 2015 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, 2015 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, 2015 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, 2015 at 0:31
  • this is best continued in chat. please join me in chat.stackexchange.com/rooms/26/unix-and-linux
    – cas
    Oct 9, 2015 at 0:34

1 Answer 1


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
  • 1
    Also note --extra-args required to produce the console for configuring the guest OS in a downstream step.
    – CodeMed
    Oct 9, 2015 at 2:06
  • Why on earth does this work? Been so annoyed, it worked after finding this post.
    – Darius
    Feb 7, 2017 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.