[libvirt-users] Understanding the use of virt-install from the CLI (Linux)

Pavel Hrdina phrdina at redhat.com
Thu Nov 7 16:52:32 UTC 2019


On Thu, Nov 07, 2019 at 11:02:49AM -0500, jonetsu wrote:
> Hello,
> 
> I've created several VMs using virt-manager and am using them.  This
> time around though, I'd like to use the CLI approach.  The problem
> resides in defining a storage space.  This is using virt-install 1.5.1
> on Xubuntu 18.04.
> 
> For the occasion I created a new directory to store images.  So I
> specify this new directory:
> 
> virt-install \
> --name=arch01 \
> --disk path=/Share2/KVMImages/arch01.qcow2 \
> --disk size=10 \
> [ ... ]
> 
> The above will not work as it reports:
> 
> 'must be a file or a device, not a directory'
> 
> So I specify a file:
> 
> [ ... ]
> --disk path=/Share2/KVMImages/arch01.qcow2 \
> --disk size=10 \
> [ ... ]
> 
> And it reports:
> 
> 'Size must be specified for non existent volume 'arch01.qcow2''
> 
> But the size is already specified as one of the options.
> 
> This is where I'm puzzled about the process.  What is going on ?


Hi,

The issue is that you are using the virt-install --disk option
incorrectly. If you look into man page of virt-install you can see some
examples.  The options for each parameter needs to be separated by
comma.  The command line that you are using is telling virt-install to
use 2 disks, one with the path and second one with only size provided.

If you want to have only a single disk for your VM you need to use it
like this:

virt-install \
    [ ... ] \
    --disk path=/Share2/KVMImages/arch01.qcow2,size=10 \
    [ ... ]

Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20191107/af11ae0c/attachment.sig>


More information about the libvirt-users mailing list