aliyunpan
aliyunpan copied to clipboard
[Bug] 用了 aria2 官方不推荐的预分配方式导致下载时产生大量磁盘碎片 file fragmentation
aria2 官方文档推荐使用 falloc 预分配,明确说明使用 trunc 预分配会产生磁盘碎片。 而软件默认的 aria2.conf 中: file-allocation=trunc
*测试发现 Windows 下用 falloc 预分配要整个文件写入一次,不知道是不是与 MinGW(文档说 Win 用 falloc 要 MinGW)或者运行权限有关(不开管理员权限时qbittorrent预分配也是要把文件写入一次) *再次研究发现可能确实与 SE_MANAGE_VOLUME_NAME 权限有关 https://www.cnblogs.com/gaizai/p/3516905.html
Please search before asking
- [X] I searched in the issues and found nothing similar.
Please read README
- [X] I have read the troubleshooting section in the README in detail.
使用的版本
3.12.3
系统 System
Windows 11 23H2
复现步骤 Reproduce step
下载大量单个体积为5-100G的视频文件,并行任务数设置为2。
你看到了什么错误?What errors do you see?
大量磁盘碎片
图中qbittorrent专用硬盘无磁盘碎片,小白羊硬盘产生大量磁盘碎片
你期望看到什么?What did you expect to see?
aria2 正常调用系统预分配,不产生磁盘碎片
还有其他的内容吗?Anything else?
aliyunpan 的代码里
file-allocation=trunc
no-file-allocation-limit=64M
经研究 可以改成
# 文件预分配方式, 能有效降低磁盘碎片, 默认:prealloc
# 预分配所需时间: none < falloc ? trunc < prealloc
# falloc和trunc则需要文件系统和内核支持, NTFS建议使用falloc, EXT3/4建议trunc
file-allocation=falloc
以消除产生磁盘碎片的风险(未经测试)
https://aria2.github.io/manual/en/html/aria2c.html#cmdoption-file-allocation
No response
你是否愿意提交一份 PR 来修改这个错误?Are you willing to submit a PR?
- [ ] 我愿意提供 PR! I'm willing to submit a PR!