Start
sudo parted /dev/sda
.Print the partition table and take note of the
End
sector of the last line:unit s print free
Resize the
sda2
partition (it should be shown byparted
as2
):resizepart 2
answering "yes" if
parted
warns you about the partition being in use and asks for confirmation; type in the number you obtained in step (2)—the last available sector on the device—appending thes
(sectors) unit to it, whenparted
asks you for the end sector (you may then be asked to accept a slightly different final sector out of alignment reasons; that would be fine).Print the partition table again (same as point (2)) to confirm that
sda2
has been resized.Quit
parted
.Use
lsblk /dev/sda
to make sure the kernel is aware of the resized partition. If its shown size is still10G
, usesudo partprobe -s
to refresh it and check it again.Resize the file system:
sudo resize2fs /dev/sda2
You may be asked to run
sudo e2fsck -f /dev/sda2
before being able to resize the file system. Do it and then retry theresize2fs
command.
When given no size argument,resize2fs
grows the file system to match the size of the containing partition.Use
df -h /dev/sda2
to verify the new size.
Linux partition resize Print
Created by: Rajesh Mehta
Modified on: Wed, 30 Oct, 2024 at 11:37 AM
Did you find it helpful? Yes No
Send feedbackSorry we couldn't be helpful. Help us improve this article with your feedback.