I have a PC with 32GBs of RAM running Linux Mint 20. As per instructions found here (which were meant for 19, but appear to work for 20), I have increased my swapfile to just a little larger than my total physical memory:
username@hostname:~$ ls -lh /swapfile -rw------- 1 root root 34G Nov 2 18:05 /swapfile
I like to image my disk when it has a well set-up install of my OS, so that I can revert back to it should things stray. I use a Clonezilla Live USB for this, and (following the instructions of Clonezilla to select default choices if you don't know any better) select default/simple choices. I work with images_disks, I choose a folder on an auxiliary drive as the root where images will be saved to, I choose the savedisk option, and the default compression algorithm. I then let Clonezilla do it's thing. I don't want to image just the partition, because the point of the restore may be to fix the whole disk.
My drive has about 156G used on it, according to
df, but of course the resultant image is smaller than that. In part due to compression, but is Clonezilla smart enough to ignore my swapfile? I've heard (and now can't find where) that it will ignore a zerofilled (ie one that doesn't have a hibernation saved to it) swap partition, but will it inspect the drive closely enough to do the same with a file, before copying it? If not, would switching to a swap partition, rather than swap file, help?