On Wed, Apr 06, 2022 at 12:52:11PM -0400, Mike Snitzer wrote: > On Tue, Apr 05 2022 at 10:09P -0400, Ming Lei <ming.lei@xxxxxxxxxx> wrote: > > Because it is null block... > > Ha, yes.. very good point. I was expecting null_blk capability (read > back written data) that it was never intended to provide. Sorry ;) You can configure a memory backed nullblk instance using the configfs interface that will return written data on reads: # modprobe null_blk nr_devices=0 # mkdir -p /sys/kernel/config/nullb/nullb0 # echo 500 > /sys/kernel/config/nullb/nullb0/size # echo 1 > /sys/kernel/config/nullb/nullb0/memory_backed # echo 1 > /sys/kernel/config/nullb/nullb0/power # lsblk | grep null nullb0 250:0 0 500M 0 disk It's good enough to make and mount an ext4 file system; the contents persist across umount as you'd expect and the image will pass an fsck: # mkfs.ext4 /dev/nullb0 mke2fs 1.46.3 (27-Jul-2021) ... However there's still something in null_blk that causes fio's verify mode some indigestion: # fio --bs=4096 --ioengine=io_uring --fixedbufs --registerfiles --hipri=1 --iodepth=2 --iodepth_batch_submit=2 --iodepth_batch_complete_min=2 --filename=/dev/nullb0 --direct=1 --runtime=20 --numjobs=2 --rw=randread --name=test --group_reporting --norandommap --do_verify=1 --verify=crc32c --verify_async=1 test: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=io_uring, iodepth=2 ... fio-3.26 Starting 2 processes fio: filehash.c:64: __lookup_file_hash: Assertion `f->fd != -1' failed. verify: bad magic header 0, wanted acca at file /dev/nullb0 offset 31621120, length 4096 (requested block: offset=31621120, length=4096) verify: bad magic header 0, wanted acca at file /dev/nullb0 offset 388124672, length 4096 (requested block: offset=388124672, length=4096) fio: pid=2074, err=84/file:verify.c:1444, func=async_verify, error=Invalid or incomplete multibyte or wide character fio: pid=2075, got signal=6 Jobs: 1 (f=0): [f(1),K(1)][-.-%][eta 00m:00s] Jobs: 1 (f=0): [f(1),K(1)][-.-%][eta 00m:00s] Jobs: 1 (f=0): [f(1),K(1)][-.-%][eta 00m:00s] ^Cbs: 1 (f=0): [f(1),K(1)][-.-%][eta 00m:00s] fio: terminating on signal 2 I haven't looked into it any further at this point (I was looking at null_blk to evaluate it for use in stacker, as a backing device for test stacks). Regards, Bryn. -- dm-devel mailing list dm-devel@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/dm-devel