I am running CentOS 7 and was following a chapter in a book dealing with virtualization and creating storage pools. I successfully ran the following command, but I'm not sure what setting - - - - as the sourcepath actually does.

virsh pool-define-as rhpol_virsh dir - - - - /var/lib/libvirt/rhpol_virsh

Description of command: Define the storage pool as type "dir" with the source path "----" and target /var/lib/libvirt/rhpol_virsh directory

I read the man pages and googled this topic, but I didn't find an explanation. Can someone point me in the right direction?

  • I am guessing it means blank source path ?
    – Narayana
    Jul 17, 2015 at 22:18

1 Answer 1


A storage pool of type dir is a directory path. The only meaningful value is the directory path itself so all other parameters are ignored. In your example, /var/lib/libvirt/rhpol_virsh is a location in your filesystem that will be mapped to the storage pool rhpol_virsh.

Another way of viewing this command, which I prefer, is by named parameter rather than positional parameter. This also defines your pool as rhpol_virsh as being part of your filesystem starting at /var/lib/libvirt/rhpol_virsh:

virsh pool-define-as rhpol_virsh --type dir --target /var/lib/libvirt/rhpol_virsh

At the risk of over complicating matters, but trying to answer your comment questions, the man page defines positional parameters as follows:

pool-define-as name --print-xml type [source-host] [source-path] [source-dev] [source-name] [<target>] [--source-format format]

Since the pool definition doesn't need anything except target we need - placeholders to get to the target. Thus pool-define-as rhpol_virsh - - - - /var/lib/libvirt/rhpol_virsh.

Once you have defined the storage pool you need to start it:

virsh pool-autostart rhpol_virsh    # Start on boot
virsh pool-start rhpol_virsh        # Start now

You can see which storage pools are defined, and their status, with virsh pool-list. If you add something to a storage pool you may need to tell the libvirt suite that the pool contents need refreshing:

virsh pool-list | awk '/active/{print$1}' | xargs -n1 virsh pool-refresh
  • I understand that. But this is still confusing '- - - -' . Could it mean that the target is the same as the source ?
    – Narayana
    Jul 17, 2015 at 22:41
  • Iv read ur edits. A storage pool of type 'dir' only needs the relevant directory path. But I would specifically like to understand what '- - - -' means.
    – Narayana
    Jul 17, 2015 at 22:45
  • @Infinite I suppose you could think of it like that. But take another look at my answer, which I've updated for you
    – roaima
    Jul 17, 2015 at 22:46
  • Thank u sooo much. I will mark this as answered :) :) :) :) :)
    – Narayana
    Jul 17, 2015 at 22:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .