This is a discussion on Need some info on USB stick mounting.. within the Linux General forums, part of the Linux Forums category; OK, as mentyined befiore, trying to get mysql on a USB stick..teh data, not teh program! Mysql is happy ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
OK, as mentyined befiore, trying to get mysql on a USB stick..teh data,
not teh program! Mysql is happy if the stick is ext3 formatted BUT at boot time, mysqld seems to be starting before the USB stick is mounted. Can anyone tell me what mounts the stick? And when? I HOPE its not done by something after users log in.. |
|
|||
|
On Mon, 27 Apr 2009 07:33:15 -0400, The Natural Philosopher <tnp@invalid.invalid> wrote:
> Can anyone tell me what mounts the stick? And when? When haldaemon starts up, it will detect the presense of the stick, or when the stick gets plugged in, later. When the stick is detected, or if already present when udev starts, udev runs a script that loads the usb_storage module, and creates the /dev entries. > I HOPE its not done by something after users log in.. You've got a problem here. On my Mandriva system, when udev detects the device, it runs a script from /etc/dynamic/hooks, which will call the appropriate gnome or kde script, to ask the user, "what to do with the device", browse, upload photos, nothing. If you put an entry for the device in /etc/fstab, that will stop udev/hal from hotplugging the device, but then it must be present at boot time, or you'll get dropped to single user mode. Rather then put an entry in fstab, and given that you've already modified the mysqld init script, I'd change it to check to see if the /dev entry exists, and if it does, explicitly mount it, in the init script. (hal and udev have already started, before the mysqld init script, so the /dev entry will exist, if the device is present). Something like LabelDB="STICKLABEL" FsType="ext2" if [ -e /dev/disk/by-label/"$LabelDB" ]; then mount -t "$FsType" -o defaults /dev/disk/by-label/"$LabelDB" /media/"$LabelDB" fi Setting the label on the filesystem can be done with the command tune2fs, reiserfstune, dosfslabel, etc. Regards, Dave Hodgins -- Change nomail.afraid.org to ody.ca to reply by email. (nomail.afraid.org has been set up specifically for use in usenet. Feel free to use it yourself.) |
|
|||
|
On Mon, 27 Apr 2009 12:33:15 +0100, The Natural Philosopher wrote:
> OK, as mentyined befiore, trying to get mysql on a USB stick..teh data, > not teh program! > > Mysql is happy if the stick is ext3 formatted BUT at boot time, mysqld > seems to be starting before the USB stick is mounted. > > Can anyone tell me what mounts the stick? And when? > > I HOPE its not done by something after users log in.. > If you are counting on auto-mounting, then that will be distribution dependant. I run Slackware, and that gives me a few options. For example, I could add an explicit mount directive for the USB drive to rc.local. That works because rc.local executes before rc.M (which is responsible for starting rc.mysqld.) Most likely, something similar can be done with other distributions. -- Douglas Mayne |
|
|||
|
David W. Hodgins wrote:
> On Mon, 27 Apr 2009 07:33:15 -0400, The Natural Philosopher <tnp@invalid.invalid> wrote: > >> Can anyone tell me what mounts the stick? And when? > > When haldaemon starts up, it will detect the presense of > the stick, or when the stick gets plugged in, later. > > When the stick is detected, or if already present when > udev starts, udev runs a script that loads the usb_storage > module, and creates the /dev entries. > Couldn't find any hint of that but I wasn't sure where to look, so I believe you!] >> I HOPE its not done by something after users log in.. > > You've got a problem here. On my Mandriva system, when > udev detects the device, it runs a script from > /etc/dynamic/hooks, which will call the appropriate gnome > or kde script, to ask the user, "what to do with the device", > browse, upload photos, nothing. > Could patch that maybe.. > If you put an entry for the device in /etc/fstab, that will > stop udev/hal from hotplugging the device, but then it > must be present at boot time, or you'll get dropped to > single user mode. > Mmm. No, that would be embrassing..you have just saved me goind down a fasle path..thanks. > Rather then put an entry in fstab, and given that you've > already modified the mysqld init script, I'd change it to > check to see if the /dev entry exists, and if it does, explicitly > mount it, in the init script. (hal and udev have already > started, before the mysqld init script, so the /dev entry will > exist, if the device is present). > > Something like > LabelDB="STICKLABEL" > FsType="ext2" Think its ext3 .. > if [ -e /dev/disk/by-label/"$LabelDB" ]; then > mount -t "$FsType" -o defaults /dev/disk/by-label/"$LabelDB" /media/"$LabelDB" > fi > Ah.. NOW we are getting somewhere. Failure of the sql daemon to start is no big deal if the stick ain't there. However, there is a problem. /media/DATABASE doesn't exist it seems..well it wouldn't..it's created at hotplug time or whatever it is! I guess I could mount over /var/lib/mysql at that..or anywhere.. Ok. made a directory called /var/lib/database, and it works on a hand start.. ....and by golly, it works on reboot too! MANY thanks: I think, overall this is the neatest quick solution. And a lot better than messing with udev rules to fire up the database when the stick is inserted. Onwards and upwards!! |
|
|||
|
In <op.us1s9liva3w0dxdave@hodgins.homeip.net> David W. Hodgins:
[Snip...] > it must be present at boot time, or you'll get dropped to single user FWIW, my experience using USB sticks in /etc/fstab is different (Kubuntu Hardy). I found (examining /var/log/messages) HAL recognized a USB stick and udev created the /dev stuff for it. However, my low-calorie fat-free window manager (twm) of course didn't care. The kernel was aware of a stick, but it wasn't (yet) known to userspace. I avoided snits /etc/fstab and mount might have doing unattached devices at boot by disabling mount in fstab for a USB stick ("noauto" option): /dev/sdc1 /media/usb auto rw,user,noauto,exec,utf8 0 0 (The "auto" option is to attempt automatic filesystem detection) So, during boot, mount doesn't pitch a fit if the stick is missing. However, "noauto" means I have to manually mount/umount the stick, but a mount /media/usb umount /media/usb sequence (assuming mountpoint "/media/usb" exists) is easy (for me). Caveat: I've heard of some snits HAL has in similar situations with ACPI and suspend/hibernate (etc.) for things like USB sticks. HTH; YMMV... -- Regards, Weird (Harold Stevens) * IMPORTANT EMAIL INFO FOLLOWS * Pardon any bogus email addresses (wookie) in place for spambots. Really, it's (wyrd) at airmail, dotted with net. DO NOT SPAM IT. I toss GoogleGroup posts from gitgo (http://improve-usenet.org). |
|
|||
|
Harold Stevens <wookie@aces.localdomain> writes:
> In <op.us1s9liva3w0dxdave@hodgins.homeip.net> David W. Hodgins: > > [Snip...] > >> it must be present at boot time, or you'll get dropped to single user > > FWIW, my experience using USB sticks in /etc/fstab is different (Kubuntu > Hardy). I found (examining /var/log/messages) HAL recognized a USB stick > and udev created the /dev stuff for it. However, my low-calorie fat-free > window manager (twm) of course didn't care. > > The kernel was aware of a stick, but it wasn't (yet) known to userspace. > > I avoided snits /etc/fstab and mount might have doing unattached devices > at boot by disabling mount in fstab for a USB stick ("noauto" option): > > /dev/sdc1 /media/usb auto rw,user,noauto,exec,utf8 0 0 > As a side issue here, anyone with any interest in a reliable system should use UUIDs for mounting removable media so you CAN automount to the same mount position reliably. |