Here is a quick way to create very large empty files without writing every byte using dd.
# dd if=/dev/zero of=largeemptyfile.img bs=1M count=1 seek=16999
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.001772 seconds, 592 MB/s
# ls -lh
total 1.1M
-rw-r--r-- 1 root root 17G Jul 16 09:07 largeemptyfile.img
# du -h
1.1M .
Notice that the actual file is only 1.1 MB, but the file shows as 17GB. This is because dd basically wrote the first and last parts of the file, and left the middle alone. You can now use this file for anything, such as a Xen disk image. Once it is in use, it will report as the full 17GB with du.
No comments:
Post a Comment