Skip to content

Instantly share code, notes, and snippets.

@jniltinho
Last active May 29, 2024 14:54
Show Gist options
  • Save jniltinho/e6d9a29010ed4355d671dbd188750a81 to your computer and use it in GitHub Desktop.
Save jniltinho/e6d9a29010ed4355d671dbd188750a81 to your computer and use it in GitHub Desktop.
Resize an ext4 partition from the command line.
#!/bin/bash
## Links
## Ubuntu|Debian
## https://unix.stackexchange.com/questions/137482/how-to-to-resize-an-ext4-partition-from-the-command-line
## https://stackoverflow.com/questions/23519797/how-to-export-import-existing-user-with-its-privileges
## mysqldump -uroot --extended-insert=FALSE --no-create-info mysql --tables user > users-db.sql
## mysqldump mysql --tables global_priv db > users-db.sql
## mysqldump --system=users > create-users.sql
## sed -i -r '/(root|debian|SET|LOCK|400|--)/d' users-db.sql
growpart /dev/sda 2
## CHANGED: partition=2 start=4096 old: size=105441280 end=105445376 new: size=409595871,end=409599967
resize2fs /dev/sda2
## resize2fs 1.44.1 (24-Mar-2018)
## Filesystem at /dev/sda2 is mounted on /; on-line resizing required
## old_desc_blocks = 7, new_desc_blocks = 25
## The filesystem on /dev/sda2 is now 51199483 (4k) blocks long.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment