Skip to content

Instantly share code, notes, and snippets.

@gawen
Created November 15, 2013 18:30
Show Gist options
  • Save gawen/7489280 to your computer and use it in GitHub Desktop.
Save gawen/7489280 to your computer and use it in GitHub Desktop.
<3 sparse file

Get the smaller USB drive you have. Format it in ext4 or smater.

Mount it on /mnt/usb.

Then

$ cd /mnt/usb
$ dd if=/dev/urandom of=sparse-file bs=1k seek=10737418240 count=1
$ ls -lha sparse-file
-rw-rw-r-- 1 gawen gawen 11T Nov 15 19:25 sparse-file
$ df -h /mnt/usb
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1         8G    4K   8G   0% /mnt/usb

11T of file, 4K used.

TADAAA!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment