Volumes and snapshots
Volumes are the basic service of the StorPool storage system. A volume always
have a name, a global ID and a certain size. It can be read from and written to.
It could be attached to hosts as read-only or read-write block device under the
/dev/storpool
directory (available as well at /dev/storpool-byid
).
The volume name is a string consisting of one or more of the allowed characters
- upper and lower latin letters (a-z,A-Z
), numbers (0-9
) and the
delimiter dot (.
), colon (:
), dash (-
) and underscore (_
).
Creating a volume
Deleting a volume
Renaming a volume
Resizing a volume
Snapshots
Snapshots are read-only point-in-time images of volumes. They are created once
and cannot be changed. They can be attached to hosts as read-only block devices
under /dev/storpool
.
All volumes and snapshots share the same name-space. Names of volumes and
snapshots are unique within a StorPool cluster. This diagram illustrates the
relationship between a snapshot and a volume. Volume vol1
is based on
snapshot snap1
. vol1
contains only the changes since snap1
was
taken. In the common case this is a small amount of data. Arrows indicate a
child-parent relationship. Each volume or snapshot may have exactly one parent
which it is based upon. Writes to vol1
are recorded within the volume. Reads
from vol1
may be served by vol1
or by its parent snapshot - snap1
,
depending on whether vol1
contains changed data for the read request or not.
Snapshots and volumes are completely independent. Each snapshot may have many children (volumes and snapshots). Volumes cannot have children.
snap1
contains a full image. snap2
contains only the changes since
snap1
was taken. vol1
and vol2
contain only the changes since
snap2
was taken.
Creating a snapshot of a volume
There is a volume named vol1
.
After the first snapshot the state of vol1
is recorded in a new snapshot
named snap1
. vol1
does not occupy any space now, but will record any new
writes which come in after the creation of the snapshot. Reads from vol1
may
fall through to snap1
.
Then the state of vol1
is recorded in a new snapshot named snap2
.
snap2
contains the changes between the moment snap1
was taken and the
moment snap2
was taken. snap2
’s parent is the original parent of
vol1
.
Creating a volume based on an existing snapshot (a.k.a. clone)
Before the creation of vol1
there is a snapshot named snap1
.
A new volume, named vol1
is created. vol1
is based on snap1
. The
newly created volume does not occupy any space initially. Reads from the
vol1
may fall through to snap1
or to snap1
’s parents (if any).
Deleting a snapshot
vol1
and vol2
are based on snap1
. snap1
is based on snap0
.
snap1
contains the changes between the moment snap0
was taken and when
snap1
was taken. vol1
and vol2
contain the changes since the moment
snap1
was taken.
After the deletion, vol1
and vol2
are based on snap1
’s original
parent (if any). In the example they are now based on snap0
. When deleting a
snapshot, the changes contained therein will not be propagated to its children
and StorPool will keep the snap1
in deleting state to prevent from an
explosion of disk space usage.
Rebase to null (a.k.a. promote)
vol1
is based on snap1
. snap1
is in turn based on snap0
.
snap1
contains the changes between the moment snap0
was taken and when
snap1
was taken. vol1
contains the changes since the moment snap1
was taken.
After promotion vol1
is not based on a snapshot. vol1
now contains all
data, not just the changes since snap1
was taken. Any relation between
snap1
and snap0
is unaffected.
Rebase
vol1
is based on snap1
. snap1
is in turn based on snap0
.
snap1
contains the changes between the moment snap0
was taken and when
snap1
was taken. vol1
contains the changes since the moment snap1
was taken.
After the rebase operation vol1
is based on snap0
. vol1
now contains
all changes since snap0
was taken, not just since snap1
. snap1
is
unchanged.
Example use of snapshots
This is a semi-realistic example of how volumes and snapshots may be used. There
is a snapshot called base.centos7
. This snapshot contains a base CentOS 7 VM
image, which was prepared carefully by the service provider. There are 3
customers with 4 virtual machines each. All virtual machine images are based on
CentOS 7, but may contain custom data, which is unique to each VM.
This example shows another typical use of snapshots - for restore points back in
time for this volume. There is one base image for Centos 7, three snapshot
restore points and one live volume cust123.v.1
More information
StorPool provides a tool for generating a visual representation of the volumes and snapshots. For details, see StorPool tree.
You can manage volumes and snapshots using the command line interface. For details, see Volumes and Snapshots.