First, you need to identify the partition that you want to resize. You can use the command “lsblk” to list all the available disks and partitions on your system.
Now, start the fdisk utility by running the following command:
fdisk -u /dev/sda
- Type “p” to print the partition table and verify that the partition you want to resize is listed.
- Type “d” to delete the partition. Don’t worry, this will remove the partition from the partition table, but the data on the partition will still be intact.
- Type “n” to create a new partition. Follow the prompts to specify the new size of the partition.
- Type “w” to write the changes to the disk and exit fdisk and “q” to quit.
Partition table have been modified, but the kernel don’t know about this yet because some partitions are still mounted.
To force the kernel to apply new changes type:
This command could fail, you need to reboot the system.
Finally, you need to resize the filesystem on the resized partition. You can use the appropriate command for your filesystem type. For example, if you are using ext4 filesystem, you can use the following command:
that’s all , you can verify the result with