Linux uses the DD command to quickly generate large files

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.