The DD command can be easily implemented to create a file of the specified size, such as
DD If=/dev/zero of=test bs=1m count=1000
Generates a 1000M test file with a file content of 0 (read from/dev/zero,/dev/zero as 0 source)
However, to actually write to the hard disk, the file production speed depends on the hard disk read and write speed, if you want to produce large files, slow
In some scenario, we just want the file system to think that there is a huge file here, but it's not actually written to the hard disk
Then you can
DD If=/dev/zero of=test bs=1m count=0 seek=100000
The file created at this time has a 100000MB display size in the file system, but does not actually occupy block, so the creation speed is comparable to the memory speed
Seek is the function of skipping over the specified size in the output file, which achieves the purpose of creating large files, but not actually writing
Of course, because you don't actually write to the hard disk, you can create 100G of this type of file on a hard drive with a capacity of only 10G.
Linux uses the DD command to quickly generate large files