使用 fallocate 快速占用磁盘空间

简单记一下:

$ fallocate -l 180G /tmp/testfile

底下调用的就是 fallocate()/posix_fallocate() 这个系统调用。内核的话,例如 ext4,实现是在 fs/ext4/extents.cext4_fallocate

Some rights reserved
Except where otherwise noted, content on this page is licensed under a Creative Commons Attribution-NonCommercial 4.0 International license.