4

The dmsetup snapshot documentation says:

<persistent?> is P (Persistent) or N (Not persistent - will not survive
after reboot).  O (Overflow) can be added as a persistent store option
to allow userspace to advertise its support for seeing "Overflow" in the
snapshot status.  So supported store types are "P", "PO" and "N".

The difference between persistent and transient is with transient
snapshots less metadata must be saved on disk - they can be kept in
memory by the kernel.

Where is this persistent data stored?

1
  • Try looking in /usr/lib/udev/rules.d/ Commented Oct 9, 2017 at 9:20

1 Answer 1

2

There is a difference between the data in the first block of a persistent vs transient dmsetup snapshot device:

Given these devices:

$ losetup
NAME       SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE                         DIO
/dev/loop1         0      0         0  0 /home/var/ravi/tmp/issue/snap-dev   0
/dev/loop0         0      0         0  0 /home/var/ravi/tmp/issue/base-dev   0

And an initially zeroed-out snapshot device backing file:

$ od -xc snap-dev
0000000    0000    0000    0000    0000    0000    0000    0000    0000
         \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
*
3751613000

Here's what happens when using the non-persistent N flag:

$ sudo dmsetup -v create snapdev --table '0 8 snapshot /dev/loop0 /dev/loop1 N 1'
Name:              snapdev
State:             ACTIVE
Read Ahead:        256
Tables present:    LIVE
Open count:        0
Event number:      0
Major, minor:      254, 5
Number of targets: 1

$ od -xc snap-dev
0000000    0000    0000    0000    0000    0000    0000    0000    0000
         \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
*
3751613000

Note that the backing file is unchanged - it's all still \0 bytes.

Now, trying again with the P flag for persistence:

$ sudo dmsetup remove snapdev
$ sudo dmsetup -v create snapdev --table '0 8 snapshot /dev/loop0 /dev/loop1 P 1'
Name:              snapdev
State:             ACTIVE
Read Ahead:        256
Tables present:    LIVE
Open count:        0
Event number:      0
Major, minor:      254, 5
Number of targets: 1

$ od -xc snap-dev
0000000    6e53    7041    0001    0000    0001    0000    0001    0000
          S   n   A   p 001  \0  \0  \0 001  \0  \0  \0 001  \0  \0  \0
0000020    0000    0000    0000    0000    0000    0000    0000    0000
         \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
*
3751613000

In this case, the first bytes of the device are SnAp\001.


My guess is that persistent data is stored in the first block or blocks of the snapshot device itself.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .