Linux: Where to put the swap file

linuxswap

Are there any conventions on where to put swap files on Linux?

I usually just create them in /var/swapfile, but that seems a bit too high up in the hierarchy.

Best Answer

AFAIK there is no location defined in the File System Hierarchy Standard.

Because /var is for often-changed files, I would say it is okay to place it here. But remember that if you use a flat-file swap instead of a partition, consider to use a fast file system for /var.