Make available a physical disk to existing Windows VMHow to make new KVM with existing hard driveDisk space...
2.8 is missing the Carve option in the Boolean Modifier
Turing patterns
How is it possible that Gollum speaks Westron?
Cause of continuous spectral lines
Is it possible to (7 day) schedule sleep time of a hard drive?
Did the first version of Linux developed by Linus Torvalds have a GUI?
Was the Tamarian language in "Darmok" inspired by Jack Vance's "The Asutra"?
Avoiding cliches when writing gods
How to retract an idea already pitched to an employer?
PL/SQL function to receive a number and return its binary format
From the list of 3-tuples, how can I select tuples which contain one for more nines?
How were concentration and extermination camp guards recruited?
Phone number to a lounge, or lounges generally
What is this solid state starting relay component?
Where does this pattern of naming products come from?
Should an arbiter claim draw at a K+R vs K+R endgame?
Why don’t airliners have temporary liveries?
How Can I Tell The Difference Between Unmarked Sugar and Stevia?
SF novella separating the dumb majority from the intelligent part of mankind
What can cause the front wheel to lock up when going over a small bump?
How do I write "Show, Don't Tell" as a person with Asperger Syndrome?
Can you really not move between grapples/shoves?
Etymology of 'calcit(r)are'?
siunitx error: Invalid numerical input
Make available a physical disk to existing Windows VM
How to make new KVM with existing hard driveDisk space in windows not representing actual qcow2 image sizePCI Passthrough KVM with vfio-pci giving EINVAL on PCI ProbePause QEMU/KVM VM (save RAM and CPU state to disk) like vmware Player?How can I make ACL settings on /run/media/* persistent?virt-install --disk size=10 does what?Corsair K95 keyboard qemu passthrough to Windows 10. Not workingHow to apply qcow2 snapshot to overlay raw disk image?Passthrough Sonnet USB-C card to Windows guest via KVM and vfioBoot failure with virtualized Windows 7
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
Problem: I have a new SATA drive I wish to sysprep with a Windows installation. I only have Windows virtualised on my PC.
My Solution: Attach (passthrough) the entire drive to the Windows VM and sysprep as normal.
This is my VGA/Passthrough script:
#!/bin/bash
#1st PART
configfile=/etc/vfio-pci.cfg
vfiobind() {
dev="$1"
vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
device=$(cat /sys/bus/pci/devices/$dev/device)
if [ -e /sys/bus/pci/devices/$dev/driver ]; then
echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
fi
echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
}
modprobe vfio-pci
cat $configfile | while read line;do
echo $line | grep ^# >/dev/null 2>&1 && continue
vfiobind $line
done
#2nd PART
xrandr --output DVI-D-0 --off
/usr/bin/synergys --config /home/%username%/.synergy.conf
export QEMU_ALSA_DAC_BUFFER_SIZE=512 QEMU_ALSA_DAC_PERIOD_SIZE=170 QEMU_AUDIO_DRV=alsa
sudo qemu-system-x86_64
-enable-kvm
-M q35
-m 8192
-cpu host,kvm=off,migratable=off,+invtsc,enforce
-smp 4,sockets=1,cores=4,threads=1
-bios /usr/share/seabios/bios.bin -vga none
-device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1
-device vfio-pci,host=06:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on
-device vfio-pci,host=06:00.1,bus=root.1,addr=00.1
-soundhw all
-drive if=none,file=/media/VM/windows1.img,id=disk,format=raw -device ide-hd,bus=ide.0,drive=disk
-net tap,vlan=0
-boot menu=on
sudo killall synergys
xrandr --output DVI-D-0 --auto
xrandr --output DVI-D-0 --right-of HDMI-0
exit 0
Question 1): I want to make /dev/sdc available to the VM. What -option format will achieve this. (To reiterate the new disk, sdc, has no content, partition or formatting at this point.)
Question 2): Am I making life stupidly difficult for myself and is there is much simpler solution.
Question 3) I do know that this can be achieved by using .xml script that virt-manager uses, but as you see I am not using virt-manager to launch the VM (because of the VGA Pasthrough), would it be possible to convert/import this startup script into the virt-manager .xml format and then add something like:
<disk type="block" device="disk">
<driver name="qemu" type="raw" cache="none" />
<source dev="/dev/sda" />
<target dev="vdb" bus="virtio" />
</disk>
...to the <devices>
section?
Many thanks just for reading to end if you managed it.
kvm qemu libvirt
bumped to the homepage by Community♦ 32 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
Problem: I have a new SATA drive I wish to sysprep with a Windows installation. I only have Windows virtualised on my PC.
My Solution: Attach (passthrough) the entire drive to the Windows VM and sysprep as normal.
This is my VGA/Passthrough script:
#!/bin/bash
#1st PART
configfile=/etc/vfio-pci.cfg
vfiobind() {
dev="$1"
vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
device=$(cat /sys/bus/pci/devices/$dev/device)
if [ -e /sys/bus/pci/devices/$dev/driver ]; then
echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
fi
echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
}
modprobe vfio-pci
cat $configfile | while read line;do
echo $line | grep ^# >/dev/null 2>&1 && continue
vfiobind $line
done
#2nd PART
xrandr --output DVI-D-0 --off
/usr/bin/synergys --config /home/%username%/.synergy.conf
export QEMU_ALSA_DAC_BUFFER_SIZE=512 QEMU_ALSA_DAC_PERIOD_SIZE=170 QEMU_AUDIO_DRV=alsa
sudo qemu-system-x86_64
-enable-kvm
-M q35
-m 8192
-cpu host,kvm=off,migratable=off,+invtsc,enforce
-smp 4,sockets=1,cores=4,threads=1
-bios /usr/share/seabios/bios.bin -vga none
-device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1
-device vfio-pci,host=06:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on
-device vfio-pci,host=06:00.1,bus=root.1,addr=00.1
-soundhw all
-drive if=none,file=/media/VM/windows1.img,id=disk,format=raw -device ide-hd,bus=ide.0,drive=disk
-net tap,vlan=0
-boot menu=on
sudo killall synergys
xrandr --output DVI-D-0 --auto
xrandr --output DVI-D-0 --right-of HDMI-0
exit 0
Question 1): I want to make /dev/sdc available to the VM. What -option format will achieve this. (To reiterate the new disk, sdc, has no content, partition or formatting at this point.)
Question 2): Am I making life stupidly difficult for myself and is there is much simpler solution.
Question 3) I do know that this can be achieved by using .xml script that virt-manager uses, but as you see I am not using virt-manager to launch the VM (because of the VGA Pasthrough), would it be possible to convert/import this startup script into the virt-manager .xml format and then add something like:
<disk type="block" device="disk">
<driver name="qemu" type="raw" cache="none" />
<source dev="/dev/sda" />
<target dev="vdb" bus="virtio" />
</disk>
...to the <devices>
section?
Many thanks just for reading to end if you managed it.
kvm qemu libvirt
bumped to the homepage by Community♦ 32 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
Problem: I have a new SATA drive I wish to sysprep with a Windows installation. I only have Windows virtualised on my PC.
My Solution: Attach (passthrough) the entire drive to the Windows VM and sysprep as normal.
This is my VGA/Passthrough script:
#!/bin/bash
#1st PART
configfile=/etc/vfio-pci.cfg
vfiobind() {
dev="$1"
vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
device=$(cat /sys/bus/pci/devices/$dev/device)
if [ -e /sys/bus/pci/devices/$dev/driver ]; then
echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
fi
echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
}
modprobe vfio-pci
cat $configfile | while read line;do
echo $line | grep ^# >/dev/null 2>&1 && continue
vfiobind $line
done
#2nd PART
xrandr --output DVI-D-0 --off
/usr/bin/synergys --config /home/%username%/.synergy.conf
export QEMU_ALSA_DAC_BUFFER_SIZE=512 QEMU_ALSA_DAC_PERIOD_SIZE=170 QEMU_AUDIO_DRV=alsa
sudo qemu-system-x86_64
-enable-kvm
-M q35
-m 8192
-cpu host,kvm=off,migratable=off,+invtsc,enforce
-smp 4,sockets=1,cores=4,threads=1
-bios /usr/share/seabios/bios.bin -vga none
-device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1
-device vfio-pci,host=06:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on
-device vfio-pci,host=06:00.1,bus=root.1,addr=00.1
-soundhw all
-drive if=none,file=/media/VM/windows1.img,id=disk,format=raw -device ide-hd,bus=ide.0,drive=disk
-net tap,vlan=0
-boot menu=on
sudo killall synergys
xrandr --output DVI-D-0 --auto
xrandr --output DVI-D-0 --right-of HDMI-0
exit 0
Question 1): I want to make /dev/sdc available to the VM. What -option format will achieve this. (To reiterate the new disk, sdc, has no content, partition or formatting at this point.)
Question 2): Am I making life stupidly difficult for myself and is there is much simpler solution.
Question 3) I do know that this can be achieved by using .xml script that virt-manager uses, but as you see I am not using virt-manager to launch the VM (because of the VGA Pasthrough), would it be possible to convert/import this startup script into the virt-manager .xml format and then add something like:
<disk type="block" device="disk">
<driver name="qemu" type="raw" cache="none" />
<source dev="/dev/sda" />
<target dev="vdb" bus="virtio" />
</disk>
...to the <devices>
section?
Many thanks just for reading to end if you managed it.
kvm qemu libvirt
Problem: I have a new SATA drive I wish to sysprep with a Windows installation. I only have Windows virtualised on my PC.
My Solution: Attach (passthrough) the entire drive to the Windows VM and sysprep as normal.
This is my VGA/Passthrough script:
#!/bin/bash
#1st PART
configfile=/etc/vfio-pci.cfg
vfiobind() {
dev="$1"
vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
device=$(cat /sys/bus/pci/devices/$dev/device)
if [ -e /sys/bus/pci/devices/$dev/driver ]; then
echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
fi
echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
}
modprobe vfio-pci
cat $configfile | while read line;do
echo $line | grep ^# >/dev/null 2>&1 && continue
vfiobind $line
done
#2nd PART
xrandr --output DVI-D-0 --off
/usr/bin/synergys --config /home/%username%/.synergy.conf
export QEMU_ALSA_DAC_BUFFER_SIZE=512 QEMU_ALSA_DAC_PERIOD_SIZE=170 QEMU_AUDIO_DRV=alsa
sudo qemu-system-x86_64
-enable-kvm
-M q35
-m 8192
-cpu host,kvm=off,migratable=off,+invtsc,enforce
-smp 4,sockets=1,cores=4,threads=1
-bios /usr/share/seabios/bios.bin -vga none
-device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1
-device vfio-pci,host=06:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on
-device vfio-pci,host=06:00.1,bus=root.1,addr=00.1
-soundhw all
-drive if=none,file=/media/VM/windows1.img,id=disk,format=raw -device ide-hd,bus=ide.0,drive=disk
-net tap,vlan=0
-boot menu=on
sudo killall synergys
xrandr --output DVI-D-0 --auto
xrandr --output DVI-D-0 --right-of HDMI-0
exit 0
Question 1): I want to make /dev/sdc available to the VM. What -option format will achieve this. (To reiterate the new disk, sdc, has no content, partition or formatting at this point.)
Question 2): Am I making life stupidly difficult for myself and is there is much simpler solution.
Question 3) I do know that this can be achieved by using .xml script that virt-manager uses, but as you see I am not using virt-manager to launch the VM (because of the VGA Pasthrough), would it be possible to convert/import this startup script into the virt-manager .xml format and then add something like:
<disk type="block" device="disk">
<driver name="qemu" type="raw" cache="none" />
<source dev="/dev/sda" />
<target dev="vdb" bus="virtio" />
</disk>
...to the <devices>
section?
Many thanks just for reading to end if you managed it.
kvm qemu libvirt
kvm qemu libvirt
asked Nov 3 '17 at 16:51
themainlinerthemainliner
63
63
bumped to the homepage by Community♦ 32 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 32 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I use libvirt and pass block devices to VMs. That results in qemu
parameters like these:
-drive file=/dev/mapper/storage-profiles,if=none,id=drive-virtio-disk4,format=raw,serial=KVM-profiles,cache=writeback
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0xc,drive=drive-virtio-disk4,id=virtio-disk4,bootindex=6
`-drive file=/dev/sdc,if=none,format=raw,aio=native,cache=none,id=hd0 -device virtio-scsi-pci,id=scsi -device scsi-block,drive=hd0,bus=scsi.0 ` This got the device passed through, however it required scsi drivers which I then attempted to install from the /media/LocalBackup/virtio-win-drivers-20120712-1.iso red-hat iso and blue screened and trashed my VM. :D Happy days.
– themainliner
Nov 3 '17 at 19:50
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f402362%2fmake-available-a-physical-disk-to-existing-windows-vm%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I use libvirt and pass block devices to VMs. That results in qemu
parameters like these:
-drive file=/dev/mapper/storage-profiles,if=none,id=drive-virtio-disk4,format=raw,serial=KVM-profiles,cache=writeback
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0xc,drive=drive-virtio-disk4,id=virtio-disk4,bootindex=6
`-drive file=/dev/sdc,if=none,format=raw,aio=native,cache=none,id=hd0 -device virtio-scsi-pci,id=scsi -device scsi-block,drive=hd0,bus=scsi.0 ` This got the device passed through, however it required scsi drivers which I then attempted to install from the /media/LocalBackup/virtio-win-drivers-20120712-1.iso red-hat iso and blue screened and trashed my VM. :D Happy days.
– themainliner
Nov 3 '17 at 19:50
add a comment |
I use libvirt and pass block devices to VMs. That results in qemu
parameters like these:
-drive file=/dev/mapper/storage-profiles,if=none,id=drive-virtio-disk4,format=raw,serial=KVM-profiles,cache=writeback
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0xc,drive=drive-virtio-disk4,id=virtio-disk4,bootindex=6
`-drive file=/dev/sdc,if=none,format=raw,aio=native,cache=none,id=hd0 -device virtio-scsi-pci,id=scsi -device scsi-block,drive=hd0,bus=scsi.0 ` This got the device passed through, however it required scsi drivers which I then attempted to install from the /media/LocalBackup/virtio-win-drivers-20120712-1.iso red-hat iso and blue screened and trashed my VM. :D Happy days.
– themainliner
Nov 3 '17 at 19:50
add a comment |
I use libvirt and pass block devices to VMs. That results in qemu
parameters like these:
-drive file=/dev/mapper/storage-profiles,if=none,id=drive-virtio-disk4,format=raw,serial=KVM-profiles,cache=writeback
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0xc,drive=drive-virtio-disk4,id=virtio-disk4,bootindex=6
I use libvirt and pass block devices to VMs. That results in qemu
parameters like these:
-drive file=/dev/mapper/storage-profiles,if=none,id=drive-virtio-disk4,format=raw,serial=KVM-profiles,cache=writeback
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0xc,drive=drive-virtio-disk4,id=virtio-disk4,bootindex=6
answered Nov 3 '17 at 17:15
Hauke LagingHauke Laging
58.6k1289137
58.6k1289137
`-drive file=/dev/sdc,if=none,format=raw,aio=native,cache=none,id=hd0 -device virtio-scsi-pci,id=scsi -device scsi-block,drive=hd0,bus=scsi.0 ` This got the device passed through, however it required scsi drivers which I then attempted to install from the /media/LocalBackup/virtio-win-drivers-20120712-1.iso red-hat iso and blue screened and trashed my VM. :D Happy days.
– themainliner
Nov 3 '17 at 19:50
add a comment |
`-drive file=/dev/sdc,if=none,format=raw,aio=native,cache=none,id=hd0 -device virtio-scsi-pci,id=scsi -device scsi-block,drive=hd0,bus=scsi.0 ` This got the device passed through, however it required scsi drivers which I then attempted to install from the /media/LocalBackup/virtio-win-drivers-20120712-1.iso red-hat iso and blue screened and trashed my VM. :D Happy days.
– themainliner
Nov 3 '17 at 19:50
`-drive file=/dev/sdc,if=none,format=raw,aio=native,cache=none,id=hd0 -device virtio-scsi-pci,id=scsi -device scsi-block,drive=hd0,bus=scsi.0 ` This got the device passed through, however it required scsi drivers which I then attempted to install from the /media/LocalBackup/virtio-win-drivers-20120712-1.iso red-hat iso and blue screened and trashed my VM. :D Happy days.
– themainliner
Nov 3 '17 at 19:50
`-drive file=/dev/sdc,if=none,format=raw,aio=native,cache=none,id=hd0 -device virtio-scsi-pci,id=scsi -device scsi-block,drive=hd0,bus=scsi.0 ` This got the device passed through, however it required scsi drivers which I then attempted to install from the /media/LocalBackup/virtio-win-drivers-20120712-1.iso red-hat iso and blue screened and trashed my VM. :D Happy days.
– themainliner
Nov 3 '17 at 19:50
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f402362%2fmake-available-a-physical-disk-to-existing-windows-vm%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown