I used to run Ubuntu and Kali, but now I want to delete Kali and just extend the partition where Ubuntu is stored. I booted from a LiveUSB and deleted the partition where Kali was installed, and now that partition is unallocated. However, when I try to resize the Ubuntu partition, the slider will not move left. How do I solve that?
-
We need a bit more information in order to help. Can you post a screenshot of Gparted and perhaps the output of lsblk. Is your Ubuntu partition inside an extended partition? If so you need to expand the extended partition first – PonJar Nov 06 '19 at 18:56
-
Added an image. – Anastasis Pap. Nov 06 '19 at 19:05
2 Answers
Your system is formatted with GPT instead of MBR, so there are no Extended partitions to deal with (simplifies matters).
If you are using Ubuntu 18.04 or newer, and do not use Hibernation, you do not need a separate swap partition, and can use a swap file instead. There was a problem in the kernel, fixed in late 2017, that made swap files slower.
If you don't use hibernation, you can unlock /dev/sda7
by right-clicking on it. Delete it; we will make a swap file later after rebooting into Ubuntu from your system drive. Then, you can extend /dev/sda5
across the space formerly used by the swap partition into the unallocated space.
Remember, with gparted, to make one change, then click the green check mark in the power bar before making another change.
/dev/sda1
is also useless, for you do not use Windows any more. However, you can't easily get at that space, without deleting and recreating the EFI boot partitions; it would be easier to
- backup and verify the backup matches the source data
- make another backup to different media (disk or cloud) and verify that, then
- wipe the disk completely and
- reinstall then
- restore.
Commands to make, then enable, a swap file (second command makes a two GB swap file with the bs= option, resize as it suits you):
sudo swapoff -a
sudo dd if=/dev/zero of=/swapfile bs=2G count=8
sudo mkswap /swapfile && sudo swapon /swapfile
-
hibernation with a swap file is theoretically possible, and I have managed to get it working on at least one system... – Zanna Nov 07 '19 at 14:03
-
@Zanna Theory, Theory, everything works in Theory. I want to move to Theory when I retire. – K7AAY Nov 07 '19 at 16:37
You have a swap partition to the left of your /dev/sda5. Move this first, then resize your Ubuntu partition.
-
1Be careful with moving partitions if you have important data on them. Backup first just in case. – crip659 Nov 06 '19 at 19:16
-
-
The swap partition is locked so you need to resolve this first. I’d be inclined to boot Ubuntu and change it to use a swap file. When this is done and after a reboot you should be able to delete the swap partition from Ubuntu. Then you should be able to reboot to a live session and resize – PonJar Nov 06 '19 at 19:19
-
Is one of the partitions part of a logical partition? You'd have to deal with this first. – Stefan Czinczoll Nov 06 '19 at 19:20
-
@stephan Czinczoll There is no logical partition inside an extended partition in the image provided but that’s a good line of thought. – PonJar Nov 06 '19 at 19:27