Increase or Decrease the Size of Static Partition in Linux.

Increase or Decrease the Size of Static Partition in Linux.


To increase the size of static partition:

Step1: Create a partition (say of 2Gb)

Step2: Format(ext4) it and mount a folder (say lw) to it

Step3: Create file and store in that partition.

Step4: Unmount folder

Step5: Delete the created partition and save the settings

 Step6: Create new partition of size bigger than that of previous one(say 4Gb)

Step7: Now use “e2fsck -f /dev/sdb1”

This command checks the filesystem(ext2,ext,3,ext4), if error is there like OS shutdown abruptly then, our inode table might have some garbage/bad block. hence this command will remove all of them. 

Step8: Now use “resize2fs /dev/sdb1”

This command format(create filesystem like ext4) the remaining volume added to the partition i.e. 4-2=2.

Step9: Now mount the previously mounted folder i.e. lw.

We will see that our previously created file and its data is present in it!!!

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image


To decrease the size of static partition:

Step1: Create a partition (say of 4Gb)

Step2: Format(ext4) it and mount a folder (say aaa) to it

Step3: Create file and store in that partition.

Step4: Unmount folder

Step5: use "e2fsck -f " on partition(eg. e2fsck -f /dev/sdb1)

this command will basically clear all the garbage/bad blocks from inode table

Step6: use "resize2fs" command to reformat the partition with new size(say 2Gb) and not loosing the data. Basically we are just updating the inode table (eg. resize2fs /dev/sdb1 2G)

Step7: again mount the partition

We will see our data is not lost!!!

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image


Feeling blessed to have Such hardworking Team..!!! 💯💯

To view or add a comment, sign in

More articles by Ayush Ganatra

  • Event-Driven Architecture Demystified

    As engineers, we often read about architecture patterns like Saga, Outbox, or Change Data Capture (CDC). But theory…

    6 Comments
  • Privilege Escalation: Lets know the Hidden Danger.

    Introduction: Containers have revolutionized the way we build, ship, and run applications. They provide a lightweight…

  • Authentication ~ A custom Usecase & a different approch

    hase 1 :The Usecase Hey folks, Recently I came across a very unique & interesting AWS architectural usecase & trust me…

    4 Comments
  • Dynamic Rendering ~ A BOON!!!

    The SEO Score: - SEO has potential to make a major impact on company’s most important goals, like sales & leads. Let…

    4 Comments
  • OpenSCAP ~ Let me check

    “Anyone who stops learning is old, whether at twenty or eighty. Anyone who keeps learning stays young.

    4 Comments
  • What’s inside the Pod??

    Container has brought the revolutions in technical area. Seriously one of the most stunning yet simplest technology…

    12 Comments
  • Kafka Message Queue in a Nutshell

    In this blog we will see: What is Kafka ? Kafka as Message Queue Installation Demo(with cli & python script) Industry…

    2 Comments
  • GAN(Advance DL concept)

    In this blog I will explain GAN(one of the advance DL/ML concept) & it’s code from scratch with an example. In single…

    10 Comments
  • Image segmentation based on K-means algorithm

    What is K-Means ?? Kmeans algorithm is an iterative algorithm that tries to partition the dataset into Kpre-defined…

  • OSPF Protocol implementing Dijkstra’s Algorithm

    Router works on third layer of our OSI model. OSPF (Open Shortest Path First) is a routing protocol.

    2 Comments

Others also viewed

Explore content categories