Expanding GNS3VM Disk Space

So you’ve been labing things up like a mad man on your GNS3 server and you’ve finally ran out of room on your GNS3VM. Be not dismayed, follow the guidance below and you’ll be up and running in no time.

From within your hypervisor management interface, power off the GNS3VM and expand the disk as needed (I expanded mine from 100GB > 300GB). Save and power your GNS3VM back up. Now console or ssh into the GNS3VM and launch the ‘Shell’ from within the GNS3VM console menu. Once at the shell execute the following commands to get the underlying Ubuntu OS to recognize the newly added disk space:

# Switch to root
sudo su

# Run 'parted' on the appropriate disk (most likely sdb)
parted /dev/sdb

# Once inside the parted utility CLI expand the disk
(parted) resizepart 1
Warning: Partition /dev/sdb1 is being used. Are you sure you want to continue?
Yes/No? yes                                                               
End?  [322GB]? 100%
(parted) quit

# Run the resize2fs utility to expand the filesystem to consume the newly added disk space

resize2fs /dev/sdb1

# Reboot

# Verify the new disk space has been added
df -h

Filesystem      Size  Used Avail Use% Mounted on
udev             32G     0   32G   0% /dev
tmpfs           6.3G  8.9M  6.3G   1% /run
/dev/sda1        20G  5.3G   13G  29% /
tmpfs            32G     0   32G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            32G     0   32G   0% /sys/fs/cgroup
>>/dev/sdb1       295G   93G  190G  33% /opt
tmpfs           6.3G     0  6.3G   0% /run/user/1000