Resize VirtualBox Disk

Resizing a box in Virtualbox / Vagrant

Go to root

sudo su -

Install Parted

apt-get install parted

Switch Swap off

swapoff -a

Start Parted

parted

see what we have

print all

Print All output

(parted) print all                                                        
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 
Number  Start   End     Size    Type      File system     Flags
 1      1049kB  10.1GB  10.1GB  primary   ext4            boot
 2      10.1GB  10.6GB  484MB   extended
 5      10.1GB  10.6GB  484MB   logical   linux-swap(v1)

Remove our partitions

rm 2
rm 5

Resize our partition and follow the wizard

resizepart

Now make the partitions we deleted as extended

mkpart
quit

Now resize the partition

df -h
resize2fs /dev/sda1
df -h

Provision Vagrant

vagrant halt
vagrant up --provision

 

Gareth
Buy Me A Coffee
back arrowBack to Index