Creating large empty files in Linux / UNIX
To create large empty files in Linux or UNIX:
# dd if=/dev/zero of=filename bs=1024 count=desired
Example to create a 1GB file:
dd if=/dev/zero of=file_1GB bs=1024 count=1000
/or/
dd if=/dev/zero of=file_1GB bs=4096 count=250
/or/
dd if=/dev/zero of=file_1GB bs=2048 count=500
Example to create a 2GB file:
dd if=/dev/zero of=file_2GB bs=2048 count=1000
/or/
dd if=/dev/zero of=file_2GB bs=1024 count=2000
Example to create a 512MB file:
dd if=/dev/zero of=file_512MB bs=1024 count=500
/or/
dd if=/dev/zero of=file_1GB bs=512 count=1000
either use
# mkfile size myfile
where can be in KB, MB or GB using k, m or g as suffix. To create a 10 GB file, use
# mkfile 10240m myfile
If you run # mkfile -n 10240m myfile the file will be created, but the disk blocks will not get allocated, only when writing data into the file.
Posted by Satish LN at 8:46 PM
Recent Comments