The XG will be your desired size in GB, so 4G = 4GB, or desired.
Might also want to check your swappiness, in terminal: sysctl vm.swappiness - if it's anything higher than 60, you may want to lower it. Higher numbers for swappiness = more aggressively the swap is used. To change you would need to modify /etc/sysctl.conf at the bottom - add vm.swappiness=XX for XX, 0-100 | 60 is the recommended value. I usually run 50 but it's personal preference for your system and use.
I run swappiness at 200 (the maximum), because I've got 3 swap drives with the same priority, so any swapping will be done round-robin fashion across three drive interfaces and three drives... that's about as fast with spinning-rust drives as a single SSD (without having to worry about write-wear on the drive).
NAME TYPE SIZE USED PRIO
/dev/sda2 partition 2G 0B 1
/dev/sdb2 partition 2G 0B 1
/dev/sdc2 partition 2G 0B 1
Some relevant swap commands:
Turn off all swap: sudo swapoff -a
Zero a swap partition: sudo dd if=/dev/zero of=/dev/disk/by-partuuid/$swap bs=512 status=progress
You'll have to find the partition UUID of the swap partition you want to zero, and put it in where '$swap' is above. I use 'by-partuuid' because the drive letter (sda, sdb, sdc, sdd, etc.) can change, but the UUID should never change.
Make a swap partition: sudo mkswap /dev/disk/by-partuuid/$swap -U $swapUUID
You'll have to find the partition UUID and the drive UUID and put them in above where '$swap' and $swapUUID' is. Note that this means you can make up your own $swapUUID, if you want. The script I use to zero all free drive space (to make compressed backups smaller) uses the pre-existing UUIDs of the swap partitions so I don't have to make any changes to the fstab file to get the now-zero'd swap partitions to auto-mount at boot.
Actually, 2G is too small, too, in my opinion. I had to increase it the way @PlumpKibbles described it. I think the installer should provide an option to set the swap size, or at least provide several defaults, as many arch based distros do in the Calamares installer.
Oh I agree for sure - but it's Ubuntu under the hood; pretty standard in terms of Ubuntu ways, heh. I am glad it's pretty easy now though with the swapfile instead of the partition I do have a partition on another device, but it's a permanent thing; only 1GB, tiny eMMC storage..
You only need a swap area for HDD's not SSD's. In the unofficial manual for Zorin 15 I wrote how to manually partition the drive at point of install - you choose the 'something else' method.
When partitioning manually I usually just have a primary partition marked for '/' root filesystem of 80 Gb, formatted to Ext4 and flagged as bootable. I then create a logical/extended partition for the remainder of the drive. Before GNU/Linux OS's used swap files they would place the swap area at the end of the drive - so this is what I do when partitioning manually. I create the swap area at the end of the extended/logical partition and make it double the amount of physical RAM on board, so in my case, 32 Gb as I have 16 Gb of RAM. Everything in front of that I format as Ext4 and mark it '/home'. (I normally run 1 Tb Western Digital Black HDDs.)
I never bother with Encryption as experience has shown me that it is oh so easy to lose your data. I always took note of OpenSuse 9.3 Professional's advice that I bought during installation - when you selected encryption option, it warned that their is a chance of data loss - that was enough to convince me that Encryption is a bad idea. It also happened at work. My line manager asked me to make her Business Manager's hard drive secure for confidential data. This was Windows XP, created the Encrypted partition for data, 3 days later the machine fell over, as did all the data. Fortunately, the Business Manager had the nouse to make a backup of her data so only one day's data was lost.
As you have 16GB of physical RAM, this shouldn't be much of a worry for you, unless you plan on having hundreds of tabs open in Firefox, are running a video, while editing a video, while playing a game and conference calling on zoom all simultaneously.
It all depends on how you use your computer. Gnome uses 2 to 3GB of RAM, other applications using far less. Do you close applications or keep them open in the background, just in case?
I have 32GB of RAM. With VSCode running, KDE desktop (only a little less memory intensive), Zoom call, Discord Call, Slack and Firefox running.... it was less than 16GB of RAM used while compiling some rather large applications. My swapfile is 2GB, and is never used, even with a very low swappiness threshold.
I've just automatically followed the double physical RAM advice after extensive research on the matter a long time ago. It has taken me many years to get to a place with a 16 Gb of RAM machine. And in any case I have plenty of space on a 1 Tb drive.
16 GB ram is already enough for doing a lot of things on windows, so keeping in mind linux uses far less ram, I dont see how would it be neccessary to have a swap partition
my laptop has 12 GB ram (10.7 GB detected by zorin) and with that I have been able to use a virtual machine of 6 GB, have some tabs open on firefox, do some homework in libreoffice at the same time and there was still some unused ram
If you do some kind of ram-intensive work that requires more than that (maybe a very detailed 3D animation?) then that makes more sense. But for normal daily usage or gaming, you dont really need more
You don't need swap area for SSD. If it puts a swap file in (the installer) it should make itself a suitable size. I cannot check this any more as the SSD went into my eldest's Desktop as their hotswap HDD sounded like it was failing to put Windows 11 on it.
I clicked "Like" on two of @swarfendor437 's posts for good reason.
Swap is useful in the right circumstances: It can prevent an out of memory crash under an intense workload.
But it is not Free RAM.
When the system needs to fall back to swap (Partition or file) there will be a delay in that action. It won't prevent sluggishness, nor will it clear out the unnecessary caching of used data in RAM.
I do not use Swap (I am on SSD)- and when my RAM fills up, even higher than 90%, on Zorin OS, the system clears as necessary, keeping the performance smooth and uninterrupted.
If I enable swap, however, then I get a lot of pauses and delays as the system switches to accessing swap. It is not a smooth experience.
On rare occasions, I may run the following to clear out RAM while working.
sudo sysctl -w vm.drop_caches=3
Warning: It is necessary to sync both before and after clearing RAM!
I have 16GB RAM in my Asus laptop - zero swap, but also using NVMe storage. I'm usually sitting around 1 - 2.5GB RAM use on idle; just a tad more with Firefox open. I've not ran into any issues with no swap - even did some 'intense' video editing with Kdenlive lol but, didn't have an effect on RAM - just about 5GB used, and still ~8GB free to use.