什么是填充磁盘最快的方法

2024-09-28 23:16:15 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个大磁盘值几个TBs(5 TBs),我需要把这个磁盘空间填满大约95%,这是一个linux centos框。在

我已经试过了

dd if=/dev/zero of=o_File1.img bs=209715200 count=1000

甚至试过像

^{pr2}$

但5结核似乎是个地狱。在

有没有更快的方法,我可以使用任何脚本python/perl/bash或任何东西,我正在寻找一个快速优化的解决方案

编辑:

好的,所以遵循quickly-create-a-large-file-on-a-linux-system 并没有真正解决任何问题

case 1 : dd

 time dd if=/dev/zero of=filename10 bs=1G count=10
    10+0 records in
    10+0 records out
    10737418240 bytes (11 GB) copied, 34.0468 s, 315 MB/s

    real    0m34.108s
    user    0m0.000s
    sys     0m13.498s

所以估计需要3-4个小时来填充这5 TB

Case 2 : fallocate

 fallocate failed: Operation not supported 
   its a custom file system not the popular ext* 

Case 3 : truncate

   this is the weirdest ones
   it doesn't really fill the disk this seems to be just reserving the space for the file so definitely not suiting my requirements

那么,有没有更好的解决方案,或者我必须接受dd或者创建{}来测试这个问题呢


Tags: ofthedevifbslinuxcountnot