I'm troubleshooting our server falling over last night, and when I looked, I saw swap space was depleted and cPHulk taking up all the CPU.
TL;DR Any ideas how to quickly increase size of dm-1 partition?
To isolate, I'm first going to increase swap space from 2 GB (server has 8GB RAM) to 4 GB as running out of swap sounds like a big no-no to me.
I found two types of methods on the internet on how to increase the swap space on a CentOS Linux server, but I'm having problems doing the /etc/fstab part and / or understanding the second method.
The first method seems pretty straightforward, for example the one at Linuxize "How to Add Swap Space on CentOS 7".
In summary:
Check first what's going on (I have 2 GB swap space):
cat /etc/fstab
Two swap files!
The other type of guide seems nice and complicated. Stuff about increasing that disk partition.
Questions:
1. Will I be okay with two swap files (I prefer one)?
2. Any quick steps to rather just increase dm-1?
I've spend a ton of time on this and waking up at 3AM wasn't nice. I'm in a bad mood already and also haven't had coffee.
TL;DR Any ideas how to quickly increase size of dm-1 partition?
To isolate, I'm first going to increase swap space from 2 GB (server has 8GB RAM) to 4 GB as running out of swap sounds like a big no-no to me.
I found two types of methods on the internet on how to increase the swap space on a CentOS Linux server, but I'm having problems doing the /etc/fstab part and / or understanding the second method.
The first method seems pretty straightforward, for example the one at Linuxize "How to Add Swap Space on CentOS 7".
In summary:
Check first what's going on (I have 2 GB swap space):
Create swap. At this point the guide says it can be done with fallocate -l 4G /swapfile too, but this failed later so used dd method insteadswapon --show
dd if=/dev/zero of=/swapfile bs=1024 count=4194304
chmod 600 /swapfile
mkswap /swapfile
(this failed with swapon failed: Invalid argument if fallocate was used)swapon /swapfile
cat /etc/fstab
So that all works. But now I have this:...
/swapfile swap swap defaults 0 0
Bash:
# swapon --show
NAME TYPE SIZE USED PRIO
/dev/dm-1 partition 2G 1.8G -2
/swapfile file 4G 0B -3
The other type of guide seems nice and complicated. Stuff about increasing that disk partition.
Questions:
1. Will I be okay with two swap files (I prefer one)?
2. Any quick steps to rather just increase dm-1?
I've spend a ton of time on this and waking up at 3AM wasn't nice. I'm in a bad mood already and also haven't had coffee.