Increase or Decrease the Size of Static Partition in Linux.

Manav Misra
3 min readMar 30, 2021

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:

  1. Create a partition
  2. Format it
  3. 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

  1. Unmount it
  2. Check the partition
  3. resize it
  4. 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!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response