跑步的时候
fallocate -l 10G /path/to/file
我返回了以下错误:
fallocate: file: fallocate failed: Operation not supported
使用dd(if = / dev / zero或if = / dev / urandom)创建文件是可行的,但是如果我要创建大型文件(大小为数十GB),则需要几个小时才能完成。
运行Ubuntu 14.04。使用ext4分区,指定文件类型似乎不会改变结果。
在我的CentOS6机器上可以正常工作,而在Ubuntu上则不能。
如果稀疏文件适合您(例如,您想创建一个图像以便将其填充到文件系统中),则可以立即创建它们
100GB需要3毫秒的时间:
# time dd if=/dev/zero of=tmptst.dat bs=1G seek=100 count=0
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0,00037726 s, 0,0 kB/s
real 0m0.003s
user 0m0.000s
sys 0m0.002s
结果文件:
# ls -lh tmptst.dat
-rw-r--r-- 1 root root 100G 2015-01-22 16:39 tmptst.dat
目前其实际大小:0字节
# ls -lsh tmptst.dat
0 -rw-r--r-- 1 root root 100G 2015-01-22 16:39 tmptst.dat
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句