1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-18 10:04:20 +03:00
lvm2/device_mapper
David Teigland 6e12ff95b2 dm-integrity support
dm-integrity stores checksums of the data written to an
LV, and returns an error if data read from the LV does
not match the previously saved checksum.  When used on
raid images, dm-raid will correct the error by reading
the block from another image, and the device user sees
no error.  The integrity metadata (checksums) are stored
on an internal LV allocated by lvm for each linear image.
The internal LV is allocated on the same PV as the image.

Create a linear LV with integrity:

lvcreate --integrity y [options]

Create a raid LV with an integrity layer over each
raid image (for raid levels 1,4,5,6,10):

lvcreate --type raidN --integrity y [options]

Add an integrity layer to an existing linear LV,
or to each image of an existing raid LV:

lvconvert --integrity y LV

Remove the integrity layer from a linear LV, or
from the images of a raid LV:

lvconvert --integrity n LV

Settings

The kernel module has numerous tunable settings
that can be specified using:

  --integritysettings String

where the String includes one or more key/value
pairs, e.g. --integritysettings "mode=J"

The most relevant setting is the mode which controls
how dm-integrity keeps data consisent in case of a crash.
To use a journal, set mode=J, to use a bitmap set mode=B.
(default B).

Initialization

When a new LV with integrity is created, or integrity is
added to an LV, the kernel needs to initialize the integrity
metadata/checksums for all blocks in the LV.  The data
corruption checking performed by dm-integrity will only
operate on areas of the LV that are already initialized.
The progress of integrity initialization is reported by the
"syncpercent" LV reporting field (and under the Cpy%Sync lvs
column.)

$ lvconvert --integrity y vg/lv
$ lvs vg/lv
  LV   VG Attr       LSize Origin     Cpy%Sync
  lv   vg gwi-a----- 1.00g [lv_iorig] 85.16

Examples

create a linear LV with integrity:

$ lvcreate --integrity y -n lvex -L1G vg
$ lvs -a foo
  LV           VG  Attr       LSize  Origin       Cpy%Sync
  lvex         vg gwi-a-----  1.00g [lvex_iorig] 21.48
  [lvex_imeta] vg ewi-ao---- 12.00m
  [lvex_iorig] vg -wi-ao----  1.00g

create a linear LV, then add integrity:

$ lvcreate -n lvex -L1G foo
  Logical volume "lvex" created.
$ lvs -a foo
  LV   VG  Attr       LSize
  lvex foo -wi-a----- 1.00g
$ lvconvert --integrity y foo/lvex
  Creating integrity metadata LV lvex_imeta with size 12.00 MiB.
  Logical volume "lvex_imeta" created.
  Logical volume foo/lvex has added integrity.
$ lvs -a foo
  LV           VG  Attr       LSize  Origin       Cpy%Sync
  lvex         foo gwi-a-----  1.00g [lvex_iorig] 17.19
  [lvex_imeta] foo ewi-ao---- 12.00m
  [lvex_iorig] foo -wi-ao----  1.00g

create a raid1 LV with integrity:

$ lvcreate --type raid1 -m1 --integrity y -n rr -L1G foo
  Creating integrity metadata LV rr_rimage_0_imeta with size 12.00 MiB.
  Logical volume "rr_rimage_0_imeta" created.
  Creating integrity metadata LV rr_rimage_1_imeta with size 12.00 MiB.
  Logical volume "rr_rimage_1_imeta" created.
  Logical volume "rr" created.
$ lvs -a foo
  LV                  VG  Attr       LSize  Origin              Cpy%Sync
  rr                  foo rwi-a-r---  1.00g                     4.93
  [rr_rimage_0]       foo gwi-aor---  1.00g [rr_rimage_0_iorig] 41.02
  [rr_rimage_0_imeta] foo ewi-ao---- 12.00m
  [rr_rimage_0_iorig] foo -wi-ao----  1.00g
  [rr_rimage_1]       foo gwi-aor---  1.00g [rr_rimage_1_iorig] 39.45
  [rr_rimage_1_imeta] foo ewi-ao---- 12.00m
  [rr_rimage_1_iorig] foo -wi-ao----  1.00g
  [rr_rmeta_0]        foo ewi-aor---  4.00m
  [rr_rmeta_1]        foo ewi-aor---  4.00m

create a raid1 LV, then add integrity:

$ lvcreate --type raid1 -m1 -n rr -L1G foo
  Creating integrity metadata LV rr_rimage_0_imeta with size 12.00 MiB.
  Logical volume "rr_rimage_0_imeta" created.
  Creating integrity metadata LV rr_rimage_1_imeta with size 12.00 MiB.
  Logical volume "rr_rimage_1_imeta" created.
  Logical volume "rr" created.
$ lvs -a foo
  LV                  VG  Attr       LSize  Origin              Cpy%Sync
  rr                  foo rwi-aor---  1.00g                     0.00
  [rr_rimage_0]       foo gwi-aor---  1.00g [rr_rimage_0_iorig] 17.58
  [rr_rimage_0_imeta] foo ewi-ao---- 12.00m
  [rr_rimage_0_iorig] foo -wi-ao----  1.00g
  [rr_rimage_1]       foo gwi-aor---  1.00g [rr_rimage_1_iorig] 15.62
  [rr_rimage_1_imeta] foo ewi-ao---- 12.00m
  [rr_rimage_1_iorig] foo -wi-ao----  1.00g
  [rr_rmeta_0]        foo ewi-aor---  4.00m
  [rr_rmeta_1]        foo ewi-aor---  4.00m
$ lvconvert --integrity y foo/rr
  Logical volume foo/rr has added integrity.
$ lvs -a foo
  LV                  VG  Attr       LSize  Origin              Cpy%Sync
  rr                  foo rwi-a-r---  1.00g                     9.18
  [rr_rimage_0]       foo gwi-aor---  1.00g [rr_rimage_0_iorig] 65.62
  [rr_rimage_0_imeta] foo ewi-ao---- 12.00m
  [rr_rimage_0_iorig] foo -wi-ao----  1.00g
  [rr_rimage_1]       foo gwi-aor---  1.00g [rr_rimage_1_iorig] 64.84
  [rr_rimage_1_imeta] foo ewi-ao---- 12.00m
  [rr_rimage_1_iorig] foo -wi-ao----  1.00g
  [rr_rmeta_0]        foo ewi-aor---  4.00m
  [rr_rmeta_1]        foo ewi-aor---  4.00m
2020-03-03 14:08:53 -06:00
..
2019-10-04 17:31:55 +02:00
2019-10-04 17:31:55 +02:00
2019-10-04 17:31:55 +02:00
2020-03-03 14:08:53 -06:00
2019-11-14 18:05:41 +01:00
2020-03-03 14:08:53 -06:00
2018-11-03 16:10:32 +01:00
2018-10-15 17:49:44 +02:00
2020-03-03 14:08:53 -06:00