Dear readers,
I’d like to use a large file (> 10 GB) as swap space.
The required steps are:
- Create a file
- mkswap $file
- swapon $file
Now, how can I create the file? The obvious and fast solution is to create a file with holes:
dd if=/dev/zero of=foo bs=1M count=1 seek=10239
mkswap
works, but swapon
complains:
# swapon /tmp/foo
swapon: Skipping file /tmp/foo - it appears to have holes.
Of course, I count just dd if=/dev/zero of=foo bs=1M count=10240
, but that takes too long for me.
So, question: is there a way to tell the system: create a file that is 10GB big, don’t but fill it with zeros?