GParted won't seem to let me shrink an encrypted partition

14,031

Solution 1

The partition/dev/sda2 is an extended partition under which the logical partition /dev/sda5 was created. Although this would not have been necessary for the setup being shown in the screenshot you've provided, the reason to create an extended partition is to achieve the possibility to create more than three additional partitions later on. It is not possible to create more than four primary partitions on a disk with msdos (MBR) partition table. But now to your question : you can - and have to - resize the partition /dev/sda5. First decrypt this partition and then start the resizing process with GParted ...

  • Shrink /dev/sda5 (make all free space to be preceding space)
  • Shrink /dev/sda2 (make all free space to be preceding space)
  • Grow /dev/sda1 (add the complete free unallocated space)

It is important that afterwards no free unallocated space is left between /dev/sda1 and /dev/sda2,
which means that you may need to add 1 MB still remaining space to /dev/sda1 or to /dev/sda2.
I've tested it in a virtual machine, but I recommend to backup the disk in case something goes wrong.
Find more information about partition resizing and what you have to pay attention to : GParted Manual

Solution 2

I found a much easier solution. Run Xubuntu live, install and launch partitionmanager. It can very well handle encrypted partitions.

Complete details are here: http://e1z.ca/devlog/encrypted_partition_resize.html

Share:
14,031

Related videos on Youtube

Max Williams
Author by

Max Williams

Updated on September 18, 2022

Comments

  • Max Williams
    Max Williams over 1 year

    I have a 1TB (or thereabouts) SSD drive on my laptop, on which is installed Ubuntu 14.04.

    I want to increase the size of the boot partition, so I've booted from a live CD, and ran GParted.

    I have two partitions - the main one, /dev/sda2, and the boot one, /dev/sda1. Within /dev/sda2 is an encrypted partition called /dev/sda5. It looks like this:

    enter image description here

    I can right click on /dev/sda2, and choose "Resize/Move", but on the following dialog it doesn't let me make any changes.

    Is this because I would need to shrink the encrypted partition within /dev/sda2 first, and you can't resize encrypted partitions? That seems plausible but my knowledge runs out at this point.

  • cl-netbox
    cl-netbox over 5 years
    Hi Max, what I wrote was the answer addressing your question, but what I recommend is something different. Ubuntu 14.04 is nearing EOL and the whole setup is not "the most professional one". So, I would backup the personal data and then start over from scratch - first create a new partition table, then create a new partition, format it with ext4 and then install Ubuntu 18.04.1 LTS ... adjust your individual configuration from within the Ubuntu installer. Once the installation process has finished, boot the system and restore back your data. :)
  • Max Williams
    Max Williams over 5 years
    Thanks @cl-netbox but I actually want to stick with 14.04 to replicate our work server environment. WRT your answer, can I decrypt it in place? Or would I need to decrypt it to another HDD, say?
  • cl-netbox
    cl-netbox over 5 years
    @MaxWilliams Yes, you can decrypt the partition "in place", there is no need to move something. After having tested the resizing process in a virtual machine, I updated the answer with the relevant steps. :)
  • Max Williams
    Max Williams almost 5 years
    Ah, sounds promising. I will investigate when my in-tray stops being on fire - thanks!
  • BPugh
    BPugh about 4 years
    @cl-netbox Following this answer, and using Gparted Live, I unlock and try to shrink the lvm2 partition (called sda5 for me), but the resize dialog doesn't allow me to adjust the settings in it. Any suggestions?
  • cl-netbox
    cl-netbox about 4 years
    @BPugh You may want to read How can I resize a LVM partition? ... :)
  • Andreas L.
    Andreas L. over 3 years
    How do I decrypt the partition within Gparted? Actually, my encrypted partition is the one I'm working on. Seems like I'd have to flash a USB to be able to change its size then, since it can't be mounted while being modified anyway, isn't it so?
  • cl-netbox
    cl-netbox over 3 years
    Exactly @AndreasL. ! You can't modify mounted system partitions ... boot from a GParted USB drive. :)
  • Peter Flynn
    Peter Flynn over 2 years
    Except that there is no 'decrypt' option in partitionmanager now. I just installed it from a Mint 20.2 live usb, and a right-click on my encrypted partition shows no decrypt option. Is there something special has to be done beyond running it sudo?