LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 07-11-2005, 02:57 PM   #1
friendly_guy
Member
 
Registered: Oct 2003
Location: England
Distribution: Lubuntu, Bodhi, Puppy,
Posts: 85

Rep: Reputation: 15
simple autofs solution


I have made a live CD using Slack 10.1 with a custom compiled 2.6.12 kernel & the Linux Live scripts. I am using windowmaker as the desktop.

I would like to be able to set it up to automount any usb pendrive attached - a great asset on a live disc. I know this is done through autofs.

I have googled & read a lot on this, as well as searched this forum, but, to be honest, a lot of it is above my head. Also some of what I have found is designed to set up for ones own kit where this needs to be more flexible.

Does anyone know of a basic way to set up what I want or where such instructions can be found?

I will be very grateful for any crumbs of wisdom.
 
Old 07-12-2005, 08:31 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Autofs is not difficult...

1. do you use a 2.4 or 2.6 kernel ?
2. have you installed autofs package yet ?
3. when your plug your usb device, is it recognized as /dev/sda ?
 
Old 07-12-2005, 11:43 AM   #3
friendly_guy
Member
 
Registered: Oct 2003
Location: England
Distribution: Lubuntu, Bodhi, Puppy,
Posts: 85

Original Poster
Rep: Reputation: 15
1: 2.6.12 (see above), yes to 2 - the third depends on what other scsi gear the host computer has (this is a 'live' system).

I have since found that by adding the line:

BUS="scsi",SYSFS_type="0",NAME="%k",SYMLINK="pen"

to my /etc/udev/rules.d/udev.rules file under the 'scsi' heading means that there is now a symlink to it called 'pen' & it can be mounted as /dev/pen. My problem now is to get the system to mount it automatically on attachment. Because it is a live CD bear in mind that it will run on many machines with many devices & generates its /etc/fstab at boot. That would not stop us using a script, say using rc.local, to append a line if need be.

The other problem I have had to contend with is that my main system has an adaptec scsi motherboard & 2 scsi hard drives - a good testing ground though as the system needs to be able to distinguish between those sd* partitions (5 in all) & the pen drive (on that system the pen is actually sdc1). So far my rule appears to work, but whatever I do must bear this in mind and not break it. The idea is for a live music production CD that will work on any system, including those with other scsi devices. This is why a pen drive is important: for portability of files & use with m$ systems that only have NTFS partitions.

Last edited by friendly_guy; 07-12-2005 at 12:01 PM.
 
Old 07-12-2005, 12:40 PM   #4
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Sorry for the 1

I assume you compiled the kernel with autofs...

So basically you have to download a rc.autofs
http://mariner.cs.ucdavis.edu/slackw...ware/rc.autofs

Install it in /etc/rc.d chmod +x it

create /etc/auto.master with the content :
Code:
/usb    /etc/auto.usb
create /etc/auto.usb with the content :
Code:
pen   -fstype=auto  :/dev/pen
Create the directory /usb if it does not exist

Now start autofs : /etc/rc.d/rc.autofs start

Plug the pen and try : ls -l /usb/pen

Last edited by keefaz; 07-12-2005 at 12:42 PM.
 
Old 07-12-2005, 05:31 PM   #5
friendly_guy
Member
 
Registered: Oct 2003
Location: England
Distribution: Lubuntu, Bodhi, Puppy,
Posts: 85

Original Poster
Rep: Reputation: 15
Simple instructions & clear as a bell - great! I will try is ASAP - I have some work to do before I can get to the fun :0(

Thanks for the prompt reply

Guy
 
Old 07-12-2005, 07:25 PM   #6
egag
Senior Member
 
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721

Rep: Reputation: 53
oh...and make sure you hit " enter " after typing those lines in
" /etc/auto.master " and " /etc/auto.usb ".

egag
 
Old 07-12-2005, 07:29 PM   #7
friendly_guy
Member
 
Registered: Oct 2003
Location: England
Distribution: Lubuntu, Bodhi, Puppy,
Posts: 85

Original Poster
Rep: Reputation: 15
Works great thanks.

The only thing I did not understand was that it mounts on demand & then unmounts. I was opening an empty file browser on the /usb folder & wondering why. For it to work from the file browser (rox filer) I had to create a link (I did this in /mnt) pointing to /usb/pen.

When clicked this 'calls' the pendrive & bingo! the pen is mounted. Thanks keefaz, I am thrilled with the result.

I just need to figure out how to put the link into the live filesystem as it creates /mnt at boot. Ah well, a little light hacking with scripts should sort that.
 
Old 07-13-2005, 04:49 AM   #8
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
On any file browser (even web browser) you should be able
to make a link to /usb/pen without symlink in /mnt, try :
Code:
file://usb/pen
Quote:
...empty file browser on the /usb folder & wondering why.
At this time the /usb/pen was not mounted, you have to execute
a command like ls, cd...in this dir to get it mount, but try the file:// link
 
Old 07-13-2005, 05:25 AM   #9
friendly_guy
Member
 
Registered: Oct 2003
Location: England
Distribution: Lubuntu, Bodhi, Puppy,
Posts: 85

Original Poster
Rep: Reputation: 15
Where I am using rox filer (this is a minimalist sytem, the idea is to keep all processor power for the music) there is not an address bar to type anything in like there is on say, Konqueror.

The symlink works fine though *and* it makes the drive available through /mnt which is consistent with how the menuing system is set up (there is an entry for 'attached filesystems' that brings up a rox window of /mnt).

I have yet to get it fully sorted to make sure it works 'live' but, barring silly unforseeable problems I think I can.

This = 1 happy bunny
 
Old 07-13-2005, 07:18 AM   #10
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
You could plug your pen and mount it with :
cd /usb/pen

then create a symlink anywhere you want :
ln -s /usb/pen /home/friendly_guy

Umount the device :
cd /home/friendly_guy (wait for 2 sec or so)

Then open rox and click on the pen icon in /home/friendly_guy

[edit]
Well, maybe your /mnt symlink solution is better in system wide point of view

Last edited by keefaz; 07-13-2005 at 07:20 AM.
 
Old 07-13-2005, 06:40 PM   #11
friendly_guy
Member
 
Registered: Oct 2003
Location: England
Distribution: Lubuntu, Bodhi, Puppy,
Posts: 85

Original Poster
Rep: Reputation: 15
It might interest you that you do not have to create the directory /usb. I have put a command to create the symlink in rc.local & deleted /usb & when I reboot & use the symlink the directory is created.

It all works perfectly on the hard drive. I just need to test it by making the live CD, but not 2nite. I don't know what time zone you are on but here it is past time I was asleep!
 
  


Reply



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
A simple DNS solution mangueJOE Linux - Networking 10 04-09-2006 12:45 AM
Ethernet detection order - simple solution for slackware 10 gtalev Slackware 0 08-16-2004 04:50 PM
My Simple Security Solution For Linux bjdea1 Linux - Security 10 04-02-2004 06:39 PM
Probably a simple solution 2 a tar question Cruger Programming 6 03-23-2004 09:32 AM
I need a reliable, simple backup solution kkempter Linux - Software 1 02-05-2003 12:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 01:28 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
Open Source Consulting | Domain Registration