How to Change the Size of Static Partition in Linux
In Linux, the primary partition that we create don’t allow us to increase or decrease the partition size. If we do we have to format it again but the issues are that if we format the partition again then we will not be able to access the data that we had stored.
So we have to find some way through which we can increase or decrease the size of the static partition by formatting it again.
List existing disk partitions:-
fdisk -l
Create one partition of size
fdisk /dev/sdc
for creating new partition , press n and give the size of partition. For save the changes after creating partition press w
format the partition and mount it
mkfs.ext4 /dev/sdc2 (for format the partition)
mount /dev/sdc2 /workstation
Unmount the partition from the /data folder.
In this step, we will unmount the partition because we have to resize the partition size and the static partition doesn’t allow us to resize the partition on-line.
To unmount the partition we can use the umount command.
umount /dev/sdc2
for resizing the partition size, first delete the previous partiton and create new one but keep in mind to say ‘No’ to remove the signature.
check the file system for Errors using e2fsck command:-
e2fsck -f /dev/sdc2
resize the partiton
resize2fs /dev/sdc2
mount the partition again to the same folder
mount /dev/sdc2 /workspace
and finally we get our older data
THANK YOU!
My LinkedIn: Himanshu Agrawal