LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 04-28-2005, 08:36 AM   #1
username-inuse
LQ Newbie
 
Registered: Apr 2005
Location: Kent, England, UK
Distribution: Red Hat 9, Knoppix HD install, Gentoo (Just about installed :P)
Posts: 12

Rep: Reputation: 0
Making a folder look like a device?


Hey everyone!
I have a .iso image that I mounted as /mnt/cdrom/ . I would like to make it look like a REAL device. (i.e have a file in /dev/) I need this for a little project im working on.

I have researched and googled the topic. I hope I dont appear like a !

The command I used to mount the .ISO was...

Code:
mount -r ./Toppas.iso /mnt/cdaudio -t iso9660 -o loop
df returns...

Code:
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hda2              9092176   7103648   1526660  83% /
/dev/root.old            16155      7864      8291  49% /initrd
/home/Modzilla/Toppas.iso
                        632516    632516         0 100% /mnt/cdaudio
If you dont understand what im trying to say, I would like to make a "virtual" cd drive.

Thanks in advance!

-Hopeless
 
Old 04-28-2005, 08:40 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
using a loopback mount like you have makes it avaiable... as you know... you've already achieved what you're asking for... what else do you expect to be able to do? it's not a device, therefore has no place in /dev/
 
Old 04-28-2005, 08:45 AM   #3
username-inuse
LQ Newbie
 
Registered: Apr 2005
Location: Kent, England, UK
Distribution: Red Hat 9, Knoppix HD install, Gentoo (Just about installed :P)
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by acid_kewpie
using a loopback mount like you have makes it avaiable... as you know... you've already achieved what you're asking for... what else do you expect to be able to do? it's not a device, therefore has no place in /dev/
I would like a program to see it as a CD. So it can read-write to it. Im sorry if I made it unclear... (Therefore have a entry in the /dev/folder)

Last edited by username-inuse; 04-28-2005 at 09:06 AM.
 
Old 04-28-2005, 09:30 AM   #4
rpz
Member
 
Registered: Mar 2005
Posts: 126

Rep: Reputation: 15
/dev/loopX maybe?
 
Old 04-28-2005, 09:40 AM   #5
username-inuse
LQ Newbie
 
Registered: Apr 2005
Location: Kent, England, UK
Distribution: Red Hat 9, Knoppix HD install, Gentoo (Just about installed :P)
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by rpz
/dev/loopX maybe?
What about /dev/loopX??

**EDIT**

Also this program only takes /dev/cdaudio /dev/cdrom /dev/dvd/ and so on.

The reason for me doing this is becuase I am studying CD file systems, how linux utilizes them.

Id like to get it working, even if its just for five minutes like.

Last edited by username-inuse; 04-28-2005 at 09:55 AM.
 
Old 04-28-2005, 02:17 PM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
a system will see it as a device... you can't yet do dynamic disk writing to UDF filesystems if that's what you're getting at...
 
Old 04-28-2005, 02:50 PM   #7
rpz
Member
 
Registered: Mar 2005
Posts: 126

Rep: Reputation: 15
Quote:
Originally posted by username-inuse
[B]What about /dev/loopX??
For example, have you tried using /dev/loop0 (assuming it's the first loop device), instead of /dev/dvd?
 
Old 04-28-2005, 03:23 PM   #8
username-inuse
LQ Newbie
 
Registered: Apr 2005
Location: Kent, England, UK
Distribution: Red Hat 9, Knoppix HD install, Gentoo (Just about installed :P)
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by rpz
For example, have you tried using /dev/loop0 (assuming it's the first loop device), instead of /dev/dvd?
Oh, Ill have a go and post my results in a moment.
 
Old 04-28-2005, 04:47 PM   #9
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
/dev/loop won't retain any direct association or knowledge about the pretend cdrom device... i really don't see what you're trying to achieve... you can't write direct to cdrw drives anyway (without some middleware which makes it indirect...)
 
Old 04-30-2005, 07:37 AM   #10
username-inuse
LQ Newbie
 
Registered: Apr 2005
Location: Kent, England, UK
Distribution: Red Hat 9, Knoppix HD install, Gentoo (Just about installed :P)
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by acid_kewpie
/dev/loop won't retain any direct association or knowledge about the pretend cdrom device... i really don't see what you're trying to achieve... you can't write direct to cdrw drives anyway (without some middleware which makes it indirect...)
I dont want to write to it, I need to read from it.
 
Old 04-30-2005, 05:04 PM   #11
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
You already did when you specify "mount -r ./Toppas.iso /mnt/cdaudio -t iso9660 -o loop". What it does behind the scenes. First it sets up a loop device that is not used yet using the losetup utility. Usually it will be /dev/loopX. The X could 0, 1, 2, 3, 4, etc. Next it mounts it to /mnt/cdaudio. If its a DVD image, you can use mplayer or any player. Though you will have to specify the video_ts to read from. Yes, you can write to it if it has unused space. Also you can make a disk image that contains partitions and filesystems. Then set it up as a loop device.

If you want to know more, look at the kernel source code. It will tell you everything, but a knowledge of C programming langauge is require.
 
Old 05-01-2005, 05:23 AM   #12
username-inuse
LQ Newbie
 
Registered: Apr 2005
Location: Kent, England, UK
Distribution: Red Hat 9, Knoppix HD install, Gentoo (Just about installed :P)
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by Electro
You already did when you specify "mount -r ./Toppas.iso /mnt/cdaudio -t iso9660 -o loop". What it does behind the scenes. First it sets up a loop device that is not used yet using the losetup utility. Usually it will be /dev/loopX. The X could 0, 1, 2, 3, 4, etc. Next it mounts it to /mnt/cdaudio. If its a DVD image, you can use mplayer or any player. Though you will have to specify the video_ts to read from. Yes, you can write to it if it has unused space. Also you can make a disk image that contains partitions and filesystems. Then set it up as a loop device.

If you want to know more, look at the kernel source code. It will tell you everything, but a knowledge of C programming langauge is require.
I understand! I need it to appear as the actuall device though. For example having the image linked to /dev/cdrom permanently. I type mount /dev/cdrom /mnt/cdrom and it will automatically appear as the device. The program tries to re-mount the selected devices which takes the above command's effects away.

Last edited by username-inuse; 05-01-2005 at 05:29 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Making device permissions stick mugwump84 Linux - Newbie 3 04-05-2005 04:35 PM
....So im making my own input device.... poiuytrewq Linux - General 1 03-31-2005 04:32 AM
how to not add .Trash-user folder to storage device poiuytrewq Linux - Newbie 4 12-29-2004 09:31 PM
making a script that will move a file or files in a trash folder Paxmaster Programming 5 12-12-2004 06:00 PM
Making it so users can ftp into there Public_html folder embalmedlenin Linux - General 4 12-13-2003 06:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 12:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration