qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] running qemu with image file on a block device


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] running qemu with image file on a block device
Date: Mon, 25 Jun 2012 11:15:41 +0100

On Sun, Jun 24, 2012 at 7:49 AM, udit agarwal <address@hidden> wrote:
>  I have set up a block device of 20G on my hard drive and is located at
> /dev/sda2. Now I have created a raw image inside this device via command:
>  "hp1:~ # qemu-img create -f raw /dev/sda2:server.img 10G"
>
> Then I copied the iso file on this device via command:
> "hp1:~# cp ~/CD.iso /dev/sda2:CD,iso"
> and it also worked fine.
>
> But when I ran the following qemu command:
> "hp1:~ # qemu -name "Gnome-desktop" -M pc-0.12 -m 256 -smp 2 -boot d -drive
> file=/dev/sda2:server.img,if=virtio,index=0,media=disk,format=raw -drive
> file=/dev/sda2:CD.iso,index=1,media=cdrom -net
> nic,model=virtio,macaddr=52:54:00:05:11:11 -net user -vga cirrus -balloon
> virtio"
>
> I got the following errors:
> "qemu: -drive
> file=/dev/sda2:server.img,if=virtio,index=0,media=disk,format=raw: could not
> open disk image /dev/sda2:server.img: No such file or directory"
>
> Can anybody help me with this??

The commands you pasted seem to be creating files called
"/dev/sda2:server.img" and "/dev/sda2:CD.iso".  Note that these files
are created in /dev, they are not located on the /dev/sda2 device as
you intended.  The ':' notation you tried to use has no special
meaning on Linux, you are creating new files that have nothing to do
with /dev/sda2.

If you want to put several disk images onto a single block device then
you probably need to create a file system on the device, mount it, and
then put files into this new file system:

# mkfs.ext4 /dev/sda2 # WARNING: any existing data in /dev/sda2 will be lost
# mount /dev/sda2 /mnt
# cp CD.iso /mnt
# qemu-img create /mnt/server.img 10G
# ls /mnt
CD.iso
server.img

Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]