Increase or Decrease the Size of Static Partition in Linux
Kartik Arora
?? Innovative CTO Revolutionizing Technology Solutions for Drona. Let's Shape the Future Together! ?
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
Step 2: lets Create a Static Partition over it.
Lets quickly check partition is created or not
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.
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.
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
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.
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.
Now, we have to mount it again.
NOTE: we can mount it in the new folder also we get our older data their too.
That’s it All done, we have completed whole process now lets see did we able to retrieve oue data back or not!?
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!!