Oh interesting, thanks for the clarification. But when I add a new HDD to host, wipe disk, the drive doesn't show up when I try to passthrough the hdd to my VM.That will partition, format, mount and add the disk as a storage on the PVE node. Mounting a filesystem on the PVE host as well as via passthrough in a VM will corrupt data. So make sure never to mount a filesystem on the PVE host you want to passthrough. For LXC with bind-mounts a directory storage could be fine but I still would prefer to manually partition, format and mount those disks.
Depends..,Another question - I keep seeing the term "virtual disks". From my understanding all of this is virtualized? Or is this something else?
Depends..,
When using PCI passthrough of NVMe SSD or a HBA with disks attached to it, the VM will work directly with the real physical disks.
"Virtual disk" usually means there is an additional abstaction layer. You won't use physical disks or partitions but Zvols, LVs (thin or thick), qcow2 image files and so on and the guestOS will see an virtualized QEMU disk.
When using disk passthrough (qm set ...) this is something in between. It's actually also a virtual disk but this virtual disk isn't using some LVs, zvols or image files underneath it but it will map the virtual disk to the physical disk or partition. So still a virtual disk but thw data is read/written on block level to the physical device.
Thanks. After having a look through this, is there a way to limit the size of the disk? Or is it the whole drive or nothing?
You can partition the drive and passthrough only a partition.Thanks. After having a look through this, is there a way to limit the size of the disk? Or is it the whole drive or nothing?
I don't quite follow. From what I understand:You can partition the drive and passthrough only a partition.
You can also create a GPT and partition that disk in CLI using fdisk/parted/sgdisk and then only passthrough that partition. But I heard some people complaining that Windows doesn't like passthroughed partitions. But I had no problems when using linux guests.2. So that leaves do everything via cli. So wipe the HDD, and don't do anything else. Then in the host shell, I can pass it through to the VM via qm set 592 -scsi2 /dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F41BLC
Then on the VM, I can set up the partition table and filesystem.
Am I still misunderstanding?
Yeah this is a Ubuntu server VM. So if I am understanding, if I wanted to apply what I learned to my situation (14TB HDD):You can also create a GPT and partition that disk in CLI using fdisk/parted/sgdisk and then only passthrough that partition. But I heard some people complaining that Windows doesn't like passthroughed partitions. But I had no problems when using linux guests.
By the way...that disk is terrible...so terrible that it got its own wiki article to document all the people suing Seagate for how fast it fails. I also got 4 of them where 2 failed within the first 3 years running 24/7. I would highly recommend not to use that disk without raid for redundancy: https://en.m.wikipedia.org/wiki/ST3000DM001
Why minus 8GB? And no, I wouldn't format it on the host but format it on the guest OS after passing it through.2. In host, create the partition with a filesystem - I want to use a ZFS filesystem. So 14TB minus 8GB?
Why minus 8GB? And no, I wouldn't format it on the host but format it on the guest OS after passing it through.
Yes, but at best a few kilobytes and not gigabytes.Doesn't the partition table take some space?
1.) backup stuff on hat disk you want to keep and unmount the disk in case it is in useSorry, what is the sequence of steps you would do?
ls -la /dev/disk/by-id
and check what a free virtual disk identifier ("scsi1" etc) as well what protocol ("sata", "scsi", "ide", ...) should be used and what the VMID of that VM isThanksYes, but at best a few kilobytes and not gigabytes.
1.) backup stuff on hat disk you want to keep and unmount the disk in case it is in use
2.) do a secure_erase in case if it is a alreay used SSD so you start with a fresh and good performing factory resetted SSD that isn't leaking sensitive data that might still be on there
3.) create GPT/MBR using fdisk/parted
4.) create your partitions using fdisk/parted
5.) find out a unique identifier of that partition vials -la /dev/disk/by-id
and check what a free virtual disk identifier ("scsi1" etc) as well what protocol ("sata", "scsi", "ide", ...) should be used and what the VMID of that VM is
6.) passthrough that partition using "qm set ..."
7.) check and fix VMs boot order
8.) double check the partition doesn't get mounted via systemd/fstab/autofs on the next boot by the host and that the partition or disk isn't passthroughed to another VM
9.) start the VM
10.) format the partition via the guestOS
11.) mount the filesystem to the guestOS
12.) write down the command you used to passthrough that partition as a VM note so you can easily redo it in case you ever need to restore the VM from a backup (as it then has to be done again)
So everything is working. But for some reason 49GB out of the 7TB I assigned is used without anything being on there. Is this due to the filesystem? Or system reserved?Yes, but at best a few kilobytes and not gigabytes.
1.) backup stuff on hat disk you want to keep and unmount the disk in case it is in use
2.) do a secure_erase in case if it is a alreay used SSD so you start with a fresh and good performing factory resetted SSD that isn't leaking sensitive data that might still be on there
3.) create GPT/MBR using fdisk/parted
4.) create your partitions using fdisk/parted
5.) find out a unique identifier of that partition vials -la /dev/disk/by-id
and check what a free virtual disk identifier ("scsi1" etc) as well what protocol ("sata", "scsi", "ide", ...) should be used and what the VMID of that VM is
6.) passthrough that partition using "qm set ..."
7.) check and fix VMs boot order
8.) double check the partition doesn't get mounted via systemd/fstab/autofs on the next boot by the host and that the partition or disk isn't passthroughed to another VM
9.) start the VM
10.) format the partition via the guestOS
11.) mount the filesystem to the guestOS
12.) write down the command you used to passthrough that partition as a VM note so you can easily redo it in case you ever need to restore the VM from a backup (as it then has to be done again)
Hard to tell without knowing what filesystem was used and output of something likeSo everything is working. But for some reason 49GB out of the 7TB I assigned is used without anything being on there. Is this due to the filesystem? Or system reserved?
df -h
or fdisk -l
. But filesystem overhead wouldn't be uncommon.Hard to tell without knowing what filesystem was used and output of something likedf -h
orfdisk -l
. But filesystem overhead wouldn't be uncommon.
Apologies for bumping up this thread - hope it's not considering too old yet!Yes, but at best a few kilobytes and not gigabytes.
1.) backup stuff on hat disk you want to keep and unmount the disk in case it is in use
2.) do a secure_erase in case if it is a alreay used SSD so you start with a fresh and good performing factory resetted SSD that isn't leaking sensitive data that might still be on there
3.) create GPT/MBR using fdisk/parted
4.) create your partitions using fdisk/parted
5.) find out a unique identifier of that partition vials -la /dev/disk/by-id
and check what a free virtual disk identifier ("scsi1" etc) as well what protocol ("sata", "scsi", "ide", ...) should be used and what the VMID of that VM is
6.) passthrough that partition using "qm set ..."
7.) check and fix VMs boot order
8.) double check the partition doesn't get mounted via systemd/fstab/autofs on the next boot by the host and that the partition or disk isn't passthroughed to another VM
9.) start the VM
10.) format the partition via the guestOS
11.) mount the filesystem to the guestOS
12.) write down the command you used to passthrough that partition as a VM note so you can easily redo it in case you ever need to restore the VM from a backup (as it then has to be done again)