Increase Or Decrease The Size Of Static Partition in Linux.

Mayuk Das
4 min readMar 15, 2021

--

Hello Everyone Today I am Going To Perform A Static Partition In Linux.

For This Practical We Need A Hard Disk Of Any Gib Here I Used 20Gib Size.

Using fdisk -l command we will able to see all the hard disk connected to our system.

Creating a static partition of attached disk

For creating a static partition in attached disk

n -> for creating new partition

p -> creating primary partition

w -> for saving partition

Now , we’ll press ‘p’ to give the partition we want to create means like here I am giving +5Gib and saving the partition by w.

Formatting the partition that we have created

Using mkfs.ext4 /dev/sdb1 command for formatting

Mounting the partition created

Creating a directory by mkdir command and naming static

e.g. mkdir /static

after this we check whether the directory is created or not by using a command df -h

Now , Creating a file inside the directory.

created a file name called st.txt in the static directory.

As we have done the pre-requisite so going to the task

Let see how to increase the size of static partition.

we have to unmount the partition by command called umount

umount /dev/sdb1

using df -h to see whether unmounted or not

after unmounting we delete the partition by

d -> delete the command

w -> save the command

Now my requirement is that I need to increase the static partition by 1Gib so I add a new partition of 6Gib.

Creating new partition

fdisk /dev/sdb

n -> for creating new partition

p -> creating primary partition

w -> for saving partition

Now , we’ll press ‘p’ to give the partition we want to create means like here I am giving +6Gib and saving the partition by w.

Now , conforming that partition of 6Gib has been created or not by command called fdisk -l,

Format the extended part of partition.

Checking any problem occurred or not.

Command -> e2fsck -f /dev/sdb1

Resizing the partition by using resize2fs /dev/sdb1

Mounting the created partition on the same folder

Command -> mount /dev/sdb1 /static

after mounting partition checking size increased or not by df -h

therefore partition has mounted a size nearly of 6Gib.

Checking previous file exists or not

For that I go into the static directory

So I found my file inside the same directory

Also my data still exits in the file and the file exits in the directory.

FROM Mayuk Das

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

--

--

Mayuk Das
Mayuk Das

No responses yet

Write a response