Elasticity Task - Increase or Decrease the Size of Static Partition in Linux

Elasticity Task - 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

No alt text provided for this image

Now we can check if the volume of 10Gib is attached or not using command:

fdisk -l
No alt text provided for this image

Now, for using any Hard Disk we have to follow three process:

  1. Create a partition
  2. Format it
  3. Mount it.

We can create a partition of that disk name /dev/sdb

fdisk /dev/sdb
No alt text provided for this image

To check the partition is created or not we can use lsblk command

lsblk
No alt text provided for this image

Now we can format the partition /dev/sdb1

mkfs.ext4 /dev/sdb1
No alt text provided for this image

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  /tasktest

df -lh
No alt text provided for this image

Now for increasing and decreasing the size of partition first we have to

  1. Unmunt it
  2. Check the partition
  3. resize it
  4. and then mount it again

For unmounting simply we run the command:

umount /dev/sdb1

df -l
No alt text provided for this image
e2fsck -f /dev/sdb1
No alt text provided for this image
resize2fs /dev/sdb1 5G
No alt text provided for this image

Now mount it back

mount /dev/sdb1  /tasktest

df -lh
No alt text provided for this image

It's been resized!

That's all

Thank you!

To view or add a comment, sign in

More articles by Pratyush Pathak

Explore content categories