On Proxmox, you can add one or multiple hard drives to store different types of files (such as ISO images and virtual machines), but the process requires typing different commands in the Shell console before making it available to the server, and in this guide, you will learn how.
Although you can configure different types of storage configurations on Proxmox, the most common scenario would be connecting an internal SAS or SATA drive, and this process involves using the Shell to install the “parted” tool to set up the drive, create a mount point and mount the drive to the server, and then using the web interface to storage as directory and specifying the storage usage.
This guide will teach you the steps to add and configure a new storage drive to Proxmox.
Add storage drive to Proxmox
To add and configure a new storage drive on Proxmox, use these steps:
-
Select the server from the left navigation pane.
-
Click on Shell.
-
Type the following command to list the available drives and press Enter:
lsblk
Quick note: You may need to restart the server if the drive you added does not appear in the operating system. Also, make sure to note the name of the drive, which in this case is “sdb,” but yours may be different. -
Type the following commands to install the parted tool and press Enter:
apt policy parted apt install parted
Quick note: If the tool is already available, the commands won’t install anything. -
Type the following command to create a GPT partition table on the drive and press Enter:
parted /dev/sdb mklabel gpt
In the command, change “sdb” to the name that corresponds to your drive.
-
Type the following command to create a primary partition using the entire storage available and press Enter:
parted -a opt /dev/sdb mkpart primary ext4 0% 100%
In the command, change “sdb” to the name that corresponds to your drive.
-
Type the following command to confirm the partition name and press Enter:
lsblk
-
Type the following command to apply the ext4 filesystem to the partition and press Enter:
mkfs.ext4 -L StorageOne /dev/sdb1
In the command, change “sdb1” for the name that corresponds to your partition.
-
Type the following command to create a mount point on Proxmox and press Enter:
mkdir -p /mnt/data
-
Type the following command to open the “fstab” configuration to set the drive to mount automatically on reboot and press Enter:
nano /etc/fstab
-
Type the following line of code in the next available line inside the “fstab” file, press “Ctrl + O,” “Enter,” and “Ctrl + X” to save the changes and exit the text editor:
LABEL=StorageOne /mnt/data ext4 defaults 0 2
-
Type the following command to mount the drive and make it visible to the Proxmox server and press Enter:
mount -a
-
Click on Datacenter from the left navigation pane.
-
Click on Storage from the right side.
-
Click the Add button and select the Directory option.
-
Confirm the ID for the drive (as previously configured). For example,
StorageOne
. -
Confirm the Directory path (as previously configured). For example,
/mnt/data
. -
Confirm the Content type you will store inside the drive. (It’s a good idea to select all the available options.)
-
Click the Add button.
Once you complete the steps, the drive will be available under the (local) server on the left side. You can now use this storage to upload ISO files, create virtual machines, and more.