fallocate instantly reserves a 2G file for swap — disk-backed memory overflow — without writing zeros, which makes it faster than dd. The file must then be secured (chmod 600), formatted (mkswap), and activated (swapon). On filesystems without fallocate support, use dd if=/dev/zero of=/swapfile bs=1M count=2048 instead.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.