My laptop is getting kinda slow, especially when having Firefox opened with multiple tabs, which is why I'm trying different ways to make it a little snappier. It has an Intel Core 2 Duo T5600, 2 GB of RAM, and Linux Mint installed. I've read that decreasing swappiness can help, so I set it from the default value vm.swappiness=60
down to 33
. But since I'm frequently running into RAM issues and my laptop doesn't support more than 2 GB, I would like to increase the swap partition.
I worked through a whole bunch of tutorials and SE discussions, but it seems that increasing swap is not so easy in my case as the root partition already takes up all the free space:
This is the output of lsblk
:
raffy@mypc:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 238,5G 0 disk
├─sda1 8:1 0 976M 0 part /boot
└─sda2 8:2 0 237,5G 0 part
└─lvmlmde 254:0 0 237,5G 0 crypt
├─lvmlmde-root 254:1 0 233,6G 0 lvm /
└─lvmlmde-swap 254:2 0 4G 0 lvm [SWAP]
sr0 11:0 1 1024M 0 rom
For example, I tried this:
raffy@mypc:~$ sudo lvm lvresize /dev/mapper/lvmlmde-swap -L +1G
Insufficient free space: 256 extents needed, but only 0 available
This seems to make things complicated, as the root partition first needs to be reduced in size. However, I'm not really an expert in this and I'm afraid to lose data or even brick the system (which is finally running perfectly, except for the lack of RAM). Also the whole disk is encrypted.
Somewhere I remember reading that one can also just create a second swap file, but I'd rather do things "properly" (?) and increase the existing swap partition. I'm wondering though if there is any difference in speed having a swap partition vs. swap file. The good news is (I think) that I have an SSD, so the swap should be a little faster than with a standard "spinning" hard drive...
Is there a safe & clean procedure for decreasing the root partition by X and increasing the swap partition by the same amount?
PS.: This is the output of swapon
:
raffy@mypc:~$ swapon -s
Filename Type Size Used Priority
/dev/dm-2 partition 4124668 11520 -2
...what does the negative priority of -2
mean, is this an error?