Making Static Partition as Dynamic Partition

By: adyraj

Static (Fixed) Partitioning:
This is the oldest and simplest technique used to put more than one processes in the main memory. In this partitioning, number of partitions (non-overlapping) in RAM are fixed but size of each partition may or may not be same. As it is contiguous allocation, hence no spanning is allowed. Here partition are made before execution or during system configure.

Let’s Begin :)


Add new hard disk to the system .

# fdisk -l

In my system I have added a hard disk of 5GB.


Now we have to create a new partition in the hard disk . For this run:

 # fdisk <HD_Name>   ### In this case /dev/nvme0n2

Creating a new partition :

Here ‘n’ is used for new partition,

‘p’ for primary partition type, 1 partition number,

start size used as default 2048 and size is given as +2G that is 2 Gb.

At the last use ‘w’ to write changes.


Format the newly created partition and mounting it to the folder /static.

#  mkfs.ext4 <Partition_name>  # Here Partition name is nvme0n2p1#  mount /dev/nvme0n2p1 /static  # static is mount point


Going to the partition directory and creating some files.

Creating files in /static directory


This is the main step in which we will increase the size of partition.

"unmount" the partition with:# umount <Partition_Name>


‘d’ is used for deleting the older partition ,

n’ again creating new partition,

‘p’ for primary type, +4G as we are making size as 4 Gb and

at last giving ‘N’ because it is asking for removing previous signature.

If we give yes ‘Y’ for removing the signature than it will delete the previous Inode table and will create a new one and whole data that is stored previously will be removed. This is the significance of signature.


Now we will check for any errors if there in the partition and remove them.

# e2fsck -f /dev/nvme0n2p1

This time instead of mkfs.ext4 because this command will only format the newly added block of data and not the previous.

# resize2fs /dev/nvme0n2p1


Again mount the partition.

Yayy !! We have successfully increased the size of partition without any alteration of data.

The old data is already present in the partition and size is also increased.

Similarly we can decrease the size but the size should be more than that of the older data stored.


Here is the Python Automated Script for the above process:




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How Exotel is Making it Easy for Businesses to Comply with DLT Regulations

The Beginners Guide to Setting Up a Gatsby Blog

How to publish your GitHub pages on a domain

Implementing Logger in GO — GOLANG

How Boredom Led To The Creation Of Python

From TDD to BDD in Flutter — Part 2

Outlier Podcast Festival | Columbus — CANCELED

orbi login | | Netgear orbi login setup

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Prajwal Patil

Prajwal Patil

More from Medium

Guide to handle Crypto.js Encryption / Decryption in Apache JMeter

AWS DMS — Setup: Part 2

Deployment with Docker

Creating an S3 Bucket in AWS