Linux uses the dd command to quickly generate large files, and the linuxdd command to generate

Source: Internet
Author: User

Linux uses the dd command to quickly generate large files, and the linuxdd command to generate

The dd command can easily create a specified size file, as shown in figure

Dd if =/dev/zero of = test bs = 1 M count = 1000

A m test file is generated. The file content is 0 (because it is read from/dev/zero,/dev/zero is 0)

However, the speed of writing files to the hard disk depends on the read/write speed of the hard disk. If you want to generate a large file, the speed is very slow.

In some scenarios, we only want the file system to think that a large file exists here, but it is not actually written to the hard disk.

You can
Dd if =/dev/zero of = test bs = 1 M count = 0 seek = 100000

The size of the created file is 100000 MB in the file system, but it does not actually occupy the block. Therefore, the Creation speed is equivalent to the memory speed.

The role of seek is to skip the specified size part of the output file, which achieves the goal of creating a large file but not actually writing it.

Of course, because it is not actually written to the hard disk, you can create GB of such files on a hard disk with a capacity of only 10 Gb.

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.