0

I have a trusty old ThinkPad R60 with only 3 GB RAM (upgraded from 2 GB) with Linux Mint Debian Edition 4 running on it. I chose LMDE for stability and the desktop environment. The machine is one of my workhorses and, usually having multiple applications/windows/tabs open, is never turned off. This is how the 256 GB SSD is partitioned:

Screenshot

As you can see, the drive is encrypted and there is currently no swap space, but due to a chronic RAM shortage I would like to create some (maybe around 3-4 GB, matching RAM capacity) in order address the frequent slowdowns.

Is it possible to freshly create swap on a running system and is there a difference between using a swap partition and a swap file? Does encryption cause any additional issue requiring attention? And is there anything that must be taken into consideration when running an SSD?

My layman guess on the last part would be that swap performance will be better with an SSD than with a standard mechanical HDD, but can result in increased wear (more write/erase cycles) when using parts of an SSD as RAM.

david
  • 347

1 Answers1

1

The easiest approach on already running system would be to create a swap file. Example below would create 4 GB one:

dd if=/dev/zero of=/swapfile.sys bs=1M count=4096
chmod 600 /swapfile.sys
mkswap /swapfile.sys
swapon /swapfile.sys
sed -i '$ a\/swapfile.sys\tnone\tswap\tsw\t0\t0' /etc/fstab

The last line is needed to automatically load it again after reboot.

You are correct as far as SSD/HDD difference is concerned. Swap will indeed perform better on SSD. I wouldn't worry about write/erase cycles as any modern SSD will generally do fine. It's really only issue on either SD or MMC device.

Josip Medved
  • 8,909