Increase or Decrease the Size of Static Partition in Linux

Linux Partition:

  • multiple operating systems on the same disk.
  • different file systems on different partitions.
  • more efficient disk space management.
  • different security settings on different partitions.
  • easier backup procedure.

Task Description:

Step 1: Add one Hard Disk to the VM

fdisk -l

Step 2: Create one Primary partition of 30GiB

fdisk /dev/sdb

Step 3: Format the partition and mount it with some directory

mkfs.ext4 /dev/sdb1

mount /dev/sdb1 /data

df -h

Step 4: Put some data in the directory

Step 5: Unmount the partition from the /data folder.

umount /dev/sdb1

Step 6: Create the existing partition

Step 7: Create that partition again with the changed size

Step 8: Verify partition consistency with the e2fsck command

e2fsck -f /dev/sdb1

resize2fs /dev/sdb1

Step 9: Mount the resize volume and check the data

Thank You !!



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
Aditya Raj

Aditya Raj

I'm passionate learner diving into the concepts of computing 💻