Increase or Decrease the Size of Static Partition in Linux.
Task 7.1: Elasticity Task

B. Increase or Decrease the Size of Static Partition in Linux.
So lets start!!
Here for doing this first we will attach a volume(Hard Disk) of 10GiB to the VM
Now we can check if the volume of 10Gib is attached or not using command:
fdisk -l
Now, for using any Hard Disk we have to follow three process:
- Create a partition
- Format it
- Mount it.
We can create a partition of that disk name /dev/sdb
fdisk /dev/sdb
To check the partition is created or not we can use lsblk command
lsblk
Now we can format the partition /dev/sdb1
mkfs.ext4 /dev/sdb1
Now we can mount it so that we can use it, for that first create a directory where you will mount using mkdir <dir_name> and then mount it. You can check whether its mounted or not using df -lh command
mount /dev/sdb1 /tasktestdf -lh
Now for increasing and decreasing the size of partition first we have to
- Unmount it
- Check the partition
- resize it
- and then mount it again
For unmounting simply we run the command:
umount /dev/sdb1df -l
e2fsck -f /dev/sdb1
resize2fs /dev/sdb1 5G
Now mount it back
mount /dev/sdb1 /tasktestdf -lh
It’s been resized!
That’s all
Thank you!