View previous topic :: View next topic |
Author |
Message |
germanobax Tux's lil' helper
Joined: 28 Apr 2005 Posts: 96
|
Posted: Mon Dec 26, 2005 5:54 am Post subject: How to create a virtual cdrom device? |
|
|
I want to create a virtual device in /dev/ pretending to be a cdrom. Some programs try to look for /dev/cdrom, making impossible to just mount a ISO in some folder. I think it would be nice to have a way to map a image to a device and use it as some kind of virtual drive.
Can I do something like that? _________________ Life is a Sexually Transmitted Disease, with 100% mortality. |
|
Back to top |
|
|
smithjd15 Tux's lil' helper
Joined: 12 Mar 2003 Posts: 130 Location: Edmonton, AB, CA
|
Posted: Mon Dec 26, 2005 9:02 am Post subject: |
|
|
How about mounting an iso image on loopback? try this: Code: | # mount -o loop myiso.iso /mnt/virtualcdrom |
|
|
Back to top |
|
|
germanobax Tux's lil' helper
Joined: 28 Apr 2005 Posts: 96
|
Posted: Mon Dec 26, 2005 3:53 pm Post subject: |
|
|
Yes, I know you can do that. BUT some software try to verify if there's something in /dev/cdrom. So, it would be interesting to have a /dev/virtualcdrom, mapped as a "real" device, not just a directory. _________________ Life is a Sexually Transmitted Disease, with 100% mortality. |
|
Back to top |
|
|
mmbrothers Apprentice
Joined: 24 Dec 2005 Posts: 224 Location: Boston
|
Posted: Mon Dec 26, 2005 4:32 pm Post subject: |
|
|
If you mount the iso as a loop device you can get the following:
Code: |
mount -o loop /cdrom.iso /mnt/cdrom
mount
...
/cdrom.iso on /mnt/cdrom type iso9660 (rw,loop=/dev/loop0)
|
This lists that the device is /dev/loop0. You can even specify the loop device with the option loop=/dev/loopX You can then symlink from /dev/loopX to /dev/cdrom for the purposes of this program. |
|
Back to top |
|
|
datenwolf n00b
Joined: 01 Sep 2003 Posts: 55
|
Posted: Sun Apr 09, 2006 3:19 pm Post subject: Re: How to create a virtual cdrom device? |
|
|
germanobax wrote: | I want to create a virtual device in /dev/ pretending to be a cdrom. Some programs try to look for /dev/cdrom, making impossible to just mount a ISO in some folder. I think it would be nice to have a way to map a image to a device and use it as some kind of virtual drive.
Can I do something like that? |
Well, you could still make /dev/cdrom a link to a loopback device and assign the file to that.
Code: |
mv /dev/cdrom /dev/hw_cdrom
losetup 0 $FILE
ln -s /dev/loop0 /dev/cdrom
|
The rest is as usual. |
|
Back to top |
|
|
PaulSorensen Tux's lil' helper
Joined: 15 Apr 2004 Posts: 80 Location: Chicago, USA
|
Posted: Sun Apr 09, 2006 5:01 pm Post subject: This might be useful for Wine |
|
|
Another use-case for this is when using a windows program through wine that insists on seeing a CD inserted in the drive.
I'll give this a try, but it is important not just to see the device - it has to be able to query for a label - my guess is that the proposed loopback solution won't handle this, I'll let you know. |
|
Back to top |
|
|
|