Simulating Corruption

Robby Nelson <[email protected]>
Newsgroups gmane.linux.kernel.device-mapper.dm-crypt
Message-ID <CALyFwfontutJzC5AY6g1c01NWg=Ynjb6pv6NogieG_uAosxVWw@mail.gmail.com>
All,
First I simulated corruption and repair using a raid of two .img files in a
similar manner as here:
https://gist.github.com/MawKKe/caa2bbf7edcc072129d73b61ae7815fb

I am having issues doing the same on my actual disks and am curious if I
have configured something incorrectly. The disks are 4TB each and so I
started out by testing using 50GB partitions, otherwise cryptsetup takes
about 16 hours and then another 16 hours to assemble the raid. These are
the steps I took:

   - Create a 50G partition on each disk, /dev/sdb1 and /dev/sdd1
   - Encrypt each partition, cryptsetup -v --type luks2 --key-size 512
   --sector-size 4096 --integrity hmac-sha256 luksFormat /dev/sdXX
   /path/to/keyfile
   - Open devices, cryptsetup open --type luks cryptraidY /dev/sdXX
   --key-file /path/to/keyfile
   - Create raid, mdadm --create --verbose --level=10 --metadata=1.2
   --chunk=512 --raid-devices=2 --layout=f2 /dev/md/cryptraid
   /dev/mapper/cryptraid0 /dev/mapper/cryptraid1
   - Create filesystem, mkfs.xfs /dev/md/cryptraid
   - Scrub array, echo check > /sys/block/mdX/md/sync_action
   - dmesg shows, md: data-check of RAID array mdX / md: mdX data-check done
   - If I then try to corrupt a disk using dd, dd if=/dev/random
   of=/dev/sdd1 seek=1000 bs=1M count=1, then scrub, no errors are shown.


The only way I have been able to get the scrub to reveal errors if by doing
one of the following:

   - creating a file on the fs when mounted (seems like this should not),
   dd if=/dev/random of=~/Test/testfile bs=1M count=1
   - stop the raid, use dd on a partition as above (dd if=/dev/random
   of=/dev/sdd1 seek=1000 bs=1M count=1), assemble the raid, then scrub

Is this the expected behavior? Perhaps I am incorrectly using dd to
simulate corruption?

Thank you for any guidance.

Robby

_______________________________________________
dm-crypt mailing list
[email protected]
https://www.saout.de/mailman/listinfo/dm-crypt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.