If you need to add an extra volume storage into an existing VBox VM, you can use VirtualBox for that.
- Stop your VM and go to Virtual Box – Storage
- Select the Controller: SATA and click the green plus icon to add a new disk
- Select the type and size
- Start your instance
-
Once it is running you have to format and mount the new disk, for this, as root run
fdisk –l or lsblk
This will let you discover the name of the extended volume. In this case it is /dev/sdb
- Format the volume with ext3, but be cautious to choose the right one
mkfs -t ext4 /dev/sdb
Then confirm with y
-
Now again as root, create a new directory, in my case
mkdir /u01
-
Mount the new volume into the previous directory
mount /dev/sdb /u01
-
Done, you can now cd to your new disk. However let’s change the ownership of this folder from root to citurria (or whatever user you chose)
chown citurria /u01
chgrp citurria /u01
-
Finally add your folder in /etc/fstab in order to make sure this gets mounted automatically. For this enter something like this:
/dev/sdb /u01 ext4 defaults 0 0
Alternatively, instead of /dev/sdb you can use blkid to name the UUID of your device – This is a much better way to refer to it.
I.e.
UUID=e757427b-b2ee-427c-92d2-d7df350111fb /u01 ext4 defaults 0 0
-
Log out as root and once back as citurria make sure you can cd into /u01 – Also run a df –h and confirm the size of /u01, it should be the 30GB that you originally set.