Reference: Adding a New Disk Drive to an Ubuntu System

This tutorial assumes you have added a new, blank disk to your Linux Ubuntu VM (e.g., see Add Drive to VM). When you restart your VM after adding the new disk, get into a Terminal and use the command

ls /dev/sd*

to list all system devices and partitions. In the output below, sda (think 'system device a') has three partitions (sda1, sda2, sda3) but sdb (the new disk in this case) does not have any partitions.

To create the partition use the command (it will need sudo) fdisk /dev/sdb (but use what ever system device that is the new hard disk instead of sdb if it is different). In fdisk, use n to create a new partition on the device, then p to make it a primary partition; pressing Enter (marked with X below) at the prompts for Partition number, First sector, and Last sector to accept defaults (which make this the first partition on the drive and allocates all space to this partition). Then use w to write these changes; fdisk will exit after this command.

Using ls /dev/sd* again will show the new disk (sdb here) has one partition (sdb1).

A package xfsprogs needs to be installed if it hasn't been already so use

sudo apt-get install xfsprogs

to install it. Then sudo mkfs.xfs /dev/sdb1 will create an xfs file system on the partition.

To be accessible a 'mount point' for the new disk needs to be created. The following commands make the sdb1 partition available via the directory /NewVolume.

The df command shows file space within the Ubuntu machine; the last line (in this case) shows that nearly all the space on /dev/sdb1 is available on the mount /NewVolume.

As a default, elevated credentials (i.e., root via sudo) are needed to create or change files on the new volume but it is available to hold additional files.

When you shutdown / start or reboot your Ubuntu VM, mounting of (in this case) /NewVolume will be lost. To make this mounting permanent, change the /etc/fstab file to include mounting the new disk volume. Use sudo nano /etc/fstab and add the line indicated below: