Increase or Decrease the Size of Static Partition in Linux

Increase or Decrease the Size of Static Partition in Linux

Myth Around us that we cann't increase or decrease the Size Static Partition or if we do we loose our data inside partition. So, Is There Any why to resize data without loosing data? Yes, There is a way to do so. Follow the below Steps:

Step 1: Attach External HardDisk

No alt text provided for this image

Step 2: lets Create a Static Partition over it.

No alt text provided for this image

Lets quickly check partition is created or not

No alt text provided for this image

Step 3: Now, Lets Format The Partition and after Successfully formatting the partition we have to mount the partition over directory to used the space of partition. 

No alt text provided for this image

Now we have successfully created the Static Partition of 5 GiB but if want to Increase it to 8 GiB without losing data then we have to follow below steps:

Step 4: Before moving forward i have created a file with name partition.txt with “Hello Everyone!!” to proof that after increase the size of static partition data remains. 

No alt text provided for this image

Step 5: Now we are going to delete the old partition of 5 GiB and Create a new Partition of 8 GiB in the Same HardDisk.

NOTE: Before Deleting Old Partition First unmount the Partition From The folder

No alt text provided for this image

Step 6: Now we have created new partition but our data is not retrieve. So, to retrieve the data first, we have to use “e2fsck -f <Device_Name>” command To repair the HardDisk Partition Table.

No alt text provided for this image

Step 7: After repairing the harddisk now we have to format the remaining partition as we have already partitioned the 5GiB and to use more 3GiB then we have to format that part first.

But now to format remaining space we have to use “resize2fs <Device_Name>” command.

No alt text provided for this image

Now, we have to mount it again.

NOTE: we can mount it in the new folder also we get our older data their too.

No alt text provided for this image

That’s it All done, we have completed whole process now lets see did we able to retrieve oue data back or not!?

No alt text provided for this image

As we can see in the above ScreenShot we get out Data back. So, hence prove we can Increase or Decrease the Size of Static Partition in Linux.


Thank you

Hope you All Find This Helpful!!

要查看或添加评论,请登录

Kartik Arora的更多文章

社区洞察

其他会员也浏览了