This runs about 8x faster with its output redirected to disk. I've tried
it as a single line replacement for dd in an otherwise unchanged copy of
the free space wiping script with apparently good results.

The question is what, if anything, does dd do that my code doesn't?
Should my code clear the swap partition or is there something in swap
partition format that means only dd can write to it?

dd is reading from /dev/urandom - that's pretty random, not quite as random
as /dev/random, but that will be slower still.

That would be completely and utterly silly. /dev/random blocks. It would
take you maybe a year, maybe 100 years to wipe your disk if you used
/dev/random.
(Unless dd bails out on block and simply uses zeros to pad the block)

As there are those who say that data can be recovered, even after
several passes with this, if all you're doing is something "quick
and dirty" just use /dev/zero rather than /dev/random.

Relevant Pages

Re: DD vs normal writing question... Then the script executes fsync... The swap space wiper disables swapping,... wipes the partition and then turns swapping back on. ... This runs about 8x faster with its output redirected to disk....(uk.comp.os.linux)

Re: Newbie partitioning question... >10.2gb drive for use as an NFS server....Swap space on Linux depends on how much Virtual Memory you ... minus how much RAM you actually have. ... Your /boot partition is twice as big as you'll likely need too, ...(comp.os.linux.misc)

Re: FreeBSD 4.x EoL...upgrade ad lib; just reboot when done. ... you don't need *a* partitions to boot such as ad0s1a. ... You simply need to spare a FreeBSD partition.... If you have lots of physical memory and swap space,...(freebsd-stable)

Re: Disklabe oddity... > partition was created by FreeBSD on its own. ... > back on the disk.... It's not a good idea to add swap space to a file system. ... and changing the length and offset of partition c (offset ...(freebsd-questions)

Re: Swap space... >>The general rule is to have at least twice your RAM as swap space.... It is easy to change the swap partition size, ... For some reason, the RedHat installer has ... or whole disks, into a "virtual disk"; ...(comp.os.linux.setup)