How to add a disk in qcow2 format to a VM in Proxmox VE

One of my followers was watching my YouTube video on ‘How to add an additional hard disk to a VM in Proxmox VE‘ and asked me how he can add a disk in qcow2 format to a VM in Proxmox VE. In this post, I will show you how to do this step-by-step.

How to add a disk in qcow2 format to a VM in Proxmox VE
How to add a disk in qcow2 format to a VM in Proxmox VE – Gulian Technology

Storage types

In Proxmox Virtual Environment you can have two storage types:

  1. File level storage;
  2. Block level storage.

Here’s an excerpt from the Proxmox PVE documentation:

File level storage
File level based storage technologies allow access to a fully featured (POSIX) file system. They are in general more flexible than any Block level storage (see below), and allow you to store content of any type. ZFS is probably the most advanced system, and it has full support for snapshots and clones.

Block level storage
Allows to store large raw images. It is usually not possible to store other files (ISO, backups, ..) on such storage types. Most modern block level storage implementations support snapshots and clones. RADOS and GlusterFS are distributed systems, replicating storage data to different nodes.

DescriptionPlugin typeLevelSharedSnapshotsStable
ZFS (local)zfspoolbothnoyesyes
Directorydirfilenonoyes
BTRFSbtrfsfilenoyestechnology preview
NFSnfsfileyesnoyes
CIFScifsfileyesnoyes
Proxmox Backuppbsbothyesn/ayes
GlusterFSglusterfsfileyesnoyes
CephFScephfsfileyesyesyes
LVMlvmblocknonoyes
LVM-thinlvmthinblocknoyesyes
iSCSI/kerneliscsiblockyesnoyes
iSCSI/libiscsiiscsidirectblockyesnoyes
Ceph/RBDrbdblockyesyesyes
ZFS over iSCSIzfsblockyesyesyes

You can see what type of storage you have on your Proxmox VE from the GUI (graphical user interface) or from checking the configuration file for your Proxmox VE server.

Check storage type from GUI

Go to Datacenter – > pve -> local (pve) – > Summary

Check storage type
File level storage
Block level storage
Block level storage

Check storage type from the configuration file

By default, the storage configuration for your Proxmox VE is located in the file storage.cfg.

You can find this file in the /etc directory. Below you can find the storage configuration for my Proxmox VE server.

default storage configuration file
default storage configuration file
root@pve:~# cat /etc/pve/storage.cfg 
dir: local
	path /var/lib/vz
	content backup,vztmpl,iso

lvmthin: local-lvm
	thinpool data
	vgname pve
	content images,rootdir

lvm: vm-disks
	vgname vm-disks
	content rootdir,images
	nodes pve
	shared 0

dir: filebasedstorage
	path /mnt/pve/filebasedstorage
	content iso,vztmpl,snippets,images,backup,rootdir
	is_mountpoint 1
	nodes pve

root@pve:~# 

In my environment, I have both types of storage: file level storage and block level storage.

The file level storage:

dir: local
	path /var/lib/vz
	content backup,vztmpl,iso

dir: filebasedstorage
	path /mnt/pve/filebasedstorage
	content iso,vztmpl,snippets,images,backup,rootdir
	is_mountpoint 1
	nodes pve

The block level storage:

lvmthin: local-lvm
	thinpool data
	vgname pve
	content images,rootdir

lvm: vm-disks
	vgname vm-disks
	content rootdir,images
	nodes pve
	shared 0

Image format

In Proxmox VE, you can work/have three image formats.

Raw – “the raw disk image is a bit-to-bit image of a hard disk, similar to what you would get when executing the dd command on a block device in Linux.”

raw disk image
raw disk image

Qcow2 – “the QEMU image format is a copy on write format which allows snapshots, and thin provisioning of the disk image.”

qcow2 image format
qcow2 image format

VMDK – “the VMware image format only makes sense if you intend to import/export the disk image to other hypervisors.”

vmdk image format
vmdk image format

Add a new disk in qcow2 format to a VM in Proxmox VE

In order to add a new disk to an existing VM in the qcow2 image format, you need to have file level storage attached to your Proxmox VE server. This type of storage gives you the possibility to add a new disk in the either raw or qcow2 image format. If you have only block level storage, you will be able to add a new disk only in the raw image format.

To add a new hard disk, select your VM. Go to the Hardware tab and press the Add button.

Add new hard disk
Add new hard disk

Select the file level storage from the Storage field.

Select file level storage type
Select file level storage type
qcow2 image format

Confirm that the new hard disk is of qcow2 image format.

confirm the type of the new hard disk
confirm the type of the new hard disk
vm-106-disk-0.qcow2
vm-106-disk-0.qcow2

Confirm from within the VM that the new disk was added

The last step is to confirm from within the VM that the new hard disk was added to the VM and is visible from the operating system.

Before adding the new hard disk to the VM:

lsblk output before adding the new hard disk
lsblk output before adding the new hard disk

After adding the new hard disk to the VM:

lsblk output after adding the new hard disk
lsblk output after adding the new hard disk

That’s it! You have learned how to add a disk in qcow2 format to a VM in Proxmox VE. If you found this blog post helpful, please like and subscribe for more tutorials.

Processing…
Success! You're on the list.

Leave a Reply