Verifying the Effect of Block Storage Compression
- Create and map an image.
1 2
rbd create image1 --size 20G --pool vdbench --image-format 2 --image-feature layering rbd map vdbench/image1

- Keep a 100 MB test file ready for the test.
1dd if=/dev/zero of=/home/compress_test bs=1M count=100
You can also use a real dataset file.
- Write the test file to the RBD device.
1dd if=/home/compress_test of=/dev/rbd0 bs=1M count=100 oflag=direct
- Verify the compression effect.
1ceph df
The STORED column indicates that 100 MB data is written into the disk. The USED column indicates that the size of disk storage is 19 MB. Therefore, the compression ratio is 15.78, which is calculated in the formula (100 MB x 3/19 MB). In the formula, the number 3 indicates three copies.
Parent topic: Verifying the Compression algorithm