2

I installed Linux Mint 18.2, as LVM with LUKS encryption, onto a 128GB SSDD. I would like to remove the swap drive b/c I have 16GB of RAM on my machine and I want to try to preserve the drive as long as I can. When I started the disk and started Gparted to remove the swap partition I noticed that Gparted lists the drive as only two partitions /dev/sdb1 ~.5GB boot-sector (I think) and /dev/sdb2 the crypt-luks container. When I checked /ect/fstab I noticed that this was the last line;

/dev/mapper/cryptswap1 none swap sw 0 0

Does anyone know a safe way to remove this kind of swap partition?

1 Answer 1

5

There shouldn't be any problem disabling a swap partition of any sort. Once booted, you can disable the swap partition with:

sudo swapoff -a

And then place a swap partition on some other disk and enable that with:

sudo swapon -U uuid-of-new-swap-partition.

Once you verify that the new swap is working, you can remove the LVM swap partition on your LUKS drive... and reuse the space. LVM is awesome!

To make the changes permanent, replace the swap partition listed in /etc/fstab with the new one using the same options as the prior swap... none swap sw 0 0

LUKS specific instructions

Apparently... There is a specific option with cryptmount for enabling and disabling swap.

cryptmount --swapoff 

and

cryptmount --swapon

It seems that cryptmount will perform the close operation in addition to disabling the swap partition.

If you've disabled the swap with the regular system swapoff, you may need to disable the current swap partition (safe to do) to close the LUKS swap partition before you can remove it...

cryptsetup -v luksClose /dev/mapper/cryptswap1
5
  • What should be done to make the changes permanent?
    – user001
    Nov 10, 2017 at 21:42
  • 1
    @user001: added permanent change. Nov 10, 2017 at 21:48
  • So will the space from the swap drive automatically be reallocated to the main partition? Also do I need put the swap partition somewhere else I thought the it wasn't needed if I have enough RAM? Nov 11, 2017 at 3:37
  • @JamesDraper: Swap is not automatic. It needs to be setup with its own partition. You can place the swap partition on any available drive. Running without swap is not the best idea, but will probably work just fine for most systems. I have SSDs on some of my systems, and my drives have been working fine for years... However, if you'd rather wear out a USB stick instead, you could place the swap there Nov 11, 2017 at 3:50
  • Yeah well then I'll probably just leave the swap drive where it is then it's good know about this option though. Nov 11, 2017 at 3:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .