Linux: Create 10 GB file instantly using dd
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 -h
The output will look like this:
Filesystem Size Used Avail Use% Mounted on
/dev/hda2 453G 364G 67G 85% /
tmpfs 7.8G 292M 7.6G 4% /dev/shm
This means that you have some 67 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, ext4 & reiserfs – but will NOT work on FAT32 partitions as they have maximum file size of 4 GiB.
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: A. Eremenko