Step1: Attach a New Hard disk.
We can also verify by fdisk -l
command
Step2: Create a partition in the new hard disk.
Here the new harddisk is /dev/sdb
verify using lsblk
command
Step3: Format the newly created partition.
Step4: Mount the Partition
It is good practice to verify using df -hT
command
Step5: Create a file in the mounted directory
Increasing the size of the static partition
Step6: To Increase the size of the static partition, First unmount the Partition.
Step7: Now delete the partition which was previously created.
Step8: Create a new partition.
Make sure to not remove the signature so that the previous data remains in that partition.
Step9: Use e2fsck command to examine file-system errors.
Step10: Reformating the disk using resize2fs cmd.
Step11: Now, again just mount the partition on the same folder.
Hence, we have increased the size of the static partition from 5GiB to 9GiB. And our file is also present there
Reducing the size of the static partition
Step1: Unmount the partition from the folder
Step2:For reducing the size, we must resize the partition size from 9GiB to 5GiB. While reducing the size of the partition we do not have to delete the partition.
Step3:Again mount the directory with that partition to use it and we can see that our file is still present there.
Congratulations, you have learned successfully how to Increase or Decrease the Size of Static Partition in Linux