Harddisk, format and then add?

Simen Musaeus

New Member
Sep 20, 2017
9
0
1
54
I'm trying to assign disposable storage, that would be a harddisk that is only used for a given session, and deleted upon vm shutdown.

Is it possible to create and format a harddisk, say to NTFS (for windows), without entering the virtual machine?

I would really like to avoid having to enter and format the disk each time I start a new session.
 
Is it possible to create and format a harddisk, say to NTFS (for windows), without entering the virtual machine?


Yes, the easiest way is to create a virtual disk in "raw" format, define it afterwards as loop device, e.g.

Code:
losetup /dev/loop1 /storage/images/vm-100-disk-1.raw

and format it then according to your needs. Before starting the VM disable the loop device

Code:
losetup -d /dev/loop1

Works in case of an currently idle VM.

In case of an already running VM which supports disk hotplug it may work too, but it's recommended to remove the disk from the VM for the process of formatting and join it afterwards again.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!