How-To Create 10 GB file instantly with "dd"

Şuraya atla: kullan, ara


Make sure that you have enough free space on the partition

To find out how much is free you can use from command prompt:

df 

The output will look like this:

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hda2             40321836  28054876  12266960  70% /
tmpfs                   257892         0    257892   0% /dev/shm

This means that you have some 12 GB of unused space, so you can proceed with next command that will create 10 GB file:

dd if=/dev/zero of=myharddisk.img bs=1000 count=0 seek=$[1000*1000*10] 

Caveats:

This trick will work on ext3 & reiserfs - but will NOT work on FAT32 partitions as they have maximum file size of 2 GB.

Also because this file is null from within - some programs will fail working with it - such as mkswapfs & mkswapon. For absolute majority of utilities it will work.

-By Alexey Eremenko. 21.apr.2006.