I need to reduce my swap partition and resize /home

My EndeavourOS installation went perfectly and I am really pleased with it.

It was only later that I discovered that I had accidentally created a swap partition of 30GB instead of 2GB. I blame it on sausage fingers!

I can either:

(a) Get rid of my 32GB swap partition completely and give the whole of the 32GB to /home

OR

(b) Give 30GB to /home and create a new swap partition of 2GB.

In any event, I am fully aware that I first need to temporarily disable swap, edit /etc/fstab and remove the swap partition.

It is what happens next that is giving me considerable concern and where I need help.

I am happy using GParted Live for resizing partitions etc but I am concerned about the necessary changes for UUIDs, edits to /etc/fstab and GRUB amongst other things.

I really do not wish to end up with an unbootable device.

I think I would prefer option (a), but if option (b) is less hassle, then I will go with that.

By the way, I have 8GB of RAM and a 128GB SSD.

Your considered advice would be greatly appreciated.

Thanks.

There are a couple of things you can do.

you could do this and then just create a swap file instead of a swap partition
https://discovery.endeavouros.com/storage-and-partitions/adding-swap-after-installation/2021/03/

don’t remove it if you decide to create a smaller partition just replace the UUID and or adjust if you choose to create a swap file

2 Likes

Just for us to have a better view of your setup run these commands and share the output.

cat /etc/fstab

sudo parted -l

There are several options.

One is to remove the whole swap partition and create a swapfile. They are more flexible and can be resized without so much hassle.

Also, you could activate zram which is a compressed swap device but located in the memory.

1 Like

I like option A since there are other swaps you can build down the road of the Z variety, etc. Listen the these gents ^^^ and dot the i’s and cross the t’s first.

Thanks to all who replied.

I successfully installed EOS GNOME on a MS Surface Go 2 and mostly everything works fine.

Since I am not particularly familiar with GNOME and the MSSG2 at present, I was unable to copy the terminal output to a LO Writer file.

(Maybe as a secondary topic, somebody can explain the procedure, please).

However, I did take a screenshot of:

cat /etc/fstab

and

sudo parted -l

I do like the idea of using zRAM and a swapfile.

I am all ears!

Thanks again to all for your assistance.

EDIT

According to fastfetch, my swap is disabled.

I see you chose dos partition table for your disk. I think MS Surface Go 2 should support UEFI boot mode. Why not GPT disk?

If you had a GPT disk, systemd should have detected and activated your swap partition.
But you have a msdos disk. You need to make an entry for swap partition in /etc/fstab.

Regarding deleting the swap partition. I can see it is between your system(root) partition and home partition.

This makes things a little awkward if you want to add that space to home. You need to first delete the swap partition, move your home partition to left and finally expand it to the right.

Not impossible but little risky if you have lots of data on your home partition. These sort of operations, if gone bad, can cause data corruption or loss. Having a good backup is a must.

If you have the possibility, my suggestion is to reinstall. This time make a GPT disk. I think you can already choose swapfile in the installer. It is easy to make one after installation too.

Backup your data at any case!

cactux,

I thought that I had formatted the disk as GPT. Obviously I hadn’t.

I will reformat the drive and reinstall.

Thanks.

1 Like

do not disable swap. What @thefrog said is the most optimal, go for a swap file instead of a swap partition.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.