dd if=/dev/zero of=sparse_file.img bs=1M count=0 seek=1024
If you add conv=sparse to the dd command with a smaller block size it will sparsify what you copy too, use the wrong cp command flags and they will explode.Much harder problem than the file system layers to deal with because the stat size will look smaller usually.
Will dedupe,compression,sparse files you simply don’t track utilization by clients view, which is what du does.
The concrete implementation is what matters and what is, as this case demonstrates, is what you should alert on.
Inodes, blocks, extents etc.. are what matters, not the user view of data size.
Even with rrdtool you could set reasonable alerts, but the heuristics of someone exploding a sparse file with a non-sparse copy makes that harder.
Rsync ssh etc… will do that by default.
dd if=/dev/urandom of=/home/myrandomfile bs=1 count=N openssl enc -aes-256-ctr -pbkdf2 -pass pass:"$(date '+%s')" < /dev/zero | dd of=/home/myrandomfile bs=1M count=1024
Almost all CPUs have AES native instructions so you'll be able to produce pseudorandom junk really fast. Even my old system will produce it at about 3Gb/s. Much faster than urandom can go.Easiest alternative I guess is to pipe through head. It still grumbles, but it does work
openssl enc -aes-256-ctr -pbkdf2 -pass pass:"$(date '+%s')" < /dev/zero | head -c 10M > foo head -c 1G /dev/urandom > /home/myrandomfile
And not have to remember dd's bizarre snowflake command syntax. $ sudo truncate --size 1G /emergency-space
$ sudo shred /emergency-space
I find it widely available, even in tiny distros.Most current desktops (smaller than your usual server) won't have any problem with the GP's command. Yours is still better, of course.
Shit like that just wastes space that SSD could use for wear levelling...