Skip to content

Instantly share code, notes, and snippets.

@omarmciver
Created July 18, 2022 16:01
Show Gist options
  • Save omarmciver/851075d9c76db0010d7bb3b9b11e4609 to your computer and use it in GitHub Desktop.
Save omarmciver/851075d9c76db0010d7bb3b9b11e4609 to your computer and use it in GitHub Desktop.
Resize Linux Partition #shell
#Find the name of your disk:
df -Th
#Unmount the disk (in this example it's "sdc1")
sudo umount /dev/sdc1
#Call the interactive 'parted' command
sudo parted /dev/sdc
#1. Type "print" and note the size of the disk
#2. Type "resizepart"
# A. Type the partition number
# B. Type the size from the "print" command to make a full-size partition
#3. Type "quit" to exit
#Clean up any errors and check the consistency
sudo e2fsck -f /dev/sdc1
#Resize the file system, finally
sudo resize2fs /dev/sdc1
#Remount the disk
sudo mount /dev/sdc1 /data #or whatever you want to call it
#Check to make sure it worked
df -h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment