In this video, I’ll guide you through the process of increasing storage on your Proxmox virtual machine (VM) with two effective methods. Whether you’re running low on space or looking to optimize your setup, these approaches will help you expand your storage with ease:
Approach 1: Partitioning a Drive for Multiple VMs
Learn how to allocate only a portion of a drive to your VM. This method is ideal if you have a single drive that you want to share among multiple VMs, allowing you to incrementally expand storage for each VM.
Approach 2: Assigning a Whole Drive to One VM
Discover how to dedicate an entire drive to a single VM. This approach is perfect if you need substantial storage capacity for large data sets or plan to use the drive for a NAS setup with software like Open Media Vault.
Follow this step-by-step guide to efficiently manage and enhance your VM storage!
If you find this video helpful, please give it a thumbs up, share it with others, and subscribe to my channel for more tech tutorials!
Commands used in this video
In approach 1, all initial work is done within the GUI of Proxmox. Commands to create the filesystem, etc are further down on this post.
In approach 2 you will need to identify the drive you want to use within the proxmox node with the following command
lsblk
You will need to create a new partition in the command prompt/shell of the Proxmox node with the following command
cfdisk /dev/<drive ID from above>
- Select ‘gpt’ as the label
- Select ‘New’ to create a new partition, and take the full disk space it suggests
- Select ‘write’ and type ‘yes’ to write the details to the drive
- Select quit to exit the cfdisk program. It is also a good idea to type ‘lsblk’ again after this to make sure all your partions were created correctly
List the UUIDs of all the devices to get the UUID of the partition you need to pass into your VM with this command
blkid
Run the following command to attach the partition to the VM
qm set <VM ID> -sata# /dev/disk/by-partuuid/<UUID from above>
- ‘VM ID’ represents the ID number of your proxmox VM
- ‘#’ represents the drive number. Start at 0 and go up for each drive. Do not use 0 if that is already in use by the VM boot drive
- ‘UUID’ represents the ID of the drive that you wll be passing into the VM. It is found with the command ‘blkid’
Reboot your VM for the changes to take effect
sudo reboot
Create the filesystem and mount the drive: For both approaches you will need to create a partition for the storage that was passed in, create the filesystem (ext3 or ext4), and mount the filesystem to a mount point. The following commands are used for this
Identify the drive that you would like to partition with this command
lsblk
create a new partition with the following command and steps within the fdisk program
sudo fdisk /dev/<drive>
- <drive> is the drive you want to partition such as sdb, sdc, etc
In the fdisk program you can issue the following commands to create the partition
n - to create the new partition
p - within the 'n' option to create a primary parition
enter through the options to create a partition that is the full size
w - to write the changes that you mad
You will now need to create the filesystem. To do that, issue the following command. Note that it will take a while and look like nothing is happening, so be patient (especially if you have a large drive)
For an ext4 file system use the following where <partition> represents the partition number such as sdb1, sdc1, etc. from the command ‘lsblk’
sudo mkfs.ext4 /dev/<partition>
For an ext3 file system use the following where <partition> represents the partition number such as sdb1, sdc1, etc, etc. from the command ‘lsblk’
sudo mkfs /dev/<partition>
We now need to create a mount point (directory) where we will mount the filesystem that we just created so that you can use it. Create a new directory where it makes sense for you. I created a directory called /media/usb, but you can call it whatever works for you
sudo mkdir /media/usb
To automatically have the filesystem reboot you will need to update your fstab file using the follwoing command and line within the file
sudo nano /etc/fstab
within the file you will need to add the following line based on your setup. I have mine that was used in the video as an example
Format is as follows
<path to filesystem> <mountpoint> ext4 defaults 0 0
Note: if you did ext3 as your filesystem use this:
<path to filesystem> <mountpoint> ext3 defaults 0 0
Mine as an example:
/dev/sdb1 /media/usb ext4 defaults 0 0
Reboot and then check that the filesystem was properly mounted with this command
df -h <mountpoint>
You should see the full space that you set up returned. Good luck with your new setup!