KVM Virtualization Partition-Based Storage Pool Configuration: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
No edit summary
 
(13 intermediate revisions by the same user not shown)
Line 5: Line 5:
=Internal=
=Internal=


* [[Linux_Virtualization_Configuration#Storage_Pool_Configuration|Linux Virtualization Configuration]]
* [[Linux_Virtualization_Operations#Storage_Pool_Configuration|Linux Virtualization Operations]]


=Overview=
=Overview=
This article explains how to expose a pre-formatted block device partition as storage pool, using [[virsh]].
{{Warn|Do not use this procedure to configure an entire disk as storage pool. Follow this procedure for that [[KVM_Virtualization_Disk-Based_Storage_Pool_Configuration|Disk-based Storage Pool Configuration]].}}
=Procedure=
Create a new partition to be exposed as the local storage pool. Use [[fdisk]]. For this example, the partition will be referred to as /dev/sda7.
Create a file system on the newly allocated partition, as described in [[mkfs.xfs]] or [[mkfs.ext4]]:
<pre>
mkfs.xfs /dev/sda7
</pre>
Create a new storage pool definition:
<pre>
virsh pool-define-as main-storage-pool fs --source-dev /dev/sda7 --target /main-storage-pool
</pre>
More details on the pool-define-as command in [[Virsh pool-define-as|virsh pool-define-as]].
Verify the new pool:
<pre>
virsh pool-list --all
Name                State      Autostart
-------------------------------------------
main-storage-pool    inactive  no
</pre>
More details on the pool-list command in [[Virsh pool-list|virsh pool-list]].
Build the pool and create the mount point. More details here [[virsh pool-build]].
<pre>
virsh pool-build main-storage-pool
</pre>
Start the storage pool. This command mounts the filesystem onto the mount point created during the previous step. More details here: [[virsh pool-start]].
<pre>
virsh pool-start main-storage-pool
</pre>
Configure the storage pool to start at boot. More details here: [[virsh pool-autostart]].
<pre>
virsh pool-autostart main-storage-pool
</pre>
Restart the virtualization host and make sure the filesystem is mounted after the restart and the storage pool is active, with [[virsh pool-info|pool-info]]:
<pre>
virsh pool-info main-storage-pool
</pre>

Latest revision as of 21:36, 26 June 2017

External

Internal

Overview

This article explains how to expose a pre-formatted block device partition as storage pool, using virsh.


Do not use this procedure to configure an entire disk as storage pool. Follow this procedure for that Disk-based Storage Pool Configuration.

Procedure

Create a new partition to be exposed as the local storage pool. Use fdisk. For this example, the partition will be referred to as /dev/sda7.

Create a file system on the newly allocated partition, as described in mkfs.xfs or mkfs.ext4:

mkfs.xfs /dev/sda7

Create a new storage pool definition:

virsh pool-define-as main-storage-pool fs --source-dev /dev/sda7 --target /main-storage-pool

More details on the pool-define-as command in virsh pool-define-as.

Verify the new pool:

virsh pool-list --all

 Name                 State      Autostart
-------------------------------------------
 main-storage-pool    inactive   no

More details on the pool-list command in virsh pool-list.

Build the pool and create the mount point. More details here virsh pool-build.

virsh pool-build main-storage-pool

Start the storage pool. This command mounts the filesystem onto the mount point created during the previous step. More details here: virsh pool-start.

virsh pool-start main-storage-pool

Configure the storage pool to start at boot. More details here: virsh pool-autostart.

virsh pool-autostart main-storage-pool

Restart the virtualization host and make sure the filesystem is mounted after the restart and the storage pool is active, with pool-info:

virsh pool-info main-storage-pool