TSF – Giải pháp IT toàn diện cho doanh nghiệp SMB | HCM

Disk Passthrough Guide – Assign a Disk to Your Virtual Machine Proxmox 9

Discover the easiest way to assign a physical disk to your Proxmox virtual machine with Disk Passthrough in PVE 7.2. This guide covers all the steps to safely attach a raw disk to your VM without data loss. Improve your VM storage performance and manage disks like a pro. Whether you run home labs or production servers, disk passthrough is a game-changer. Learn how to configure your VM, identify the correct physical disk, and set it up in Proxmox. Avoid common mistakes that can corrupt VM data or prevent booting. This tutorial is perfect for both beginners and experienced Proxmox users. Watch now and take control of your VM storage efficiently!

Passthrough disk means assigning a physical disk or storage device directly to a VM (virtual machine), the VM will directly manage that disk as if it were an internal physical disk.

➤ For example: assign the entire /dev/sdc drive to VM ZFS, TrueNAS, or Windows so that the VM can automatically create partitions, RAID, etc.

1.1.1. Objectives


• Proxmox A: Install VM Windows 10 (or any other operating system) with drive C (operating system).
• Assign an additional physical disk /dev/sdb (passthrough) → VM sees drive D:
• Save data on drive D:
• Later, if Proxmox A fails, move /dev/sdb to Proxmox B
• Create a new VM → passthrough /dev/sdb → VM still sees drive D: and data is intact
________________________________________


1.1.2. Steps to Passthrough a Physical Disk (eg: /dev/sdb) for a VM on Proxmox


🔹 Step 1: Identify the drive you want to passthrough

On Proxmox A:
lsblk -o NAME,SIZE,MODEL

Example:
sda 100G SCSI0 (SSD, OS Proxmox)
sdb 70G SATA0 (HDD, want to passthrough)

Very important: Do not use /dev/sdb because this name can change between boot times. Should use by fixed ID:
ls -l /dev/disk/by-id/

Find the correct drive, for example:
/dev/disk/by-id/ata-WDC_WD5000AAKX-00ERMA0_WD-WCC2EJ7XXXXX

/dev/disk/by-id/ata-QEMU_HARDDISK_QM00005
_______________________________________
🔹 Step 2: Adjust VM config to passthrough disk


Suppose:
• VM ID: 100 Win10
• Disk ID path: /dev/disk/by-id/ata-QEMU_HARDDISK_QM00005

Edit configuration file:
nano /etc/pve/qemu-server/100.conf

Add the following line to assign the physical disk:
scsi1: /dev/disk/by-id/ata-QEMU_HARDDISK_QM00005,cache=writeback

Or if you want to assign as IDE or SATA:
sata1: /dev/disk/by-id/ata-WDC_500G,cache=writeback

cache=writeback helps increase performance (like a virtual disk commonly used), can be changed to none to ensure data security. SCSI is recommended, SATA is only used when compatibility with old OS is needed
________________________________________


🔹 Step 3: Restart VM

Windows 10 VM will see the new drive as a removable hard drive → drive D:
• Format if first time use
• If there is data, Windows will immediately recognize the volume with data
________________________________________


1.1.3. Restore passthrough disk when switching to another Proxmox

When Proxmox A fails:
1. Remove passthrough disk (/dev/sdb) from machine A
2. Plug it into Proxmox B
3. Check with lsblk, ls /dev/disk/by-id/
4. Create a new Windows VM (or import the old one if the backup is still available)
5. Edit the xxx.conf file as above to add the passthrough disk line
→ When booting, Windows will see drive D: again and the data is intact (because it is saved on a physical hard drive outside the VM)
_______________________________________


1.1.4. Extremely important note

Problem Explanation
Do not format the disk on the host! Because VM manages that drive, do not touch anything on the host
Do not mount that drive to Proxmox host If you mount and passthrough at the same time, the data will be corrupted
Preferably use /dev/disk/by-id To ensure that the drive name is not changed after reboot
VM should use scsi or sata driver IDE is slow, VirtIO needs to install driver in Windows
________________________________________


🧪 Quick check after passthrough

• Go to VM → Disk Management
• Check to see drive D:
o If first time: format
o If there is old data: mount & use immediately