Swap Partition and Swap File?

I was hoping to use a swap partition that is 1x my ram (32GB) for hibernation sake. Then on the side have a swap file so if the system needs more it can flex out and use it.

I have yet to find some information on how to use both… it seems like one or the other.

ps. Yes this computer will be dealing with large’ish data sets. The swap will be located on a NVMe drive.

When you have a 32 GB Swap (partition) and 32 GB memory, I doubt you need more swap.

You can have a mixture of Swap partition(s) and Swao file(s). But not many systems need that.
See

man swapon

(and read the warning about using files in a btrfs file system).

Ok good to know!

Does the system use the swap partition first then the swap file or is it randomly used?

Swap partitions are normally defined in /etc/fstab and are then used in the sequence of the entries. Later you (root) can add end remove when you want using swapon/swapoff.

I am not sure if there is a standard way of defining swap files at system boot, but it is of course not difficult to do that using a systemd unit.

Ok thanks for all the help!

You might even consider having a huge swap partition ( I wouldn’t go for swap files unless I was sure that the FS where they’re stored will always have enough space. ) on the NVME disk. If you really use big data sets with 32GB RAM ( which isn’t much on big datasets ) that would be my choice.

Default file system in openSUSE is btrfs, and swap file is not supported on it. Keep it in mind. You can create it but it may crash your system.