mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
zdb: Report bad label checksum
In case if all label checksums will be invalid on any vdev, the pool will become unimportable. From other side zdb with -l option will not provide any useful information why it happened. Add notifications about corrupted label checksums. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: John Kennedy <john.kennedy@delphix.com> Signed-off-by: Fedor Uporov <fuporov.vstack@gmail.com> Closes #2509 Closes #12685
This commit is contained in:
@@ -652,3 +652,16 @@ function corrupt_blocks_at_level # input_file corrupt_level
|
||||
# This is necessary for pools made of loop devices.
|
||||
sync
|
||||
}
|
||||
|
||||
function corrupt_label_checksum # label_number vdev_path
|
||||
{
|
||||
typeset label_size=$((256*1024))
|
||||
typeset vdev_size=$(stat_size ${2})
|
||||
typeset -a offsets=("$((128*1024 - 32))" \
|
||||
"$(($label_size + (128*1024 - 32)))" \
|
||||
"$(($vdev_size - $label_size - (128*1024 + 32)))" \
|
||||
"$(($vdev_size - (128*1024 + 32)))")
|
||||
|
||||
dd if=/dev/urandom of=${2} seek=${offsets[$1]} bs=1 count=32 \
|
||||
conv=notrunc
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user