How do I establish a constant mount point for my CDROM in Linux 12.1 ?

My scripts are now broken now that I’ve moved to the 64-bit version of OpenSUSE with the 12.1 kernel.
The script in question enables me to take seismic data from randomly named CDROMS (some of which are named in Cryllic characters) and copy the contents into an organized directory structure. The script searched previously for /media/cdrom which was mapped to /dev/sr0 in the /etc/fstab file.
Once I swapped to the 64 bit operating system, (which I need for a particular software package), it appears that I cannot create a persistent directory called /media/cdrom. The directory, if I create is as superuser, simply vanishes upon reboot.

If I explicitly create the directory, then remount /dev/sr0 as superuser, I can see the disc contents. I would rather NOT do this each & every time I try to load a CD, since I am loading twenty, thirty discs a day.

What I need to figure out, is HOW can I, upon reboot, ensure this directory exists, so that I have a consistently named location for my CDROM?

Ultimately, whenever I pop in a disc, I want the disc to mount to the same location name, regardless of what the disc’s name is on the CD. I don’t care if that location is called /media/cdrom or if it’s called /mnt/xyxxy or whatever, I just want to have a consistent place to which my script can point, so that it can extract files whenever a disc is present.

Anyone have any insights on how I can accomplish this with 12.1 ?

Ugh. I am blind. I must be. I’ve been using forums since about 1994 and I CANT find the edit message tab for the above message!
Anyway, I am using OpenSUSE distribution 12.1 (x86-64), and it uses Linux kernel 3.1.0-1.2-desktop x86_64.

That’s what I meant, anyway. I’m not using Kernel 12.1

On Wed, 06 Jun 2012 17:06:02 +0000, ws6transam wrote:

> Ugh. I am blind. I must be. I’ve been using forums since about 1994 and
> I CANT find the edit message tab for the above message!

http://forums.opensuse.org/faq.php?faq=novfor#faq_edit_time

And no, it’s not going to be changed. :slight_smile:

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

You can not use /media for these sorts of things (and you probably shouldn’t have done this earlier). /media is now a RAM bases file system and vanishes thus at system shutdown with whatever you put there. It is only for (media) devices that are connected during the lifetime of the system (boot - shutdown).

Using a different mountpoint (in e.g. /mnt) migyht get your construct working again.

On 2012-06-06 18:46, ws6transam wrote:
> My scripts are now broken now that I’ve moved to the 64-bit version of
> OpenSUSE with the 12.1 kernel.
> The script in question enables me to take seismic data from randomly
> named CDROMS (some of which are named in Cryllic characters) and copy
> the contents into an organized directory structure. The script searched
> previously for /media/cdrom which was mapped to /dev/sr0 in the
> /etc/fstab file.
> Once I swapped to the 64 bit operating system, (which I need for a
> particular software package), it appears that I cannot create a
> persistent directory called /media/cdrom. The directory, if I create is
> as superuser, simply vanishes upon reboot.

If you look at the mount output, you will see that /media is in ram, so it
gets automatically erased on reboot. You should never have used /media for
your mounts, being a system reserved directory; you should have used /mnt
instead.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Just got home; so far I’ve logged 21 hours of troubleshooting time into the various problems that’ve popped up from this as well as the failed database software installation that precipitated the move to 64bit… I’m feeling pretty burned out.

However,
I did try to create a directory in /mnt but it also failed in the very same way as /media/cdrom. I don’t know what to do anymore. Thus far it has been a negative work day and eesh… I am out of time; can’t get back to this problem until the 17th of this month. I cannot believe that CDROMS are no longer script searchable, there has to be an answer somewhere. Thanks for at least thinking about the problem with me.

Oh, and :slight_smile: No worries on the edit function. I’m sort of a “send”, review and fix typos kind of user. It’s probably a bad habit. You live & die by the spell checker…

On 2012-06-06 22:36, ws6transam wrote:
>
> Just got home; so far I’ve logged 21 hours of troubleshooting time into
> the various problems that’ve popped up from this as well as the failed
> database software installation that precipitated the move to 64bit…
> I’m feeling pretty burned out.

Sorry about that.

> However,
> I did try to create a directory in /mnt but it also failed in the
> very same way as /media/cdrom.

I don’t believe it. Prove it :slight_smile:

We in the forum are non-believers. We do not have faith, we want facts with
proofs - ie commands and outputs, in code tags ;-p

> I cannot believe
> that CDROMS are no longer script searchable, there has to be an answer
> somewhere. Thanks for at least thinking about the problem with me.

That’s not true, because I do it.

Go step by step and ask questions on the road. We’ll help.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Carlos E. R. wrote:
> You should never have used /media for
> your mounts, being a system reserved directory; you should have used /mnt
> instead.

To be fair, I don’t think that’s the OP’s fault. It was the system that
used to always mount CDs at /media/cdrom IIRC. But nowadays it appears
to use some name from the device contents or somesuch AFAICT.

The mounting on something (whatever) inside* /media* is only for the spontanious mounting (on connection). Thus when you do not want to let the system mount on a place it creates (by using all sorts of algorithms that may have changed over time, but that include usage of volume labels and device names) inside /media, you have to create an entry in /etc/fstab. The fact that the entry is there for a device prevents the spontanious mounting. But you should not use a mountpoint in /media for this* /etc/fstab* entry. Only thing is that in earlier times you were not punished for this, but now you are.

Those that decided that from now on* /media* is a RAM file system took it for granted that we all were nice guys that behaved as if we all knew this from childhood. Thus my conclusion: yes, it is the OP’s fault and no, he is not to blame :wink:

On 2012-06-07 12:36, hcvv wrote:
>
> djh-novell;2467919 Wrote:
>> Carlos E. R. wrote:
>>> You should never have used /media for your mounts, being a system
>>> reserved directory; you should have used /mnt instead.

>> To be fair, I don’t think that’s the OP’s fault. It was the system that
>> used to always mount CDs at /media/cdrom IIRC. But nowadays it appears
>> to use some name from the device contents or somesuch AFAICT.

But the system is entitled to mount on /media/something, it is his
privilege. :slight_smile:

> The mounting on something (whatever) inside- /media- is only for the
> spontanious mounting (on connection). Thus when you do not want to let
> the system mount on a place it creates (by using all sorts of algorithms
> that may have changed over time, but that include usage of volume labels
> and device names) inside -/media-, you have to create an entry in
> -/etc/fstab-. The fact that the entry is there for a device prevents the
> spontanious mounting.

That’s right.

As my main system is 11.4, I don’t remember if 12.1 mounts CDs on a mount
named after the label of the media, or in /media/dvd or similar. The
“standard” is not really standard, it has changed over the versions several
times.

What is stable is that /media is a bad place for manual mounts. And yes,
using fstab disables automounting, this is a thing I reported about several
times in bugzillas and now it works, IIRC.

> But you should not use a mountpoint in -/media-
> for this- /etc/fstab- entry. Only thing is that in earlier times you
> were not punished for this, but now you are.

On rare occasion some people had conflicts.

> Those that decided that from now on- /media- is a RAM file system took
> it for granted that we all were nice guys that behaved as if we all knew
> this from childhood. Thus my conclusion: yes, it is the OP’s fault and
> no, he is not to blame :wink:

Right :slight_smile:


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

On Thu, 07 Jun 2012 09:21:50 +0000, Dave Howorth wrote:

> But nowadays it appears to use some name from the device contents or
> somesuch AFAICT.

It uses the device’s label, if it has one. At least for vfat devices, if
there isn’t a label, it uses the serial number.

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

On 2012-06-07 17:06, Jim Henderson wrote:
> On Thu, 07 Jun 2012 09:21:50 +0000, Dave Howorth wrote:
>
>> But nowadays it appears to use some name from the device contents or
>> somesuch AFAICT.
>
> It uses the device’s label, if it has one. At least for vfat devices, if
> there isn’t a label, it uses the serial number.

And that is a problem for scripts: you can not automate tasks, the path varies.

I think there was a solution for this in udev rules, but I don’t remember
for sure. Me, I always use manual mount for dvds, so I define the name i
want. /mnt/dvd.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

On Thu, 07 Jun 2012 16:13:07 +0000, Carlos E. R. wrote:

> On 2012-06-07 17:06, Jim Henderson wrote:
>> On Thu, 07 Jun 2012 09:21:50 +0000, Dave Howorth wrote:
>>
>>> But nowadays it appears to use some name from the device contents or
>>> somesuch AFAICT.
>>
>> It uses the device’s label, if it has one. At least for vfat devices,
>> if there isn’t a label, it uses the serial number.
>
> And that is a problem for scripts: you can not automate tasks, the path
> varies.

Don’t say “can’t” - it’s more difficult, but not impossible.

If you know the device name, you can deduce the actual path in the script
by examining the output of the mount command.

It’s not as easy as a single path, but far from impossible.

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

On 2012-06-07 18:35, Jim Henderson wrote:
> It’s not as easy as a single path, but far from impossible.

I wouldn’t know how to that easily.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

On Thu, 07 Jun 2012 17:03:06 +0000, Carlos E. R. wrote:

> On 2012-06-07 18:35, Jim Henderson wrote:
>> It’s not as easy as a single path, but far from impossible.
>
> I wouldn’t know how to that easily.

That’s different than “it’s impossible” (that’s something of a hot button
for me; on another forum there’s a user who constantly is declaring
things “impossible”, most particularly things that are demonstrably
already being done - in a more recent posting, in fact, he’s declared
that making a full 360-degree photograph from a tripod but without the
tripod in shot is impossible, or at least nearly impossible. It’s
actually fairly trivial, he just didn’t stop and think about it).

In bash:

export DEMO=`mount | grep sr0 | awk ‘{print $3}’

Then in the script, you’d refer to the mount point as $DEMO.

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

On 2012-06-07 19:31, Jim Henderson wrote:
> On Thu, 07 Jun 2012 17:03:06 +0000, Carlos E. R. wrote:

> In bash:
>
> export DEMO=`mount | grep sr0 | awk ‘{print $3}’
>
> Then in the script, you’d refer to the mount point as $DEMO.

AUMMMMmmm… :slight_smile:


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

On Thu, 07 Jun 2012 17:43:07 +0000, Carlos E. R. wrote:

> On 2012-06-07 19:31, Jim Henderson wrote:
>> On Thu, 07 Jun 2012 17:03:06 +0000, Carlos E. R. wrote:
>
>
>> In bash:
>>
>> export DEMO=`mount | grep sr0 | awk ‘{print $3}’

Then in the script, you’d refer to the mount point as $DEMO.

AUMMMMmmm… :slight_smile:

Missed the closing ‘`’ on the line somehow.

There’s probably an easier way to do it without using awk, too. :slight_smile:

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C