Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to emulate a SATA disk drive in QEMU

I want to emulate a SATA disk drive in QEMU to check a device driver I'm trying to develop. How can this be done? Would greatly appreciate your help.

like image 384
Dragonight Avatar asked Jan 19 '18 23:01

Dragonight


2 Answers

The Gentoo Wiki offers these parameters:

-drive id=disk,file=IMAGE.img,if=none \
-device ahci,id=ahci \
-device ide-hd,drive=disk,bus=ahci.0

Set emulation layer for an ICH-9 AHCI controller (not yet stable ) and use the specified image file for it. The AHCI emulation supports NCQ, so multiple read or write requests can be outstanding at the same time.

EDIT: A revision to the Wiki on 31 October 2018 suggests the AHCI controller may be stable now.

like image 170
mwfearnley Avatar answered Nov 18 '22 21:11

mwfearnley


When using i386 or x86_64 with Q35 machine type(-M q35), IDE disk has been AHCI by default.

like image 45
BugMeNot114514 Avatar answered Nov 18 '22 19:11

BugMeNot114514