Modify /etc/fstab with new SWAP UUID

Hello everyone!

I tell you: Until now, I had a 1Tb HDD (937 Gb for / and 4 Gb for SWAP) which I have replaced with a 240 Gb SSD.
To do this, with GParted, I edited the / partition on the disk, and downsized it to 215 Gb, then I DELETED the 4 Gb SWAP partition and created a new 8 Gb SWAP partition. Then, with CloneZilla, I cloned the HDD to the SSD (I had no problem that the SSD was smaller than the cloned one, since I checked the box that bypasses this check.
So far everything is correct. Got my server back in production from my new SSD, all good.

Except for one small detail.
When I enter Cockpit, in System, in the SWAP information, it tells me that I have 0B available.
I have to go to Storage>/dev/sda>sda2>Swap and hit Start.

So, if I go back to the System page, the SWAP info tells me 8 Gb available.

My question is (and I end):
In the /etc/fstab file, in the SWAP part, I see the UUID of the old SWAP partition (the sda2 one I deleted of 4 Gb from the 1Tb HDD).
If I look up the UUID of the new SWAP partition (new sda2 of 8Gb), and modify the fstab file with that UUID, would it start just using SWAP automatically?

I hope I have not been too heavy and I thank you for your help.


No, I really doubt it…
But you can use the commands:

swapon /path/to/your/swap

and then verify with

swapon --show

This will show which swap partition is being used, if correct, it will be used, and a refresh of Cockpit (F5) should also show it.
A reboot will show if you got the path correct in /fstab…

My 2 cents

Hello @Andy_Wismer. Thanks for your answer.

With this command, it tells me

[root@server ~]# swapon --show
/dev/sda2 partition   8G 771.3M   -2

But, if I restart the server, I have to manually start SWAP again.

I answer myself. Yes.
I have changed the SWAP UUID in /etc/fstab and rebooted the server.
By accessing it, I already see that it has started SWAP, so I don’t have to start it manually.
Thank you anyway.