Volumes and snapshots
This document provides basic information about how volumes and snapshots work:
Volumes are the basic service of the StorPool storage system. They appear to storage clients as block devices under the
/dev/storpool/directory and behave as normal disk devices.Snapshots in StorPool are read-only point-in-time images of volumes.
Volumes and snapshots can be managed in the following ways:
Using the command line interface; for details, see Volumes and Snapshots.
Using the REST API.
You can generate a visual representation of the volumes and snapshots; for details, see StorPool tree.
Volumes
Volumes are the basic service of the StorPool storage system. A volume always
has 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).
![digraph G {
rankdir=TD;
compound=true;
ranksep=1;
image=svg;
subgraph cluster_step_0 {
shape="box";
style="filled";
color="black";
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
a1 [shape="box",label="vol1"];
}
}](../_images/graphviz-bac292fc781dd754ea002746ee13eeb4f4a109a3.png)
A single volume
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
delimiters dot (.), colon (:), dash (-) and underscore (_).
Creating a volume
![digraph G {
rankdir=LR;
compound=true;
ranksep=1;
image=svg;
edge [min=2]
subgraph cluster_step_0 {
label="Before";
shape="square";
style="filled";
color="black";
fillcolor="lightgrey:white";
gradientangle=90;
node [color=transparent,fillcolor=transparent];
a1 [shape="box",label="(no volume)"];
}
subgraph cluster_step_1 {
label="After";
shape="square";
style="filled";
color="black";
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
b1 [shape="box",label="volume1"];
}
// It only works because the length of '(empty)' and 'volume1' is the same ..
a1 -> b1 [label="Create" ltail="cluster_step_0" lhead="cluster_step_1" ];
}](../_images/graphviz-c5d59238b62194bc815d89d1420de3dda4e579fd.png)
Creating a volume
All volumes are thin provisioned. Creating a volume is not limited to physical disk or disk pool size. Creating a volume doesn’t pre-allocate physical space in the storage cluster.
Here is an example how you can create a volume using the CLI (see Creating a volume):
# storpool volume testvolume create size 100G template ssd
Deleting a volume
![digraph G {
rankdir=LR;
compound=true;
ranksep=1;
image=svg;
edge [min=2]
subgraph cluster_step_0 {
label="Before";
shape="square";
style="filled";
color="black";
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
a1 [shape="box",label="volume1"];
}
subgraph cluster_step_1 {
label="After";
shape="square";
style="filled";
color="black";
fillcolor="lightgrey:white";
gradientangle=90;
node [color=transparent,fillcolor=transparent];
b1 [shape="box",label="(no volume)"];
}
a1 -> b1 [label="Delete" ltail="cluster_step_0" lhead="cluster_step_1" ];
}](../_images/graphviz-d4cc3e425f6a189cd866473dc0f914eb2d0e8da5.png)
Deleting a volume
Here is an example how you can delete a volume using the CLI (see Deleting volumes):
# storpool volume vol1 delete vol1
Renaming a volume
![digraph G {
rankdir=LR;
compound=true;
ranksep=1;
image=svg;
edge [min=2]
subgraph cluster_step_0 {
label="Before";
shape="square";
style="filled";
color="black";
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
a1 [shape="box",label="volume1"];
}
subgraph cluster_step_1 {
label="After";
shape="square";
style="filled";
color="black";
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
b1 [shape="box",label="volume2"];
}
a1 -> b1 [label="Rename" ltail="cluster_step_0" lhead="cluster_step_1"];
}](../_images/graphviz-b9ffd5484063cb7d03bc2fe98fbab526107cab84.png)
Renaming a volume
Here is an example how you can rename a volume using the CLI (see Renaming volumes):
# storpool volume testvolume update rename newvolume
Resizing a volume
![digraph G {
rankdir=LR;
compound=true;
ranksep=1;
image=svg;
edge [min=2]
subgraph cluster_step_0 {
label="Before";
shape="square";
style="filled";
color="black";
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
a1 [shape="box",label="volume1\n100GB"];
}
subgraph cluster_step_1 {
label="After";
shape="square";
style="filled";
color="black";
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
b1 [shape="box",label="volume1\n101GB"];
}
a1 -> b1 [label="Resize" ltail="cluster_step_0" lhead="cluster_step_1"];
}](../_images/graphviz-42092c2155df61e3e165414ad945307c89807b0b.png)
Resizing a volume
Here is an example how you can resize a volume using the CLI (see Resizing volumes):
# storpool volume testvolume update size +1G
Cloning a volume
You have a volume:
![digraph G {
rankdir=TD;
compound=true;
ranksep=1;
image=svg;
subgraph cluster_step_0 {
shape="box";
style="filled";
color="black";
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
a1 [shape="box",label="vol1"];
}
}](../_images/graphviz-bac292fc781dd754ea002746ee13eeb4f4a109a3.png)
When you clone it the system performs two steps. First, it creates a new transient snapshot of the volume. Then it creates a second volume, which is based on the same snapshot.
![digraph G {
rankdir=TB;
compound=true;
ranksep=1;
image=svg;
edge [min=2]
subgraph cluster_step_0 {
shape="box";
style="filled";
color="black";
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
snap1 [shape="ellipse",label="vol1@5"];
vol1 [shape="box",label="vol1"];
vol2 [shape="box",label="vol2"];
snap1 -> {vol1 vol2}
}
}](../_images/graphviz-43ea470d3b92d020d4db3a0b87baf329fc8b6857.png)
Cloned volumes with transient snapshot
Here is an example how you can clone a volume using the CLI (see Volume operations):
# storpool volume vol2 create size 2G template ssd baseOn vol1
Snapshots
Snapshots are read-only point-in-time images of volumes. They are created once
and their data cannot be modified. They can be attached to hosts as read-only
block devices under /dev/storpool.
![digraph G {
rankdir=TD;
compound=true;
ranksep=1;
image=svg;
subgraph cluster_0 {
shape="square";
style="filled";
color="black";
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
a1 [shape="ellipse",label="snap1"];
}
}](../_images/graphviz-61a0acc857444b6f042a93fc1a6830ae35867217.png)
A single snapshot
All volumes and snapshots share the same name-space. Names of volumes and snapshots are unique within a StorPool cluster. This means you can’t have a volume and a snapshot with the same name. Here is a simple example with unique names:
Volume names:
vol1,vol2,vol3Snapshot names:
snap1,snap2,snap3
This diagram illustrates the relationship between a snapshot and a volume:
![digraph G {
rankdir=TB;
image=svg;
compound=true;
subgraph cluster_0 {
shape="square";
style=filled;
color=black;
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
snap1 [shape="ellipse",label="snap1"];
vol1 [shape="box",label="vol1"];
snap1 -> vol1;
}
}](../_images/graphviz-44d25a349cb215b2f1d15021eb994fe988eb225d.png)
Volume-snapshot relation
When you create a snapshot
snap1of volumevol1, this volume becomes based on the snapshot.vol1contains only the changes sincesnap1was 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
vol1are recorded within the volume.When there is a request for reading from
vol1the system reads data from the volume or from the parent snapshotsnap1, depending on whether the data has been changed since the snapshot was created.
Snapshots and volumes are completely independent. Each snapshot may have many children (volumes and snapshots). Volumes cannot have children. This is illustrated in the diagram below:
![digraph G {
rankdir=TB;
image=svg;
compound=true;
subgraph cluster_0 {
shape="box";
style=filled;
color=black;
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
snap1 [shape="ellipse",label="snap1"];
snap2 [shape="ellipse",label="snap2"];
vol1 [shape="box",label="vol1"];
vol2 [shape="box",label="vol2"];
snap1 -> snap2;
snap2 -> vol1;
snap2 -> vol2;
}
}](../_images/graphviz-32bdb6cecc8a120af05bbe6a6ba7b1c3d2a9c81d.png)
Volume-snapshot chain
snap1contains a full image.snap2contains only the changes sincesnap1was taken.vol1andvol2contain only the changes sincesnap2was taken.
Creating a snapshot of a volume
Assume there is a volume named vol1.
![digraph G {
rankdir=TD;
compound=true;
ranksep=1;
image=svg;
subgraph cluster_step_0 {
shape="box";
style="filled";
color="black";
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
a1 [shape="box",label="vol1"];
}
}](../_images/graphviz-bac292fc781dd754ea002746ee13eeb4f4a109a3.png)
A single volume
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.
![digraph G {
rankdir=TD;
compound=true;
ranksep=0.5;
image=svg;
subgraph cluster_step_1 {
shape="box";
style="filled";
color="black";
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
b1 [shape="ellipse",label="snap1"];
b2 [shape="box",label="vol1"];
b1 -> b2;
}
}](../_images/graphviz-73d51126dec96fb73d6bd0edf2036dfd39928355.png)
After the first snapshot
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.
![digraph G {
rankdir=TD;
compound=true;
ranksep=0.5;
image=svg;
subgraph cluster_step_2 {
shape="box";
style="filled";
color="black";
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
c1 [shape="ellipse",label="snap1"];
c2 [shape="ellipse",label="snap2"];
c3 [shape="box",label="vol1"];
c1 -> c2;
c2 -> c3;
}
}](../_images/graphviz-2e7cc05e505adfc6c1189e9cf7435feb6577ed81.png)
After the second snapshot
Here is an example how you can create a snapshot using the CLI (see Creating snapshots):
# storpool volume vol1 snapshot snap1
Creating a volume based on an existing snapshot (cloning)
Before the creation of volume there is a snapshot named snap1.
![digraph G {
rankdir=TD;
compound=true;
ranksep=1;
image=svg;
subgraph cluster_0 {
shape="square";
style="filled";
color="black";
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
a1 [shape="ellipse",label="snap1"];
}
}](../_images/graphviz-61a0acc857444b6f042a93fc1a6830ae35867217.png)
A single snapshot
A new vol1 volume is created, which is based on the snap1 snapshot. 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).
![digraph G {
rankdir=TD;
compound=true;
ranksep=0.5;
image=svg;
subgraph cluster_0 {
shape="box";
style="filled";
color="black";
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
snap1 [shape="ellipse",label="snap1"];
vol1 [shape="box",label="vol1"];
snap1 -> vol1;
}
}](../_images/graphviz-b14ff84240740675e3e539c260d99c500e8c515e.png)
Volume created from a snapshot
Here is an example how you can create a volume based on an existing snapshot using the CLI (see Volume operations):
# storpool volume vol1 parent snap1
Deleting a snapshot
The vol1 and vol2 volumes are based on the snap1 snapshot. 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.
![digraph G {
rankdir=TB;
image=svg;
compound=true;
subgraph cluster_0 {
shape="box";
style=filled;
color=black;
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
snap0 [shape="ellipse",label="snap0"];
snap1 [shape="ellipse",label="snap1"];
vol1 [shape="box",label="vol1"];
vol2 [shape="box",label="vol2"];
snap0 -> snap1;
snap1 -> vol1;
snap1 -> vol2;
}
}](../_images/graphviz-773833a27ee458d7330fe0bcf34560876b13038a.png)
Before deletion
After the deletion of the snap1 snapshot, vol1 and vol2 are based on snap1’s original
parent (if any). In the example here 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.
![digraph G {
rankdir=TB;
image=svg;
compound=true;
subgraph cluster_0 {
shape="box";
style=filled;
color=black;
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
snap0 [shape="ellipse",label="snap0"];
vol1 [shape="box",label="vol1"];
vol2 [shape="box",label="vol2"];
snap0 -> vol1;
snap0 -> vol2;
}
}](../_images/graphviz-23eb24f5eaffbdc3458480badbb9b7b90b098036.png)
After deletion
Here is an example how you can delete a snapshot using the CLI (see Deleting snapshots):
# storpool snapshot snap1 delete snap1
Rebase to null (promotion)
The vol1 volume is based on the snap1 snapshot. 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.
![digraph G {
rankdir=TB;
image=svg;
ranksep=0.5;
compound=true;
subgraph cluster_0 {
shape="box";
style=filled;
color=black;
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
snap0 [shape="ellipse",label="snap0"];
snap1 [shape="ellipse",label="snap1"];
vol1 [shape="box",label="vol1"];
snap0 -> snap1;
snap1 -> vol1;
}
}](../_images/graphviz-282d5987b183a8b671273d32f30e83bccb4a5d21.png)
Before rebase to null
After promotion the vol1 volume is not based on a snapshot. It now contains all
data, not just the changes since snap1 was taken. Any relation between
snap1 and snap0 is unaffected.
![digraph G {
rankdir=TB;
image=svg;
ranksep=0.5;
compound=true;
subgraph cluster_0 {
shape="box";
style=filled;
color=black;
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
snap0 [shape="ellipse",label="snap0"];
snap1 [shape="ellipse",label="snap1"];
vol1 [shape="box",label="vol1"];
snap0 -> snap1;
}
}](../_images/graphviz-5ad069cafa8eab6ff766d37e81c16087ca3db18e.png)
After rebase to null
Here is an example how you can promote a snapshot using the CLI (see Promoting snapshots):
# storpool snapshot testsnap rebase # [parent-snapshot-name]
Rebase
The vol1 volume is based on the snap1 snapshot. 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.
![digraph G {
rankdir=TB;
image=svg;
ranksep=0.5;
compound=true;
subgraph cluster_0 {
shape="box";
style=filled;
color=black;
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
snap0 [shape="ellipse",label="snap0"];
snap1 [shape="ellipse",label="snap1"];
vol1 [shape="box",label="vol1"];
snap0 -> snap1;
snap1 -> vol1;
}
}](../_images/graphviz-282d5987b183a8b671273d32f30e83bccb4a5d21.png)
Before rebase
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.
![digraph G {
rankdir=TB;
image=svg;
ranksep=0.5;
compound=true;
subgraph cluster_0 {
shape="box";
style=filled;
color=black;
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
snap0 [shape="ellipse",label="snap0"];
snap1 [shape="ellipse",label="snap1"];
vol1 [shape="box",label="vol1"];
snap0 -> snap1;
snap0 -> vol1;
}
}](../_images/graphviz-80aa4f66a06847dc3f347f54db5f5308ec61bfde.png)
After rebase
For details on how you can do this on the command line, see Promoting snapshots.
Example use of snapshots
This is a semi-realistic example of how volumes and snapshots may be used:
![digraph G {
rankdir=TB;
image=svg;
ranksep=0.5;
compound=true;
layout=fdp;
subgraph cluster_base_snapshot {
shape="box";
style=filled;
color=black;
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
snapbase [shape="circle",label="base.\ndebian13"];
subgraph cluster_customer_1 {
label="Customer A:\n- Volume 1\n- Volume 2\n- Volume 3\n- Volume 4";
}
subgraph cluster_customer_2 {
label="Customer B:\n- Volume 1\n- Volume 2\n- Volume 3\n- Volume 4";
}
subgraph cluster_customer_3 {
label="Customer C:\n- Volume 1\n- Volume 2\n- Volume 3\n- Volume 4";
}
}
snapbase -> {cluster_customer_1 cluster_customer_2 cluster_customer_3}
}](../_images/graphviz-0107c38f9d458e82a0f2e3fe7695fa741d417ef9.png)
Using snapshots: example 1
There is a snapshot called
base.debian13. This snapshot contains a base VM image (in this example, Debian 13), which was prepared carefully by the service provider.There are 3 customers with 4 virtual machines each.
All virtual machine images are based on the same ‘master’ image, but may contain custom data, which is unique to each VM. Changes in one volume don’t affect the parent snapshots or the other volumes that are created from it.
This example shows another typical use of snapshots - for restore points back in time for a volume.
![digraph G {
rankdir=TB;
image=svg;
ranksep=0.5;
compound=true;
subgraph cluster_restore_points {
shape="box";
style=filled;
color=black;
fillcolor="lightgrey:white";
gradientangle=90;
node [style=filled,color=black,fillcolor=white];
base [shape="ellipse",label="base.debian13"];
snap1 [shape="ellipse",label="custA.v1.last_week"];
snap2 [shape="ellipse",label="custA.v1.20240221"];
snap3 [shape="ellipse",label="custA.v1.20240222"];
vol1 [shape="box",label="custA.v1"];
base -> snap1 -> snap2 -> snap3 -> vol1;
}
}](../_images/graphviz-0bf82e36b146ae64402487d4799084eec601aede.png)
Using snapshots: example 2
There is one base image for Debian 13, three snapshot
restore points, and one live volume custA.v.1