Created
March 2, 2026 22:58
-
-
Save okurka12/3c83533d1e67d9858f9bcbeb9950a7ca to your computer and use it in GitHub Desktop.
grow ext4 filesystem after growing the virtual hard drive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Created 2026-03-02 | |
| # Debian 13 Trixie | |
| # | |
| # install parted | |
| sudo apt update && sudo apt install parted | |
| # list partitions | |
| # expected output: | |
| # NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS | |
| # sda 8:0 0 80G 0 disk | |
| # ├─sda1 8:1 0 31G 0 part / | |
| # ├─sda2 8:2 0 1K 0 part | |
| # └─sda5 8:5 0 975M 0 part | |
| lsblk | |
| # turn off swap and delete swap partitions | |
| sudo swapoff -a | |
| sudo parted /dev/sda rm 2 | |
| # resize partition (leave some space for swap partition) | |
| sudo parted /dev/sda resizepart 1 78GiB | |
| # resize filesystem | |
| sudo resize2fs /dev/sda1 | |
| # create swap partition | |
| sudo parted /dev/sda mkpart extended 79GiB 100% | |
| sudo parted /dev/sda mkpart logical linux-swap 79GiB 100% | |
| # format and enable swap | |
| sudo mkswap /dev/sda5 | |
| sudo swapon /dev/sda5 | |
| # find out new uuid | |
| sudo blkid /dev/sda5 | |
| # put new uuid in fstab | |
| sudo nano /etc/fstab |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment