Skip to content

Instantly share code, notes, and snippets.

@skylerspaeth
Last active February 18, 2025 21:44
Show Gist options
  • Save skylerspaeth/d99d4a26562a54f6b0f4c149b74f0213 to your computer and use it in GitHub Desktop.
Save skylerspaeth/d99d4a26562a54f6b0f4c149b74f0213 to your computer and use it in GitHub Desktop.
Passthrough Physical Hard Drives to TrueNAS Running in Proxmox

1) Create TrueNAS VM

Create a Proxmox VM for the drives to be mounted to and take note of its ID.

2) Determine Device IDs

Use fdisk -l to list all connected drives:

You'll see something like this:

Disk /dev/sda: 7.28 TiB, 8001563222016 bytes, 15628053168 sectors
Disk model: <COPY_THIS>
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: ...

Copy disk model and use it in the following command:

ls -l /dev/disk/by-id/ | grep <PASTE_HERE>

You'll see output like so:

lrwxrwxrwx 1 root root  9 Dec  7 21:59 ata-<MODEL>_<SERIAL> -> ../../sda
lrwxrwxrwx 1 root root  9 Dec  7 21:59 ata-<MODEL>_<SERIAL> -> ../../sdb

Take note of/copy the filename(s), for example ata-ABCD_1234.

3) Pass Each ID into VM

To actually pass the desired drives into the underlying QEMU VM, run the below command, incrementing the number in scsi1 for every additional drive. Ensure you update the device path to match the filename from above (both model and S/N), and update the serial= part with just the S/N (everything after _).

qm set 100 -scsi1 /dev/disk/by-id/ata-ABCD_1234,serial=1234

If it works as expected you should see output like this:

update VM 100: -scsi1 /dev/disk/by-id/ata-ABCD_1234

Back in the Proxmox UI, the VM's hardware tab should reflect the newly passed through drives: Screenshot 2024-12-08 at 4 32 13 AM

You should now be able to see and use these drives inside your VM. Удачи вам!

Credit

I would like to thank Robert Mizen for creating this great video on the process which I used to make this gist.

Check it out here: https://youtu.be/2mvCaqra6qY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment