3 # Provides: expand-root
8 # Default-Start: 2 3 4 5
10 # Description: Expand the filesystem of the mounted root volume/partition to its maximum possible size
14 logger
="logger -t $prog"
18 hash $growpart 2> /dev
/null ||
{
19 $logger "$growpart was not found on PATH. Unable to expand size."
23 root_device_path
="/dev/sda"
26 # Growpart can fail if the partition is already resized.
27 $growpart $root_device_path $root_index ||
{
28 $logger "growpart failed. Unable to expand size."
31 device_path
="${root_device_path}${root_index}"
32 filesystem
=$
(blkid
-s TYPE
-o value
${device_path})
36 ext2
) resize2fs
$device_path ;;
37 ext3
) resize2fs
$device_path ;;
38 ext4
) resize2fs
$device_path ;;
39 *) $logger "The filesystem $filesystem was not recognized. Unable to expand size." ;;