Increase Or Decrease The Size Of Static Partition in Linux.

shristi sharma
4 min readMar 12, 2021

static partition in linux

Hello Viewers today we are going to perform static partition in Linux

Prerequisite For The Practical are:-

👉Required one operating system here we use RHEL8

👉We have already attached a hard disk drive(HDD) to perform this practical Of 12Gib size.

Use Command fdisk -l which will help you to show all the hard disk connected to the operating system

Create static partition of attached disk. In this practical we create first partition of size 4GB on disk named /dev/sdb

Steps for creating partition of attached disk

  1. n 👉To create new partition
  2. p👉To create primary partition
  3. w👉To saved the new partition

✔Note while pressing p remember to give size of partition you want to create like here we give +4G and at last save the partition by pressing w

Format the partition

For Formatting the partition we will use the command mkfs.ext4 /dev/sdb1

Mount the Partition

➡️First we need to create the directory where we mount our hard disk drive

Create directory with mkdir command here we named our directory as shristi

mkdir /shristi .

After mounting we can check it whether our directory is mount or not by using df -h command

➡️Now create file in the directory.

In my case I have created file named shr.txt inside the folder name shristi.

Now let’s see how to increase the static partirtion

To increase the size of static partition we have to unmount and delete the created partition.

Unmount the partition

By using command /dev/sdb1 then use df -h to check whether the command is unmounted or not

👉After unmounting delete the partition by using the command describe below

Press d to delete the command

Press w to save the command

Now I want to increase size of static partitions by 2Gib so I have to create new partition of 6gb

Create new partition

I will create new partition of size 6GB

In this previous we already formatted the partition1 it is asking to remove or save the ext4 signature in my case I am not removing the ext4 signature.So for that I pressing N which means NO.

  • We can see that partition of 6gb has been created by using the command fdisk -l

Now format the extended part of partition.(Not whole new created partition )

Examine filesystem for errors(This command is used to see whether any problem occur or not)

command : e2fsck -f /dev/sdb1

After that resize the partition by using command resize2fs /dev/sdb1

Again Mount the created partitions on the same folder which we created previously

and after mounting partition check by using df -h whether size has increased or not

In my case partition has mounted of size nearly about 6GB

Check if previously created file i.e. shr.txt is exist or not

First go inside the directory where we created file previously store the data .

We can see that our data still exist there .We have successfully performed the practical .

Thankyou

Team Members:

Rajit Paul

Arpit Bisane

Sabarinaath.S

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

shristi sharma
shristi sharma

Written by shristi sharma

Aspiring Devops Enthusiastic |Content Creator |Python | Machine Learning | Cloud Computing

No responses yet

Write a response