Announcement

Collapse
No announcement yet.

How can I resize the tiny swap volume created during installation?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How can I resize the tiny swap volume created during installation?

    I've installed Kubuntu 20.04 with LVM/encryption, and found out that the installer created a 1GB swap volume (not a file), even though my laptop has 16GB of RAM, and I installed Kubuntu onto a 512GB SSD.

    Why wasn't it an option during the installation process, to specify the swap size? Why make a swap volume (which is a pain to resize), instead of swap file, which is very easy to resize?

    I do development work and I need 8+GB of swap. Since there's already a swap volume, I don't want to create a separate swap file. But resizing the volume isn't possible, because the root volume is mounted.

    Click image for larger version

Name:	Can't resize swap volume.png
Views:	1
Size:	65.9 KB
ID:	649713

    Do I have to shut down my system, boot from another device, mount my encrypted volume, then hope I can resize the swap that way? Is there no easier way? lvresize didn't work, and the kvpm GUI has been discontinued after bionic.

    $ sudo lvresize /dev/mapper/vgkubuntu-swap_1 -L +7G
    Insufficient free space: 1792 extents needed, but only 0 available


    I guess it needs the root partition to be shrunk first, but trying to do that throws this scary warning:


    $ sudo lvresize /dev/mapper/vgkubuntu-root -L -7G
    WARNING: Reducing active and open logical volume to 467.75 GiB.
    THIS MAY DESTROY YOUR DATA (filesystem etc.)

    Last edited by dandv; Feb 13, 2021, 02:39 AM.

    #2
    IDK anything about encrypted partitions, but yes, you cannot resize any "active" (mounted) partition encrypted or not. I've never really understood the need to encrypt and entire disk unless you're installing top secret software or something. An encrypted home partition or the newer "Vaults" make more sense. Why encrypt a free open-source operating system?

    I suspect the reason the installer created a swap partition vs. a swap file is your swap file cannot be resumed from if it's in an encrypted partition. I also suspect - if you only want larger swap for live use and not for suspend/resume - you can just create a swap file and mount it. Otherwise, you're probably looking at re-partitioning and re-installing the entire thing.

    Do some web searching. You never know there might be a solution out there. If the installer did this setup by default, you could probably report this as a bug. I have manually partitioned my drives for over a decade now because I doubt the developer of the installer has my-use case in mind. The default lately is to use a swap file instead of a partition. Very wasteful of space if you have multiple installs.

    Please Read Me

    Comment


      #3
      Because I use BTRFS I can downsize my <ROOTFS> to make room for another partition, create it in Kpartition, and then resize my BTRFS partition to take up any slack that I left. Easy to do. Otherwise, see Oshunluver's solution.
      "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
      – John F. Kennedy, February 26, 1962.

      Comment


        #4
        Originally posted by oshunluvr View Post
        IDK anything about encrypted partitions, but yes, you cannot resize any "active" (mounted) partition encrypted or not.
        I've resized the swap partition by booting KDE Partition Manager from the Kubuntu image. Then I booted from the SSD and ran `swapoff`, `mkswap` and `swapon` to make the swap use the new larger size.

        Originally posted by oshunluvr View Post
        I've never really understood the need to encrypt and entire disk unless you're installing top secret software or something. An encrypted home partition or the newer "Vaults" make more sense. Why encrypt a free open-source operating system?
        I had my laptop stolen once, and I'm glad I used Full Disk Encryption. You don't know what temporary files, thumbnails, indexing data or whatnot various applications leave outside $HOME.

        You may say that FDE incurs a performance penalty. It does, but it's minimal, less than 4% CPU. Also, FDE is faster than home directory encryption in several scenarios. Phoronix did some interesting benchmarks in 2018 and 2019.

        Like others, I couldn't find a clear description of Vaults and their usage. How are they better than TrueCrypt?

        Comment

        Working...
        X