Cinder backups: add a note about flushing filesystems

LVM snapshots might contain corrupted data if the guest OS has not flushed dirty
buffers. Add a note to warn the admin about this.

Also use cinder-volumes as VG name, not nova-volumes.

Change-Id: If72dcc174523bfece74ed7f7617fbffe9cf51d60
This commit is contained in:
Gauvain Pocentek 2014-02-20 21:07:14 +01:00
parent cdcb564c19
commit 9e76d0927b
2 changed files with 28 additions and 22 deletions

View File

@ -5,7 +5,7 @@
xml:id="managing-volumes"> xml:id="managing-volumes">
<?dbhtml stop-chunking?> <?dbhtml stop-chunking?>
<title>Block Storage</title> <title>Block Storage</title>
<para>The OpenStack Block Storage service works though the <para>The OpenStack Block Storage service works through the
interaction of a series of daemon processes named <systemitem interaction of a series of daemon processes named <systemitem
class="daemon">cinder-*</systemitem> that reside class="daemon">cinder-*</systemitem> that reside
persistently on the host machine or machines. The binaries can persistently on the host machine or machines. The binaries can
@ -58,7 +58,7 @@
<para>Create a volume through the <command>cinder <para>Create a volume through the <command>cinder
create</command> command. This command creates create</command> command. This command creates
an LV into the volume group (VG) an LV into the volume group (VG)
"cinder-volumes."</para> <literal>cinder-volumes</literal>.</para>
</step> </step>
<step> <step>
<para>Attach the volume to an instance through the <para>Attach the volume to an instance through the
@ -76,9 +76,9 @@
<step> <step>
<para>libvirt uses that local storage as <para>libvirt uses that local storage as
storage for the instance. The instance gets storage for the instance. The instance gets
a new disk, usually a a new disk (usually a
<filename>/dev/vdX</filename> <filename>/dev/vdX</filename>
disk.</para> disk).</para>
</step> </step>
</substeps> </substeps>
</step> </step>

View File

@ -15,6 +15,11 @@
volume creation process. Remember that the volumes created volume creation process. Remember that the volumes created
through a <command>nova volume-create</command> command exist through a <command>nova volume-create</command> command exist
in an LVM logical volume.</para> in an LVM logical volume.</para>
<para>You must also make sure that the operating system is not using the
volume, and that all data has been flushed on the guest filesystems.
This usually means that those filesystems have to be unmounted during
the snapshot creation. They can be mounted again as soon as the logical
volume snapshot has been created.</para>
<para>Before you create the snapshot, you must have enough space <para>Before you create the snapshot, you must have enough space
to save it. As a precaution, you should have at least twice as to save it. As a precaution, you should have at least twice as
much space as the potential snapshot size. If insufficient much space as the potential snapshot size. If insufficient
@ -55,7 +60,7 @@
<step> <step>
<para>Create the snapshot; you can do this while <para>Create the snapshot; you can do this while
the volume is attached to an instance:</para> the volume is attached to an instance:</para>
<screen><prompt>$</prompt> <userinput>lvcreate --size 10G --snapshot --name volume-00000001-snapshot /dev/nova-volumes/volume-00000001</userinput></screen> <screen><prompt>$</prompt> <userinput>lvcreate --size 10G --snapshot --name volume-00000001-snapshot /dev/cinder-volumes/volume-00000001</userinput></screen>
<para>Use the <option>--snapshot</option> <para>Use the <option>--snapshot</option>
configuration option to tell LVM that you want configuration option to tell LVM that you want
a snapshot of an already existing volume. The a snapshot of an already existing volume. The
@ -63,7 +68,7 @@
reserved for the snapshot volume, the name of reserved for the snapshot volume, the name of
the snapshot, and the path of an already the snapshot, and the path of an already
existing volume. Generally, this path is existing volume. Generally, this path is
<filename>/dev/nova-volumes/<replaceable>$volume_name</replaceable></filename>.</para> <filename>/dev/cinder-volumes/<replaceable>$volume_name</replaceable></filename>.</para>
<para>The size does not have to be the same as the <para>The size does not have to be the same as the
volume of the snapshot. The volume of the snapshot. The
<parameter>size</parameter> parameter <parameter>size</parameter> parameter
@ -78,12 +83,12 @@
<para>Run the <command>lvdisplay</command> command <para>Run the <command>lvdisplay</command> command
again to verify the snapshot:</para> again to verify the snapshot:</para>
<programlisting>--- Logical volume --- <programlisting>--- Logical volume ---
LV Name /dev/nova-volumes/volume-00000001 LV Name /dev/cinder-volumes/volume-00000001
VG Name nova-volumes VG Name cinder-volumes
LV UUID gI8hta-p21U-IW2q-hRN1-nTzN-UC2G-dKbdKr LV UUID gI8hta-p21U-IW2q-hRN1-nTzN-UC2G-dKbdKr
LV Write Access read/write LV Write Access read/write
LV snapshot status source of LV snapshot status source of
/dev/nova-volumes/volume-00000026-snap [active] /dev/cinder-volumes/volume-00000026-snap [active]
LV Status available LV Status available
# open 1 # open 1
LV Size 15,00 GiB LV Size 15,00 GiB
@ -95,11 +100,11 @@ Read ahead sectors auto
Block device 251:13 Block device 251:13
--- Logical volume --- --- Logical volume ---
LV Name /dev/nova-volumes/volume-00000001-snap LV Name /dev/cinder-volumes/volume-00000001-snap
VG Name nova-volumes VG Name cinder-volumes
LV UUID HlW3Ep-g5I8-KGQb-IRvi-IRYU-lIKe-wE9zYr LV UUID HlW3Ep-g5I8-KGQb-IRvi-IRYU-lIKe-wE9zYr
LV Write Access read/write LV Write Access read/write
LV snapshot status active destination for /dev/nova-volumes/volume-00000026 LV snapshot status active destination for /dev/cinder-volumes/volume-00000026
LV Status available LV Status available
# open 0 # open 0
LV Size 15,00 GiB LV Size 15,00 GiB
@ -131,11 +136,12 @@ Block device 251:14</programlisting>
partitions created inside instances, you partitions created inside instances, you
cannot see its content and create efficient cannot see its content and create efficient
backups.</para> backups.</para>
<screen><prompt>$</prompt> <userinput>kpartx -av /dev/nova-volumes/volume-00000001-snapshot</userinput></screen> <screen><prompt>$</prompt> <userinput>kpartx -av /dev/cinder-volumes/volume-00000001-snapshot</userinput></screen>
<note os="debian"> <note os="debian">
<para>On a Debian-based distribution, you can <para>On a Debian-based distribution, you can
also use the <command>apt-get install use the <command>apt-get install kpartx</command>
kpartx</command> command.</para> command to install
<command>kpartx</command>.</para>
</note> </note>
<para>If the tools successfully find and map the <para>If the tools successfully find and map the
partition table, no errors are partition table, no errors are
@ -146,18 +152,18 @@ Block device 251:14</programlisting>
command:</para> command:</para>
<screen><prompt>$</prompt> <userinput>ls /dev/mapper/nova*</userinput></screen> <screen><prompt>$</prompt> <userinput>ls /dev/mapper/nova*</userinput></screen>
<para>You can see the <para>You can see the
<literal>nova--volumes-volume--00000001--snapshot1</literal> <literal>cinder--volumes-volume--00000001--snapshot1</literal>
partition.</para> partition.</para>
<para>If you created more than one partition on <para>If you created more than one partition on
that volume, you see several partitions; for that volume, you see several partitions; for
example: example:
<literal>nova--volumes-volume--00000001--snapshot2</literal>, <literal>cinder--volumes-volume--00000001--snapshot2</literal>,
<literal>nova--volumes-volume--00000001--snapshot3</literal>, <literal>cinder--volumes-volume--00000001--snapshot3</literal>,
and so on.</para> and so on.</para>
</step> </step>
<step> <step>
<para>Mount your partition:</para> <para>Mount your partition:</para>
<screen><prompt>$</prompt> <userinput>mount /dev/mapper/nova--volumes-volume--volume--00000001--snapshot1 /mnt</userinput></screen> <screen><prompt>$</prompt> <userinput>mount /dev/mapper/cinder--volumes-volume--volume--00000001--snapshot1 /mnt</userinput></screen>
<para>If the partition mounts successfully, no <para>If the partition mounts successfully, no
errors are returned.</para> errors are returned.</para>
<para>You can directly access the data inside the <para>You can directly access the data inside the
@ -176,7 +182,7 @@ Block device 251:14</programlisting>
<title>Use the <command>tar</command> command to create <title>Use the <command>tar</command> command to create
archives</title> archives</title>
<para>Create a backup of the volume:</para> <para>Create a backup of the volume:</para>
<screen><prompt>$</prompt> <userinput>tar --exclude={"lost+found","some/data/to/exclude"} -czf volume-00000001.tar.gz -C /mnt/ /backup/destination</userinput></screen> <screen><prompt>$</prompt> <userinput>tar --exclude="lost+found" --exclude="some/data/to/exclude" -czf volume-00000001.tar.gz -C /mnt/ /backup/destination</userinput></screen>
<para>This command creates a <filename>tar.gz</filename> <para>This command creates a <filename>tar.gz</filename>
file that contains the data, <emphasis role="italic" file that contains the data, <emphasis role="italic"
>and data only</emphasis>. This ensures that you >and data only</emphasis>. This ensures that you
@ -215,11 +221,11 @@ Block device 251:14</programlisting>
</step> </step>
<step> <step>
<para>Delete the partition table:</para> <para>Delete the partition table:</para>
<screen><userinput>kpartx -dv /dev/nova-volumes/volume-00000001-snapshot</userinput></screen> <screen><userinput>kpartx -dv /dev/cinder-volumes/volume-00000001-snapshot</userinput></screen>
</step> </step>
<step> <step>
<para>Remove the snapshot:</para> <para>Remove the snapshot:</para>
<screen><userinput>lvremove -f /dev/nova-volumes/volume-00000001-snapshot</userinput></screen> <screen><userinput>lvremove -f /dev/cinder-volumes/volume-00000001-snapshot</userinput></screen>
</step> </step>
</substeps> </substeps>
<para>Repeat these steps for all your volumes.</para> <para>Repeat these steps for all your volumes.</para>