After adding a New Disk from the Storage menu to your Virtual Machine, you will need to partition, format and mount the disk before you can use it.
Step 1 - check if the disk is recognized and find the disk name:
lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINT
The command will return something similar, where vda is the name of our new disk:
If FSTYPE is empty it means the disk is not formatted yet. (Command for this in step 3)
Step 2 - partition the disk using fdisk:
sudo fdisk /dev/vda
-
Press n (New partition)
-
Choose Primary and Partition Number (default 1)
-
Press Enter to accept the full disk size.
-
Press w to write changes.
Step 3 - format as ext4 type:
sudo mkfs.ext4 /dev/vda1
Step 4 - mount the disk and make it persistent:
# make a new dir mounting point
sudo mkdir /mnt/newdisk
# mount the disk to the previuosly receated mount point
sudo mount /dev/vda1 /mnt/newdisk
# verify the new mount point
df -h | grep /mnt/newdisk
Step 5 - make it persistent on reboots:
echo "/dev/vda1 /mnt/newdisk ext4 defaults 0 0" | sudo tee -a /etc/fstab