2016-10-13 08:40:48 +02:00
[[chapter_storage]]
2016-01-05 10:02:14 +01:00
ifdef::manvolnum[]
2016-10-12 06:54:29 +02:00
pvesm(1)
========
2016-10-08 17:22:48 +02:00
:pve-toplevel:
2016-01-05 10:02:14 +01:00
NAME
----
pvesm - Proxmox VE Storage Manager
2016-10-06 15:12:49 +02:00
SYNOPSIS
2016-01-05 10:02:14 +01:00
--------
include::pvesm.1-synopsis.adoc[]
DESCRIPTION
-----------
endif::manvolnum[]
ifndef::manvolnum[]
{pve} Storage
=============
2016-10-14 07:18:04 +02:00
:pve-toplevel:
2016-01-05 10:02:14 +01:00
endif::manvolnum[]
2016-10-08 17:22:48 +02:00
ifdef::wiki[]
2016-10-10 08:55:17 +02:00
:title: Storage
2016-10-08 17:22:48 +02:00
endif::wiki[]
2016-01-05 10:02:14 +01:00
The {pve} storage model is very flexible. Virtual machine images
can either be stored on one or several local storages, or on shared
storage like NFS or iSCSI (NAS, SAN). There are no limits, and you may
configure as many storage pools as you like. You can use all
storage technologies available for Debian Linux.
One major benefit of storing VMs on shared storage is the ability to
live-migrate running machines without any downtime, as all nodes in
the cluster have direct access to VM disk images. There is no need to
copy VM image data, so live migration is very fast in that case.
2016-09-27 10:58:50 +02:00
The storage library (package `libpve-storage-perl`) uses a flexible
2016-01-05 10:02:14 +01:00
plugin system to provide a common interface to all storage types. This
can be easily adopted to include further storage types in future.
Storage Types
-------------
There are basically two different classes of storage types:
Block level storage::
Allows to store large 'raw' images. It is usually not possible to store
other files (ISO, backups, ..) on such storage types. Most modern
block level storage implementations support snapshots and clones.
2016-12-01 10:51:44 +01:00
RADOS, Sheepdog and GlusterFS are distributed systems, replicating storage
2016-01-05 10:02:14 +01:00
data to different nodes.
File level storage::
They allow access to a full featured (POSIX) file system. They are
more flexible, and allows you to store any content type. ZFS is
probably the most advanced system, and it has full support for
snapshots and clones.
.Available storage types
[width="100%",cols="<d,1*m,4*d",options="header"]
|===========================================================
|Description |PVE type |Level |Shared|Snapshots|Stable
|ZFS (local) |zfspool |file |no |yes |yes
2017-05-29 15:09:01 +02:00
|Directory |dir |file |no |no^1^ |yes
|NFS |nfs |file |yes |no^1^ |yes
2018-04-05 14:08:24 +02:00
|CIFS |cifs |file |yes |no^1^ |yes
2017-05-29 15:09:01 +02:00
|GlusterFS |glusterfs |file |yes |no^1^ |yes
|LVM |lvm |block |no^2^ |no |yes
2016-04-30 10:01:08 +02:00
|LVM-thin |lvmthin |block |no |yes |yes
2016-01-05 10:02:14 +01:00
|iSCSI/kernel |iscsi |block |yes |no |yes
|iSCSI/libiscsi |iscsidirect |block |yes |no |yes
|Ceph/RBD |rbd |block |yes |yes |yes
2018-06-25 18:51:09 +02:00
|Ceph/CephFS |cephfs |file |yes |yes |yes
2016-01-05 10:02:14 +01:00
|Sheepdog |sheepdog |block |yes |yes |beta
|ZFS over iSCSI |zfs |block |yes |yes |yes
|=========================================================
2017-05-29 15:09:01 +02:00
^1^: On file based storages, snapshots are possible with the 'qcow2' format.
^2^: It is possible to use LVM on top of an iSCSI storage. That way
2016-09-27 10:58:50 +02:00
you get a `shared` LVM storage.
2016-01-05 10:02:14 +01:00
2016-09-27 10:58:51 +02:00
Thin Provisioning
2016-05-18 17:13:40 +02:00
~~~~~~~~~~~~~~~~~
2016-05-18 14:52:24 +02:00
2016-09-27 10:58:50 +02:00
A number of storages, and the Qemu image format `qcow2`, support 'thin
provisioning'. With thin provisioning activated, only the blocks that
2016-05-18 17:13:40 +02:00
the guest system actually use will be written to the storage.
2016-05-18 14:52:24 +02:00
2016-05-18 17:13:40 +02:00
Say for instance you create a VM with a 32GB hard disk, and after
2016-09-27 10:58:51 +02:00
installing the guest system OS, the root file system of the VM contains
2016-05-18 17:13:40 +02:00
3 GB of data. In that case only 3GB are written to the storage, even
if the guest VM sees a 32GB hard drive. In this way thin provisioning
allows you to create disk images which are larger than the currently
available storage blocks. You can create large disk images for your
VMs, and when the need arises, add more disks to your storage without
2016-09-27 10:58:51 +02:00
resizing the VMs' file systems.
2016-05-18 17:13:40 +02:00
2016-09-27 10:58:50 +02:00
All storage types which have the ``Snapshots'' feature also support thin
2016-05-18 17:13:40 +02:00
provisioning.
2016-05-18 14:52:24 +02:00
2016-08-09 08:52:01 +02:00
CAUTION: If a storage runs full, all guests using volumes on that
2017-05-29 15:15:08 +02:00
storage receive IO errors. This can cause file system inconsistencies
2016-08-09 08:52:01 +02:00
and may corrupt your data. So it is advisable to avoid
over-provisioning of your storage resources, or carefully observe
free space to avoid such conditions.
2016-05-18 14:52:24 +02:00
2016-09-27 10:58:51 +02:00
2016-01-05 10:02:14 +01:00
Storage Configuration
---------------------
All {pve} related storage configuration is stored within a single text
2016-09-27 10:58:50 +02:00
file at `/etc/pve/storage.cfg`. As this file is within `/etc/pve/`, it
2016-01-05 10:02:14 +01:00
gets automatically distributed to all cluster nodes. So all nodes
share the same storage configuration.
Sharing storage configuration make perfect sense for shared storage,
2016-09-27 10:58:50 +02:00
because the same ``shared'' storage is accessible from all nodes. But is
2016-01-05 10:02:14 +01:00
also useful for local storage types. In this case such local storage
is available on all nodes, but it is physically different and can have
totally different content.
2016-09-27 10:58:51 +02:00
2016-01-05 10:02:14 +01:00
Storage Pools
~~~~~~~~~~~~~
2016-09-27 10:58:51 +02:00
Each storage pool has a `<type>`, and is uniquely identified by its
`<STORAGE_ID>`. A pool configuration looks like this:
2016-01-05 10:02:14 +01:00
----
<type>: <STORAGE_ID>
<property> <value>
<property> <value>
...
----
The `<type>: <STORAGE_ID>` line starts the pool definition, which is then
2016-03-14 13:46:28 +01:00
followed by a list of properties. Most properties have values, but some of
them come with reasonable default. In that case you can omit the value.
2016-01-05 10:02:14 +01:00
2016-08-09 09:14:04 +02:00
To be more specific, take a look at the default storage configuration
after installation. It contains one special local storage pool named
2016-09-27 10:58:50 +02:00
`local`, which refers to the directory `/var/lib/vz` and is always
2016-08-09 09:14:04 +02:00
available. The {pve} installer creates additional storage entries
depending on the storage type chosen at installation time.
2016-09-27 10:58:50 +02:00
.Default storage configuration (`/etc/pve/storage.cfg`)
2016-04-30 10:01:08 +02:00
----
dir: local
2016-01-05 10:02:14 +01:00
path /var/lib/vz
2016-04-30 10:01:08 +02:00
content iso,vztmpl,backup
2016-08-09 09:14:04 +02:00
# default image store on LVM based installation
2016-04-30 10:01:08 +02:00
lvmthin: local-lvm
thinpool data
vgname pve
content rootdir,images
2016-08-09 09:14:04 +02:00
# default image store on ZFS based installation
zfspool: local-zfs
pool rpool/data
sparse
content images,rootdir
2016-04-30 10:01:08 +02:00
----
2016-01-05 10:02:14 +01:00
2016-09-27 10:58:51 +02:00
2016-01-05 10:02:14 +01:00
Common Storage Properties
~~~~~~~~~~~~~~~~~~~~~~~~~
2016-03-14 13:46:28 +01:00
A few storage properties are common among different storage types.
2016-01-05 10:02:14 +01:00
nodes::
List of cluster node names where this storage is
usable/accessible. One can use this property to restrict storage
access to a limited set of nodes.
content::
A storage can support several content types, for example virtual disk
images, cdrom iso images, container templates or container root
2016-03-14 13:46:28 +01:00
directories. Not all storage types support all content types. One can set
2016-01-05 10:02:14 +01:00
this property to select for what this storage is used for.
images:::
KVM-Qemu VM images.
rootdir:::
2016-03-14 13:46:28 +01:00
Allow to store container data.
2016-01-05 10:02:14 +01:00
vztmpl:::
Container templates.
backup:::
2016-09-27 10:58:50 +02:00
Backup files (`vzdump`).
2016-01-05 10:02:14 +01:00
iso:::
ISO images
shared::
Mark storage as shared.
disable::
You can use this flag to disable the storage completely.
maxfiles::
2016-09-27 10:58:51 +02:00
Maximum number of backup files per VM. Use `0` for unlimited.
2016-01-05 10:02:14 +01:00
format::
Default image format (`raw|qcow2|vmdk`)
WARNING: It is not advisable to use the same storage pool on different
2016-03-14 13:46:28 +01:00
{pve} clusters. Some storage operation need exclusive access to the
2016-01-05 10:02:14 +01:00
storage, so proper locking is required. While this is implemented
2016-03-14 13:46:28 +01:00
within a cluster, it does not work between different clusters.
2016-01-05 10:02:14 +01:00
Volumes
-------
We use a special notation to address storage data. When you allocate
2016-03-14 13:46:28 +01:00
data from a storage pool, it returns such a volume identifier. A volume
2016-01-05 10:02:14 +01:00
is identified by the `<STORAGE_ID>`, followed by a storage type
dependent volume name, separated by colon. A valid `<VOLUME_ID>` looks
like:
local:230/example-image.raw
local:iso/debian-501-amd64-netinst.iso
local:vztmpl/debian-5.0-joomla_1.5.9-1_i386.tar.gz
iscsi-storage:0.0.2.scsi-14f504e46494c4500494b5042546d2d646744372d31616d61
2016-09-27 10:58:51 +02:00
To get the file system path for a `<VOLUME_ID>` use:
2016-01-05 10:02:14 +01:00
pvesm path <VOLUME_ID>
2016-09-27 10:58:51 +02:00
2016-01-05 10:02:14 +01:00
Volume Ownership
~~~~~~~~~~~~~~~~
2016-09-27 10:58:50 +02:00
There exists an ownership relation for `image` type volumes. Each such
2016-01-05 10:02:14 +01:00
volume is owned by a VM or Container. For example volume
`local:230/example-image.raw` is owned by VM 230. Most storage
backends encodes this ownership information into the volume name.
2016-03-14 13:46:28 +01:00
When you remove a VM or Container, the system also removes all
2016-01-05 10:02:14 +01:00
associated volumes which are owned by that VM or Container.
Using the Command Line Interface
--------------------------------
2016-03-14 13:46:28 +01:00
It is recommended to familiarize yourself with the concept behind storage
pools and volume identifiers, but in real life, you are not forced to do any
2016-01-05 10:02:14 +01:00
of those low level operations on the command line. Normally,
allocation and removal of volumes is done by the VM and Container
management tools.
2016-09-27 10:58:50 +02:00
Nevertheless, there is a command line tool called `pvesm` (``{pve}
Storage Manager''), which is able to perform common storage management
2016-01-05 10:02:14 +01:00
tasks.
Examples
~~~~~~~~
Add storage pools
pvesm add <TYPE> <STORAGE_ID> <OPTIONS>
pvesm add dir <STORAGE_ID> --path <PATH>
pvesm add nfs <STORAGE_ID> --path <PATH> --server <SERVER> --export <EXPORT>
pvesm add lvm <STORAGE_ID> --vgname <VGNAME>
pvesm add iscsi <STORAGE_ID> --portal <HOST[:PORT]> --target <TARGET>
Disable storage pools
pvesm set <STORAGE_ID> --disable 1
Enable storage pools
pvesm set <STORAGE_ID> --disable 0
Change/set storage options
pvesm set <STORAGE_ID> <OPTIONS>
pvesm set <STORAGE_ID> --shared 1
pvesm set local --format qcow2
pvesm set <STORAGE_ID> --content iso
Remove storage pools. This does not delete any data, and does not
disconnect or unmount anything. It just removes the storage
configuration.
pvesm remove <STORAGE_ID>
Allocate volumes
pvesm alloc <STORAGE_ID> <VMID> <name> <size> [--format <raw|qcow2>]
Allocate a 4G volume in local storage. The name is auto-generated if
you pass an empty string as `<name>`
pvesm alloc local <VMID> '' 4G
2016-09-27 10:58:51 +02:00
Free volumes
2016-01-05 10:02:14 +01:00
pvesm free <VOLUME_ID>
WARNING: This really destroys all volume data.
List storage status
pvesm status
List storage contents
pvesm list <STORAGE_ID> [--vmid <VMID>]
List volumes allocated by VMID
pvesm list <STORAGE_ID> --vmid <VMID>
List iso images
pvesm list <STORAGE_ID> --iso
List container templates
pvesm list <STORAGE_ID> --vztmpl
2016-09-27 10:58:51 +02:00
Show file system path for a volume
2016-01-05 10:02:14 +01:00
pvesm path <VOLUME_ID>
2016-05-04 07:22:27 +02:00
ifdef::wiki[]
See Also
--------
2016-08-12 10:51:16 +02:00
* link:/wiki/Storage:_Directory[Storage: Directory]
2016-05-04 07:22:27 +02:00
2016-08-12 10:51:16 +02:00
* link:/wiki/Storage:_GlusterFS[Storage: GlusterFS]
2016-05-04 07:22:27 +02:00
2016-08-12 10:51:16 +02:00
* link:/wiki/Storage:_User_Mode_iSCSI[Storage: User Mode iSCSI]
2016-05-04 07:22:27 +02:00
2016-08-12 10:51:16 +02:00
* link:/wiki/Storage:_iSCSI[Storage: iSCSI]
2016-05-04 07:22:27 +02:00
2016-08-12 10:51:16 +02:00
* link:/wiki/Storage:_LVM[Storage: LVM]
2016-05-04 07:22:27 +02:00
2016-08-12 10:51:16 +02:00
* link:/wiki/Storage:_LVM_Thin[Storage: LVM Thin]
2016-05-04 07:22:27 +02:00
2016-08-12 10:51:16 +02:00
* link:/wiki/Storage:_NFS[Storage: NFS]
2016-05-04 07:22:27 +02:00
2018-04-05 14:08:24 +02:00
* link:/wiki/Storage:_CIFS[Storage: CIFS]
2016-08-12 10:51:16 +02:00
* link:/wiki/Storage:_RBD[Storage: RBD]
2016-05-04 07:22:27 +02:00
2018-07-10 11:42:56 +02:00
* link:/wiki/Storage:_RBD[Storage: CephFS]
2016-08-12 10:51:16 +02:00
* link:/wiki/Storage:_ZFS[Storage: ZFS]
2016-05-04 07:22:27 +02:00
2016-10-03 17:49:30 +02:00
* link:/wiki/Storage:_ZFS_over_iSCSI[Storage: ZFS over iSCSI]
2016-05-04 07:22:27 +02:00
endif::wiki[]
2016-05-04 06:51:11 +02:00
ifndef::wiki[]
2016-01-05 10:02:14 +01:00
// backend documentation
include::pve-storage-dir.adoc[]
include::pve-storage-nfs.adoc[]
2018-04-05 14:08:24 +02:00
include::pve-storage-cifs.adoc[]
2016-01-05 10:02:14 +01:00
include::pve-storage-glusterfs.adoc[]
include::pve-storage-zfspool.adoc[]
include::pve-storage-lvm.adoc[]
2016-04-30 10:01:08 +02:00
include::pve-storage-lvmthin.adoc[]
2016-01-05 10:02:14 +01:00
include::pve-storage-iscsi.adoc[]
include::pve-storage-iscsidirect.adoc[]
include::pve-storage-rbd.adoc[]
2018-06-25 18:51:09 +02:00
include::pve-storage-cephfs.adoc[]
2016-01-05 10:02:14 +01:00
2016-05-04 06:51:11 +02:00
2016-01-05 10:02:14 +01:00
ifdef::manvolnum[]
include::pve-copyright.adoc[]
endif::manvolnum[]
2016-05-04 06:51:11 +02:00
endif::wiki[]