Device-Mapper
dmsetup:持久元數據儲存在哪裡?
<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.
這些持久數據儲存在哪裡?
dmsetup
持久快照設備與瞬態快照設備的第一個塊中的數據存在差異:鑑於這些設備:
$ 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
和一個最初歸零的快照設備支持文件:
$ 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
以下是使用非持久
N
標誌時發生的情況:$ 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
請注意,備份文件未更改 - 仍然是
\0
字節。現在,再次嘗試使用
P
標誌以保持持久性:$ 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
在這種情況下,設備的第一個字節是
SnAp\001
.我的猜測是持久數據儲存在快照設備本身的第一個或多個塊中。