To increase the size of the /dev/sda2 partition from 20 GB to 100 GB, you need to resize both the partition and the filesystem. Here are the steps to achieve this:
Steps to Resize the Partition and Filesystem
-
Backup Your Data:
- Always ensure you have a complete backup of your data before making any changes to disk partitions.
-
Use
partedto Resize the Partition:- Open a terminal and use the
partedcommand to resize the partition:sudo parted /dev/sda - Within the
partedinteractive shell, resize the second partition (/dev/sda2) to use the full disk space:(parted) resizepart 2 100% - Confirm the operation if prompted. This command will extend the partition to the maximum available size on the disk.
- Open a terminal and use the
-
Exit
parted:- Type
quitto exit thepartedutility.
- Type
-
Resize the Filesystem:
- After resizing the partition, you need to resize the filesystem to occupy the newly allocated space. For an ext4 filesystem, use:
sudo resize2fs /dev/sda2 - This command will adjust the filesystem to fill the entire partition.
- After resizing the partition, you need to resize the filesystem to occupy the newly allocated space. For an ext4 filesystem, use:
-
Verify the Changes:
- Use the
df -hcommand to check that the filesystem now uses the full disk space:df -h /dev/sda2
- Use the
By following these steps, you can successfully increase the size of the /dev/sda2 partition to utilize the full 100 GB of disk space on your Ubuntu system. Always ensure you have a backup of your data before proceeding with disk operations, as they can be risky.