---
title: 块存储压缩验证
description: 1. 创建并映射image。
url: "https://www.hikunpeng.com/document/detail/zh/kunpengaccel/storage/dataReduc/kunpengkpszip_20_0017.html"
---

# 块存储压缩验证

1. 创建并映射image。
  1 2 rbd create image1 --size 20G --pool vdbench --image-format 2 --image-feature layering rbd map vdbench/image1

2. 准备100M大小的测试文件。
  1 dd if=/dev/zero of=/home/compress_test bs=1M count=100

  此处也可使用实际数据集文件。

3. 将测试文件写入RBD设备。
  1 dd if=/home/compress_test of=/dev/rbd0 bs=1M count=100 oflag=direct

4. 压缩验证。
  1 ceph df

  STORED列代表写入数据100M，USED代表存入硬盘大小为19M，因此压缩率为100M*3(3副本)/19M=15.78。
