While the VM is powered off , add a VDI (Virtual Disk Image) as shown below-
I have added a 20GB disk for the demo-
Power up the VM and login as root to perform the below tasks -
1. fdisk -l (to list the existing partitions)
The added disk has been detected as shown below
2. fdisk /dev/sdg (create a disk partition on the disk we attached)
Double check to see no partitions are created (p option to print partitions)
3. Create partition (using the same fdisk utility)
Following fdisk options used int he snapshot below-
n add a new partition
p to select primary partition (1-4)
w write table to disk and exit
To verify partition is created run the fdisk /dev/sdg with 'p' option to print the partitions.
4. Now that we have the partition /dev/sdg1 created its time we format the disk in ext4 filesystem as follows -
5. Go ahead and mount the filesystem !
6. To ensure the mount is persistent even after a reboot don't forget to update the /etc/fstab