I have a problem with expanding partition size in Linux. I tried Gparted, but I can't resize because un-allocated space does not appear.
In the above picture, it shows my primary and extended partitions. I want to extend "sda2".
/dev/sda6), do "swap off"
/dev/sda5by selecting it, using the resize/move dialog
resize2fs /dev/sda5to extend the filesystem...
If you wanted to increase space in one of the other ext4 partitions (
sda3), you would have to first shrink the extended partition, moving that to provide unallocated space next to them. That's more steps...
Unfortunately this is not easy, and indeed I believe that earlier posts are wrong in 1 crucial way.
/dev/sda4 is an extended partition with 2 partitions in it. The first thing you need to do is delete BOTH of these partitions. Deleting the linux-swap partition is not a major, and can be done by simply turning off swap and deleting it (swapoff -a) - however /dev/sda5 may provide a bigger challenge.
Without knowing more about your setup, its not possible to advise exactly, however if it is mounted and part of your tree, copy the data from it into a temporary directory, then umount it and move the data from the temporary space to where it belongs (Luckily there is not much data there).
You need to do a similar thing to move the contents of /dev/sda3 into /dev/sda2.
Once you have removed the contents of /dev/sda3 and sda5, and removed swap, you can delete these partitions, and recreate a larger partition for /dev/sda3. You probably also want to create a swap file or a swap partition. Once you have created the swap area, format it with mkswap /dev/sdX or mkswap /path/to/file. You also need to go to /etc/fstab and remove / update the mounts as appropriate.