[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

dmsetup reload snapshot seems to be ignored



[Note I am not subscribed, please CC me on replies].

When trying to use dmsetup to create volume snapshots, I ran into
a quite odd failure mode as described below.

Corrections to the commands and workarounds are desired.

(I tried posting this to the upstream bugzilla (at Red Hat), but it
rejected the submission with an apparent webserver configuration
error.

dmsetup reload snapshot seems to be ignored

Description of problem:

Attempting to directly use snapshot via dmsetup using the sequence in the
reproduction section fails silently with $?==0 and leaves the foo-dup device
as a linear mapping of the physical partition.


Version-Release number of selected component (if applicable):

Library version:   1.02.155 (2018-12-18)
Driver version:    4.43.0
Kernel version:    5.10.0-0.bpo.9
Debian release:    10.11 (Buster-lts)


How reproducible:

Seems to fail this way every time

Steps to Reproduce:

Note: foo and 123456789ABCDEF0 are placeholders for the real values.

1. # During init:
set -e
udevadm settle

BLKDEV=$(realpath -m /dev/disk/by-id/scsi-123456789ABCDEF0-part1)
BLKDEVSIZ=$(blockdev --getsz ${BLKDEV})

dmsetup create foo-real --table "0 ${BLKDEVSIZ} linear ${BLKDEV} 0"
dmsetup create foo-dup  --table "0 ${BLKDEVSIZ} linear ${BLKDEV} 0"

udevadm trigger -w

2. # Later:
set -e
COWDEV=$(losetup --find --show -L --sector-size 4096 /disk2/foo-snapdelta.raw)
BLKDEVSIZ=$(blockdev --getsz ${BLKDEV})

dmsetup suspend foo-real
dmsetup reload --check foo-real --table \
  "0 ${BLKDEVSIZ} snapshot-origin ${BLKDEV}"
dmsetup reload --check foo-dup  --table \
  "0 ${BLKDEVSIZ} snapshot ${BLKDEV} ${COWDEV} P 8"
dmsetup resume foo-real

# Expected: foo-real is now written through to the original partition with
#    inverse deltas in foo-snapdelta.raw
#           foo-dup reads back the contents as-of the time of dmsetup suspend,
#              using foo-snapdelta.raw to obtain the original contents of
#              changed blocks.

mount -r /dev/mapper/foo-dup /mnt/foo-snap

3. # To check:
dmsetup table


Actual results:

foo-dup: 0 3906247936 linear 8:17 0
foo-real: 0 3906247936 snapshot-origin 8:17


Expected results:

foo-dup: 0 3906247936 snapshot 8:17 7:3 P 8
foo-real: 0 3906247936 snapshot-origin 8:17


Additional info:

Finding out the usage of snapshot with dmsetup was difficult, but adding the
lvm2 infrastructure on top would just complicate the entire system setup.


Enjoy

Jakob

--
Jakob Bohm, CIO, Partner, WiseMo A/S. https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark. Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded


Reply to: