Skip to content

Instantly share code, notes, and snippets.

@tnibert
Created September 12, 2019 02:49
Show Gist options
  • Save tnibert/e993d86ec6f12130d32605866935652f to your computer and use it in GitHub Desktop.
Save tnibert/e993d86ec6f12130d32605866935652f to your computer and use it in GitHub Desktop.
Fill a disk to 5 TB
# this will fill a disk to 5TB with one command, accounting for existing disk usage
# $a will be in kilobytes, so it must be converted in the expr to units of 150MB
# bs is set for efficiency, results on your disk may vary, if you change this, you'll need to change the number at the end in expr (currently 1024 * 150)
# the sed command specifies line 9 of the output pulled from df -k, you will need to change for your df output
dd if=/dev/zero of=/mnt/partition/bigfile bs=150MB count=$(let "a = 5368709120-`df -k | awk '{ print $3 "\t" }' | sed -n '9p'`"; expr $a / 153600)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment