Sample Header Ad - 728x90

How to reinstate an invalidated DM snapshot?

0 votes
1 answer
120 views
I'm using device mapper snapshots. Let's assume that /dev/sda is the read-only origin device, and /dev/sdb is the COW device. I created a persistent snapshot this way:
# cat /dev/zero > /dev/sdb
# dmsetup create mysnap
0 1000000000 snapshot /dev/sda /dev/sdb P 16
^D
# ls /dev/mapper/
control    mysnap
#
It worked fine for a while. After every boot, to re-attach my persistent snapshot, I was running the same command:
dmsetup create mysnap
0 1000000000 snapshot /dev/sda /dev/sdb P 16
But one day I accidentally disconnected the read-only origin device during operation (the COW device was still there). There was a kernel message like that:
device-mapper: snapshots: Invalidating snapshot: error reading/writing
After that happened, any attempt to attach the snapshot (on any machine) results in error:
device-mapper: snapshots: Snapshot is marked invalid
The mysnap device gets created, but it refuses any reads/writes with "Input/output error". Is it possible to clear the "invalid" status on the DM snapshot and bring it up, or at least to recover the data?
I believe that this "invalid" status is fully artificial because, from my experience, persistent DM snapshots survived total system crashes.
Asked by melonfsck - she her (150 rep)
Jun 30, 2024, 12:16 PM
Last activity: Jun 30, 2024, 02:27 PM