So I wanted to do some performance test with encrypted and normal data storage on my embedded device.
That is not what I was expected to see at all!
Can you please explain it to me what just happend. Why dd
comand output was 1843200+0 records in and out but df -h
show file system disk space usage as 13TB?
This is my workflow:
dd if=/dev/urandom of=enc_per_test.img bs=512 count=2097152
dd if=/dev/urandom of=normal_per_test.img bs=512 count=2097152
And receive 2 images 1GB each - as I predicted.
losetup /dev/loop1 enc_per_test.img
losetup /dev/loop2 normal_per_test.img
After that I perform:
dmsetup -v create enc_per_test --table "0 $(blockdev --getsz /dev/loop1) crypt <crypt_setup> 0 /dev/loop1 0 1 sector_size:512"
mkfs.ext4 /dev/mapper/enc_per_test
mkdir /mnt/enc_per_test
mount -t ext4 /dev/mapper/enc_per_test /mnt/enc_per_test/
As I expected df-h
showed mounted enc_per_test:
Filesystem ############## Size ### Used ## Avail ## Use% ### Mounted on #####
/dev/mapper/enc_per_test ## 976M ## 2.6M ## 907M ## 1% #### /mnt/enc_per_test
I clear cache:
echo 3 > /proc/sys/vm/drop_caches
And finally perform dd comand to fill up the enc_per_test:
time dd if=/tmp/random of=/dev/mapper/enc_per_test conv=fsync
1843200+0 records in
1843200+0 records out
943718400 bytes (944 MB, 900 MiB) copied, 152.098 s, 6.2 MB/s
So I was like, ok that's fine. This is what I wanted. Let's see how it's look like in df -h:
Filesystem ############## Size ### Used ## Avail ## Use% ### Mounted on #####
/dev/mapper/enc_per_test ## 13T ## 13T ## 0 ## 100% #### /mnt/enc_per_test
What happend here?
Thank you!