如何在 1s 内创建上百 G 的超大文件?
touch
vi(m)
tee
> 或 >>
$ dd if=/dev/zero of=big_file count=10 bs=1G
$ time dd if=/dev/zero of=big_file count=10 bs=1G
10+0 records in
10+0 records out
10737418240 bytes (11 GB) copied, 7.93627 s, 1.4 GB/s
real 0m7.941s
user 0m0.000s
sys 0m7.935s
$ ls -lh big_file
-rw-r--r-- 1 root root 10G Jun 2 10:57 big_file
$ fallocate -l 10G big_file
$ time fallocate -l 10G big_file
real 0m0.002s
user 0m0.000s
sys 0m0.001s
$ ls -lh big_file
-rw-r--r-- 1 root root 10G Jun 2 11:01 big_file
$ du -sh big_file
10G big_file
$ truncate -s 10G big_file
$ time truncate -s 10G big_file
real 0m0.001s
user 0m0.000s
sys 0m0.001s
$ ls -lh big_file
-rw-r--r-- 1 root root 10G Jun 2 11:11 big_file
$ du -sh big_file
0 big_file
更多精彩推荐
你点的每个“在看”,我都认真当成了喜欢
关注公众号:拾黑(shiheibook)了解更多
[广告]赞助链接:
四季很好,只要有你,文娱排行榜:https://www.yaopaiming.com/
让资讯触达的更精准有趣:https://www.0xu.cn/