auto mounting an .iso file

Posted:
Jul 31st, '12, 12:38
by tim
Hello everybody,
I want to automatically mount an .iso file which is on an ntfs file system that I mounted via fstab. Do I have to make another fstab entry or is it better to write a small script and place it in /etc/init.d? How would such an entry or script look like?
Thank you very much for your help!
tim
Re: auto mounting an .iso file

Posted:
Jul 31st, '12, 12:53
by isadora
Would suggest a new entry in fstab:
- Code: Select all
/iso-archiv/image.iso /mnt/image1 iso9660 ro,loop,auto 0 0
Where /iso-archiv/image.iso is the full-path to the .iso
Where /mnt/image1 is your choice for mount-point.
Re: auto mounting an .iso file

Posted:
Aug 1st, '12, 10:09
by wintpe
There is of course autofs that will dynamicly mount anything specified in the automount maps.
I use it for automounting my nfs mounts on demand.
That way you dont have hangs when the destination server or path is not up, on boot.
Ive seen a few people on here putting nfs mounts in fstab, which is not the best way to do it.
Autofs will mount the destination on the path when an attempt is made to navigate to that path, so boot ups are not held up by destination servers down.
I can post an example of howvto do it if anyone is struggling.
Regards peter
Re: auto mounting an .iso file

Posted:
Aug 1st, '12, 14:57
by wintpe
ok so heres example (working from my system).
install the autofs package
so exports on a file server
/local/0 *(rw,insecure,all_squash)
/local/1 *(rw,insecure,all_squash)
/local/2 *(rw,insecure,all_squash)
now on the client
cd /etc/autofs
im going to make the above mounts appear under /local
so first edit edit auto.master and add a line
/local /etc/autofs/auto.local
now edit auto.local (which is a new file to contain all the mounts appearing under /local.
0 -rw,soft,bg,tcp,vers=3,rsize=262144,wsize=262144 fileserver:/local/0
1 -rw,soft,bg,tcp,vers=3,rsize=262144,wsize=262144 fileserver:/local/1
2 -rw,soft,bg,tcp,vers=3,rsize=262144,wsize=262144 fileserver:/local/2
you only need to start the line with the mount point under /local
when you run service autofs restart a virtual mount point will be created called /local
(this is not a directory, but looks like one) you cant create any files in it, its read only.
now if you cd /local/0 you will see the mount appears almost magically
and you dont need to be root, as the autofs daemon intercepts your change directory request and starts a mount command with the options in the auto.local file for that matching entry.
if you have not used it for a while or dont have any open files holding it open, it will quietly dismount until its needed again
similarly as per this thread an ISO or cdrom could be mounted using the same system as long as the mount options are in the autofs file associated with the mount path.
those mount options ive put in my autofs file also greatly improve NFS performance on standard mageia/mandriva which I found to be absolutely appalling using the mageia/mandriva default options (ie the vers=3,rsize=262144,wsize=262144 ).
regards peter
Re: auto mounting an .iso file

Posted:
Aug 5th, '12, 12:25
by tim
Thank you very much for your help! But it looks like i produced another error with my editing
https://lh6.googleusercontent.com/-CXIMdUXpsCw/UB5BvEHMoPI/AAAAAAAAAPY/UlRmD9jfGo4/s1048/DSC_0156.JPGso i opened my fstab with vi and this is how it looks like:
https://lh6.googleusercontent.com/-KBrmLjdsmZo/UB5GFf-5opI/AAAAAAAAAQA/rUOhmLEj0SA/s1048/DSC_0159.JPGhere as plain text so you can read it better
- Code: Select all
# Entry for /dev/sdb1 :
UUID=cb9ea857-75c5-4be1-a08c-8f9d030857c7 / ext4 defaults 1 1
# Entry for /dev/sdb6 :
UUID=9c53e51a-0492-4fda-86d4-562de5a8c14d /home ext4 defaults 1 2
# none /proc proc defaults 0 0
# Entry for /dev/sdb5 :
UUID=dc2dd0cc-742a-4c70-b217-e7525b3c9839 swap swap defaults 0 0
# Windows-Platte
# UUID=8AE6CB51E6CB3C67 /home/tim/Win7 ntfs defaults,umask=000 0 0
# Tausch-Platte
# UUID=907C516F7C5150D8 /home/tim/Tausch ntfs defaults,umask=000 0 0
# Video to Brain - Java 7
# /dev/sda2/Programme/Video2Brain_-_Java_7_-_Einstieg_für_Anspruchsvolle /home/tim/Java7 iso9660 ro,loop,auto 0 0
I am really desperate.. If you need to know any other outputs just let me know and I will check. Thanks for your help in advance!
tim
Re: auto mounting an .iso file

Posted:
Aug 5th, '12, 15:38
by doktor5000
You can't reference a file through the /dev device tree. Also /dev/sda2/Programme/Video2Brain_-_Java_7_-_Einstieg_für_Anspruchsvolle looks like a folder, or you're missing the extension .iso or whatever image that is. Apart from that, is it correct that this file/folder is located on the same partition which you mount below /home/tim/Win7?
Then why don't you just add a symlink, this can even be done via file manager ...
BTW: As your main language seems to be german, why not use the german forum, maybe that makes communicating easier?
https://forums.mageia.org/de/index.php