I have a Ubuntu box running in virutualbox as a local development environment. It’s very handy for exploring some new tools or working on some side projects. It has been working well for quite a long time until I recently noticed that the disk space is almost used up. So I decided to add one extra disk to it. That sounds really easy with VirtualBox, righ?
This is what I did:
- Shutdown the vm
- Create a new disk in VirtualBox Manager and assign it to the Ubuntu vm.
- Start the VM, but surprisingly that the newly added disk didn’t show up when I run
After some google search, I realized that I need to format the disk and mount it to Ubuntu file systems, so here is what needed:
sudo fdisk -l, to list all available disks, and the newly added disk should be in it. In my case, it’s
sudo fdisk /dev/sdb, and follow the prompts to format the disk
sudo mkfs.ext4 /dev/sdb1to format the disk to
sudo mkdir /disk2as the mount point
/etc/fstaband add a line like:
dev/sdb1 /disk2 ext4 defaults 1 2
- restart and the disk should be available to use.