How to increase Static Partition size❓

Yash Sankhla
3 min readMay 7, 2021

--

Getting confused🤔, cause I am saying static then how can it be increased. But it is possible, there is a way through which you can increase your static partition size. Wanna know that then below are the steps.

Step1: Checking available storage

In the storage /dev/sdb I have 10Gib completely unused so I am using this.

fdisk -l

Step2: Using the /dev/sdb device to create a partition.

fdisk /dev/sdb

Using this your terminal will land in the storage device where you can create & delete partition, &, etc things on that device. For first, I have created a partition of 4Gib in size. After that, I will show you how to increase it.

Note: Some storage cmds -

>p — To get details

>n — To create a partition

>w — Save created partitions & move out

Creating 4Gib partition
Saving partition table

So from the above steps, we got a partition of size 4Gib named /dev/sdb1.

Step3: Formatting & Mounting the partition

I have formatted using .ext4 type partition & mounted it on /static_part directory. Mounting can be confirmed also.

mkfs.ext4 /dev/sdb1 : To format

mount /dev/sdb1 /static_part : To mount

df -h : To conform mounting

Formatting Partition
Mounting partition

Step4: Adding data to the directory

Here I had created a file named test.txt and put some data on it so that I can check after increasing storage does it remains or not.

Now, let's start the process of increasing the storage size.

Step5: Unmounting partition

umount /dev/sdb1

Step6: Increasing Partition Size

In this, I have first deleted the pre-created partition then again create the partition from the same point as was before .up to 8Gib size.

Deleting old
Creating new from 2048 sector up to 8Gib
Saving the partition

Step7: Checking file system & Ressizing the partition

e2fcsk -f /dev/sdb1

resize2fs /dev/sdb1

Step8: Mouting agian

Mount the partition on the pre-created directory. After then if you see your data is still present in the directory.

Hope you understand, if you have any queries, please ping me → 🔗

Thank You for reading.

--

--

Yash Sankhla

ARTH Learner * Cloud * AI/ML/DL/NN * DevOps * Hadoop * Web Dev * DB-SQL & NoSQL* DSA * RHEL 8 * Image Processing * Languages — C, C++, Python