AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1143489
Accepted
allo
allo
Asked: 2023-09-12 01:54:54 +0800 CST2023-09-12 01:54:54 +0800 CST 2023-09-12 01:54:54 +0800 CST

“btrfs filesystem defrag -c”(压缩选项)是否强制压缩?

  • 772

启用压缩的 BTRFS 使用启发式方法来不压缩不能很好压缩的文件。使用“btrfs filesystem defrag -c”压缩现有文件是否也使用启发式,或者是否压缩所有文件,即使它们不能很好地压缩?

compression
  • 1 1 个回答
  • 45 Views

1 个回答

  • Voted
  1. Best Answer
    shodanshok
    2023-09-12T04:00:34+08:002023-09-12T04:00:34+08:00

    btrfs filesystem defrag -c似乎强制压缩,只有在初始压缩尝试没有成果并且文件系统未安装compress-force.

    为了证明这一点,我创建了一个文件,其中包含前 1M 不可压缩数据,随后是 128K 可压缩数据(即:文本文件)。该文件使用各种选项存储/tmp并复制到 btrfs 挂载点:

    # compress=lzo: no actual compression
    root@debian12:~# mount /dev/zvol/tank/vol1 /mnt/ -o compress=lzo
    root@debian12:~# cp /tmp/random.img /mnt/
    root@debian12:~# sync
    root@debian12:~# compsize /mnt/random.img
    Processed 1 file, 1 regular extents (1 refs), 0 inline.
    Type       Perc     Disk Usage   Uncompressed Referenced
    TOTAL      100%      1.1M         1.1M         1.1M
    none       100%      1.1M         1.1M         1.1M
    
    # compress=lzo + defrag: compressed, but 'm' (incompressible) flag set
    root@debian12:~# btrfs filesystem defrag -c -r /mnt/
    root@debian12:~# sync
    root@debian12:~# compsize /mnt/random.img
    Processed 1 file, 3 regular extents (3 refs), 0 inline.
    Type       Perc     Disk Usage   Uncompressed Referenced
    TOTAL       90%      1.0M         1.1M         1.1M
    none       100%      1.0M         1.0M         1.0M
    zlib        15%       20K         128K         128K
    root@debian12:~# lsattr /mnt/random.img
    ---------------------m /mnt/random.img
    
    # compress-force=lzo: some limited compression 
    root@debian12:~# mount /dev/zvol/tank/vol1 /mnt/ -o compress-force=lzo
    root@debian12:~# cp /tmp/random.img /mnt/
    root@debian12:~# sync
    root@debian12:~# compsize /mnt/random.img
    Processed 1 file, 3 regular extents (3 refs), 0 inline.
    Type       Perc     Disk Usage   Uncompressed Referenced
    TOTAL       96%      1.0M         1.1M         1.1M
    none       100%      1.0M         1.0M         1.0M
    lzo         68%       88K         128K         128K
    
    # compress-force=lzo + defrag: better compression and no 'm' flag
    root@debian12:~# compsize /mnt/random.img
    Processed 1 file, 3 regular extents (3 refs), 0 inline.
    Type       Perc     Disk Usage   Uncompressed Referenced
    TOTAL       90%      1.0M         1.1M         1.1M
    none       100%      1.0M         1.0M         1.0M
    zlib        15%       20K         128K         128K
    root@debian12:~# lsattr /mnt/random.img
    ---------------------- /mnt/random.img
    
    • 1

相关问题

  • Windows 是否有用于命令行的内置 ZIP 命令?

  • 如何在 apache2 下启用 HTTP 压缩?

  • 使用 tar 时如何设置 bzip2 块大小?

  • 我应该压缩旧文件以节省磁盘空间吗?

  • IIS 6.0 (Windows Server 2003) 上的 HTTP 压缩

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve