integriysetup: Clarification on --data-device usage and appropriate warnings
Issue description
Man page states:
--data-device
Specify a separate data device that contains existing data.
The <device> then will contain calculated integrity tags and journal
for this data device.
I did the following as a test:
$ dd if=/dev/zero of=checksums.img bs=1024 count=500000
500000+0 records in
500000+0 records out
512000000 bytes (512 MB, 488 MiB) copied, 0.68271 s, 750 MB/s
$ dd if=/dev/zero of=existingfs.img bs=1024 count=1000000
1000000+0 records in
1000000+0 records out
1024000000 bytes (1.0 GB, 977 MiB) copied, 1.35348 s, 757 MB/s
$ sudo losetup -f --show checksums.img
/dev/loop0
$ sudo losetup -f --show existingfs.img
/dev/loop1
$ sudo mkfs.ext4 /dev/loop1
$ sudo blkid -p /dev/loop1
/dev/loop1: UUID="cfc7c7ca-3f30-4e3a-9001-006bec789d93" VERSION="1.0" BLOCK_SIZE="4096" TYPE="ext4" USAGE="filesystem"
$ sudo integritysetup format /dev/loop0 --data-device /dev/loop1
WARNING!
========
This will overwrite data on /dev/loop0 irrevocably.
Are you sure? (Type 'yes' in capital letters): YES
Formatted with tag size 4, internal integrity crc32c.
Wiping device to initialize integrity checksum.
You can interrupt this by pressing CTRL+c (rest of not wiped device will contain invalid checksum).
Finished, time 00:00.477, 976 MiB written, speed 2.0 GiB/s
$ sudo blkid -p /dev/loop1
$
Even if I'm using the command incorrectly, I think it would be good to have a warning that both block devices will be overwritten, to prevent data loss.
Is the correct way to utilize an existing block device with data to use --integrity-recalculate?
Please clarify.
Additional info
$ integritysetup --version
integritysetup 2.3.6