### Create Filesystem and Mount After Reboot Source: https://github.com/cloud-team/cloud-initramfs-tools/blob/debian/unstable/growroot/doc/example.txt After the instance reboots with the new partition table, this creates a new filesystem on the modified partition and mounts it. This step is necessary before cloud-init can resize the root filesystem. ```bash sudo mkfs.ext3 /dev/sda2 -L HIMOM sudo mount /dev/sda2 /mnt sudo rsync -a /etc /mnt/ ``` -------------------------------- ### Enable Growroot and Trigger ResizeFS Source: https://github.com/cloud-team/cloud-initramfs-tools/blob/debian/unstable/growroot/doc/example.txt Removes the growroot disable flag and the cloud-init resizefs semaphore to allow growroot to resize the root partition on the next boot and for the filesystem to be resized. ```bash sudo rm /etc/growroot-disabled sudo rm /var/lib/cloud/instance/sem/config-resizefs sudo reboot ``` -------------------------------- ### Define and Apply New Partition Table Source: https://github.com/cloud-team/cloud-initramfs-tools/blob/debian/unstable/growroot/doc/example.txt Creates a new partition table definition in a file and then applies it to the disk using sfdisk. This operation can destroy existing filesystems on modified partitions. ```bash cat > rewrite.txt < console.out sudo grep GROW console.out ``` ```bash GROWROOT: CHANGED: partition=1 start=63 old: size=2883585 end=2883648 new: size=9999937,end=10000000 ``` ```bash sudo sfdisk -uS ${CHS} /dev/sda -d ``` ```bash # partition table of /dev/sda unit: sectors /dev/sda1 : start= 63, size= 9999937, Id=83 /dev/sda2 : start= 10000000, size= 9441649, Id=83 /dev/sda3 : start= 19441649, size= 1587215, Id=82 /dev/sda4 : start= 0, size= 0, Id= 0 ``` ```bash df -h /dev/sda1 /dev/sda2 ``` ```bash Filesystem Size Used Avail Use% Mounted on /dev/sda1 4.7G 582M 3.9G 13% / /dev/sda2 4.5G 143M 4.1G 4% /mnt ``` -------------------------------- ### Prepare for Growroot and Reboot Source: https://github.com/cloud-team/cloud-initramfs-tools/blob/debian/unstable/growroot/doc/example.txt Disables the growroot functionality for the current boot and reboots the instance. This ensures the kernel reads the new partition table without growroot attempting to resize partitions immediately. ```bash sudo touch /etc/growroot-disabled sudo reboot ``` -------------------------------- ### Dry Run Partition Growth Source: https://github.com/cloud-team/cloud-initramfs-tools/blob/debian/unstable/growroot/doc/example.txt Simulates the growth of a partition without making actual changes to the disk. This is useful for verifying the intended outcome of a partition resize operation. ```bash sudo growpart --dry-run /dev/sda 1 ``` ```bash CHANGE: partition=1 start=63 old: size=2883585 end=2883648 new: size=9999937,end=10000000 ``` ```bash # === old sfdisk -d === # partition table of /dev/sda unit: sectors /dev/sda1 : start= 63, size= 2883585, Id=83 /dev/sda2 : start= 10000000, size= 9441649, Id=83 /dev/sda3 : start= 19441649, size= 1587215, Id=82 /dev/sda4 : start= 0, size= 0, Id= 0 ``` ```bash # === new sfdisk -d === # partition table of /dev/sda unit: sectors /dev/sda1 : start= 63, size= 9999937, Id=83 /dev/sda2 : start= 10000000, size= 9441649, Id=83 /dev/sda3 : start= 19441649, size= 1587215, Id=82 /dev/sda4 : start= 0, size= 0, Id= 0 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.