I use a single-board computer with Debian Buster (armhf) installed on an SD card. It has 1 GB of soldered RAM, which can't be increased. I have disabled Linux swap, which generally works fine.
But I have one application where I would like swap to be available. I want to have a swap partition on a USB hard drive, and only plug in the drive when I need to use the swap. This application requires this drive to be present, so adding the swap functionality would be pretty handy.
So far, so good.
But, I would like Debian to automatically detect and use the swap space when available, without user interaction.
Is there a good method to do this without the user calling a script? A reboot is acceptable, but I'd rather not require it. And if I simply put the swap partition in fstab, the boot fails if the drive isn't plugged in when booting.
Finally, I'm not worried about disabling the swap. The system will be shut down after the application is finished.