0

I don't know how to expand my kali linux partition.

enter image description here

I want to add the unallocated marked partition to the /dev/sda7. If I try to resize /dev/sda7 I don't see any free space on my disk but if I try to resize some other partition I see 143GB of free space. How can I resize it without reinstall?

2 Answers 2

2

My approach would be removing the swap partition first, and then moving/resizing the ext4 partition backward. You can recreate swap partition later. By the way, you cannot resize your ext4 partition while you are using it. Therefore you should perform this operation on another system, I recommend creating a live USB and using it.

1
  • Resizing a partition with data backwards is not going to work. The filesystem should be copied to the beginning of the partition.
    – Oskar Skog
    Feb 25, 2020 at 13:48
1

Faruk D is on the track, but one cannot simply grow a partition backwards.

You should obviously backup any important data before messing with filesystems.
And all of the following things require that the filesystems are not mounted and that the swap partition is not in use, so use a live USB/CD.


You should first create a new partition in the unallocated space (which is larger than the ext4 partiton) and then copy the entire ext4 partition over there with dd, eg dd if=/dev/sda6 of=/dev/sda8.

Then you can delete the old sda6 and sda7. With the data safely in the new partition you can extend the partition and create a new swap partition.

I'm not sure if that GUI will resize the filesystem on the partition, so that may need to be done with resize2fs, eg resize2fs /dev/sda8


A safer option is to create a new partition for whatever part of the filesystem takes up space. If for instance /home is taking up lots of space you can create a new partition for it, mount it and move all files from /home to it.

Then you can remount that new partition on /home and it will appear as if the files were never moved. Don't forget to add an entry to /etc/fstab

You must log in to answer this question.

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