Auto-Drive ... Mounts ALL removable media.

Under development: PCMCIA, wireless, etc.
Post Reply
Message
Author
User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

Auto-Drive ... Mounts ALL removable media.

#1 Post by sunburnt »

I wrote the original utility about 4 years ago, it doesn`t work now.
The new Auto-Drive auto. mounts and unmounts all removable devices.
All devices and media that are detected in the file: /proc/partitions
It averages about a 7 second delay from plug in until ROX pops up.

The tar gzip file is NOT an install file !!!
Start rxvt in the dir. where the auto-drive file is and type this:

Code: Select all

tar -xzf auto-drive_b(version).tar.gz -C /usr/sbin
To start it, in rxvt type the command line: auto-drive
To start it at boot, add the line "auto-drive" to the file: /etc/rc.d/rc.local

### Beta 1
1 Popup message box if mount or unmount fails.
2) Adds the drive to ROX and GTK menus.
3) Start, mount, and unmount events set Firefox`s Download path.
4) Command line argument: -rox = Start ROX Filer with drive`s path.
5) All removable devices are mounted and unmounted now!!!
..... Should work with: SD cards, USB, Firewire, SATA & SCSI hot swaps!

### Beta 2 ... Bug fixes and a few improvements.

### Beta 3 ... More bug fixes. Final soon...

NOTES: I have no SATA, SCSI, or FireWire drives to test it with.
To refresh external media card readers, unplug and replug them.

Comments and bug reports are welcome... Thanks!
Attachments
auto-drive_b3.tar.gz
To install open a rxvt in the dir that auto-drive_b(version).tar.gz is in,
and type into rxvt: tar -xzf auto-drive_b(version).tar.gz -C /usr/sbin
(2.24 KiB) Downloaded 782 times
Last edited by sunburnt on Wed 14 Oct 2009, 02:57, edited 27 times in total.

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#2 Post by ecomoney »

ahhh...."Just works", the most often requested feature of a computer :D

I havnt had tested yet, beforehand I was wondering if it were possible to add a feature to the script whereby it adds bookmarks to rox and gtk for the newly mounted storage devices, and removes them when they are detached again?

The bookmarks are stored in text files here

/root/.config/rox.sourceforge.net/ROX-Filer/Bookmarks.xml
/root/.gtkbookmarks.xml

This would add a lot of usability to puppy, as ive noticed new users find it very hard to find their files if they are not used to the /mnt/location setup of the linux filesystem.
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#3 Post by sunburnt »

### New Beta 2 version.

The old one did not do several USBs at the same time, Fixed I think...

I noticed it has trouble unmounting the USB if Rox is left in the USB dir.
You must change Rox`s path out of the USB drive`s path or close Rox.
Rox use to close when it`s path was no longer valid, WHAT HAPPENED?

### Development help requested...

I don`t have any USB drives with more than 1 partition on it.
If someone has one, could they test usb-auto to see if it mounts all the partitions
I looked at the old code and the new code may have errors in it for this.
.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#4 Post by mikeb »

Should there be more than one file...seems to be looking for usb-auto_mount and umount. How does one unmount? Only detected one partition.

The good news is.......

mike

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#5 Post by sunburnt »

Hi mikeb; Could you do this for me?

1) First plug in your multi. partition USB.
2) Then open a Rox file window, go to: /sys/block
___ There should be a dir. for your USB, like: /sys/block/sda
3) Go into that dir. and see if there`s dirs. for the partitions, like;
___ /sys/block/sda/sda1
___ /sys/block/sda/sda3

I don`t know what numbers will be used, but HDs use 1,3,4,5...
I already know that there is a dir.: /sys/block/sda/sda1
If the other dirs. exist, and they should, I`ll use them for usb-auto.

Note: The errors for the missing file are tests for ecomoneys wish list.
Thanks for your help... Terry

User avatar
rhadon
Posts: 1292
Joined: Thu 27 Mar 2008, 11:05
Location: Germany

#6 Post by rhadon »

Hi sunburnt,

I don't need auto-mount but I'm curious, so I've tested it (with uPup and Puppy 4.3beta).

Configuration:
EeePc 900
sda1-3 and sdb1 build-in memory chips
sdc1-3 internal card reader with 16GB-card
sdd1-5 USB-stick 16GB

auto-mount finds only each first partition. Exception: booting from sdc3, sdc1 will not be mounbted.

In /sys/block/(e.g.)sdd/ there are the folders sdd1-5.
The same with sda, sdb and so on.

I think, auto-mount_b2 must be renamed to usb-auto_mount or symlinked.

If I pull out the stick (sdd) I get the same problem as mikeb:
UnMount sdd1
ls: cannot access /usr/sbin/usb-auto_umount: No such file or directory
If I push the stick in again, first partition will be mounted again.

OK, I just read that this is for testing purposes. :oops:

Hope, this helps

Rolf
Ich verwende "frugal", und das ist gut so. :wink:
Raspberry Pi without Puppy? No, thanks.

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#7 Post by ecomoney »

Cheers for all the help with this, I left my pendrive at work :oops: so I cant help test until I go in again tommorow.
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#8 Post by mikeb »

when plugged in...

Code: Select all

/sys/block/sda/sda1 
/sys/block/sda/sda2
I did notice generally sometimes a drive was mounted as sdax and sometimes sdbx.

probepart and mut probepart both give the correct result.

mike

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#9 Post by sunburnt »

Thanks mikeb, that`s just what I suspected...
I`d use probepart, but I want usb-auto to be portable to other Linuxes.

Thanks rhadon; It`s good to see media card readers work.
The problem I had with them last time is that it`s the reader that`s recognized.
So swapping cards while the reader`s plugged in does nothing.
The reader has to be unplugged and plugged in again to work ( sad ).

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#10 Post by sunburnt »

### Completely reworked new version... Beta 3

I changed the entire app. setup, unfortunately it`s still slow, about 7 seconds to mount a USB.
At least the report errors in the console are gone.
Works good for first partition of several USBs.

### Need someone to test it on a USB with several partitions on it.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#11 Post by mikeb »

Code: Select all

###################  Starting: USB-Auto
Mount sda1
Mount sda2
mount: Mounting /dev/sda2 on /mnt/sda2 failed: Invalid argument
partition 2 is ext2

mike

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#12 Post by sunburnt »

Het mikeb; The drive being ext2 or ext3 doesn`t matter, I have both vfat and ext2 drives.

Your report is most worry some, the code does what it`s supposed to.
For some unknown reason the mount command failed, very bad.
The mount command works for the first partition, why not the second?
You can see I used the "sync option" so the writes to the usb are instant.
Here is the command line:

Code: Select all

mount -o sync /dev/$PART /mnt/$PART
mikeb... Can you try mounting partition #2 with this command:

Code: Select all

mount -o sync /dev/sda2 /mnt/sda2
### NOTE: I made a "probepart" version using Barry`s utility.
I hoped it might speed usb-auto up a bit, but sadly it ran even slower.

User avatar
rhadon
Posts: 1292
Joined: Thu 27 Mar 2008, 11:05
Location: Germany

#13 Post by rhadon »

Hi,
I also tried auto-mount_b3, same config like before plus 1 USB-HD (sde1-8 )
There seems to be no try to mount more than the first partition:
# usb-auto_mount
################### Starting: USB-Auto
Mount sda1
################### Starting: USB-Auto
Mount sdb1
################### Starting: USB-Auto
Mount sdd1
################### Starting: USB-Auto
Mount sde1
################### Starting: USB-Auto
Puling out USB-stick and put it in again:
UnMount sdd1
Mount sdd1
################### Starting: USB-Auto
Pulling out USB-HD and put it in again:
Mount sdf1
################### Starting: USB-Auto
It seems to be not unmounted and got a new name.

Trying to mount some partitions with the command e.g. sda3:
mount -o sync /dev/sda3 /mnt/sda3
I get the message
# mount -o sync /dev/sda3 /mnt/sda3
mount: mount point /mnt/sda3 does not exist
only swap-partitions are recognised correct (of course coldn't be mounted):
# mount -o sync /dev/sdd2 /mnt/sdd2
/dev/sdd2 looks like swapspace - not mounted
mount: you must specify the filesystem type
#
With auto-mount_b2 I could stop the process with ctrl+c. This doesn't work anymore.

I just run Pprocess 1.0 Process manager and find the processes attached below.
Isn't it too much?
I'm not familiar with this stuff, so sorry if I'm wrong.

I hope, this is a little bit helpful

Rolf
Attachments
process-auto-mount01.jpg
(45.88 KiB) Downloaded 2754 times
Last edited by rhadon on Tue 25 Aug 2009, 10:51, edited 3 times in total.
Ich verwende "frugal", und das ist gut so. :wink:
Raspberry Pi without Puppy? No, thanks.

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#14 Post by ecomoney »

Just a note, Ive yet to see a pendrive formatted with multiple partitions. Does this code work reliably with a single partition?
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#15 Post by mikeb »

### NOTE: I made a "probepart" version using Barry`s utility.
I hoped it might speed usb-auto up a bit, but sadly it ran even slower.
nope probepart in 4 (a script) is much slower than in puppy 2( a binary). mut probepart on the other hand is very efficient..i used that for my autorefreshing pmount for low cpu and fast refresh.
Just a note, I've yet to see a pendrive formatted with multiple partitions. Does this code work reliably with a single partition?
perhaps I'm the only one..booting windows on the first and puppy on the second...I probably have the last lead solder in the world. Thing is, would use of this include usb hard drives which are quite often partitioned.

mike

edit...large drive split up to keep use of fat16 perhaps

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#16 Post by sunburnt »

mikeb; where is the MUT probepart, and what is it called?

ecomoney; I have tested usb-auto repeatedly and it works for the first partition every time.
I see no reason that you can`t make use of it as it is, I`ll continue dev. and inform you...
Test it yourself, plug and unplug several USbs in all manner of patterns.
If you have no trouble, then that makes 2 of us with good test results.

rhadon; This looks like you`re starting usb-auto for each usb you`re plugging in!!!

Code: Select all

# usb-auto_mount
################### Starting: USB-Auto
Mount sda1
################### Starting: USB-Auto
Mount sdb1
################### Starting: USB-Auto
Mount sdd1
################### Starting: USB-Auto
Mount sde1 
And the processes window that you posted verifies this!
usb-auto should only be run once!
Ctrl-C is working, there`s just a dozen copies running!
### Your attempt to mount a USB failed because you didn`t make the mount point (dir.) first!

Code: Select all

# mount -o sync /dev/sda3 /mnt/sda3
mount: mount point /mnt/sda3 does not exist 
The error report tells you this, you must make the mount dir. first...

Code: Select all

mkdir /mnt/sda3
mount -o sync /dev/sda3 /mnt/sda3
I`m sorry about the confusion, most folks familiar with Linux know this...
### The one report says it needs the File System type.
Please run the mount command again on a second partition like this:

Code: Select all

mkdir /mnt/sda2
mount -o sync /dev/sda2 /mnt/sda2
You said that the second partition was a ext2, right?
If it fails, then try this:

Code: Select all

mount -t ext2 -o sync /dev/sda2 /mnt/sda2
You already made the mount dir., so you don`t need to do it again.
This time you`re supplying the File System type, maybe it`ll work.
Let me know. Thanks for your time... Terry

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#17 Post by mikeb »

mut is a multicall binary like busybox..included with most puppy 4.x
eg 'mut probepart' mimics probepart etc
also has a daemon mode
mut --help gives details

mike

User avatar
rhadon
Posts: 1292
Joined: Thu 27 Mar 2008, 11:05
Location: Germany

#18 Post by rhadon »

Hi sunburst,

thank you for your explanation.

I've started usb-auto_mount only once from console!

There's a big difference between b2 and b3.

Same configuration:
sda and sdb= internal memory chips
sdc = card reader, SDHC-card
sdd = USB-stick
card and stick inserted, booting from sdc3, so only sdc3 is mounted,.

Running b2:
I get 4 entries in Process manager
Each time I unmount and mount sdd again I get 1 new entry in Process manager.
(seems to be OK)

Running b3, same conditions as before, only sdc3 (bootpartition) is mounted:
I get 10 entries in Process manager.
Each time I unmount and mount sdd again I get 3 new entries.
With other words: auto_mount starts new for each partition it mounts by the first start.

Yes, Ctrl+C works, I was confused by the the difference between b2 and b3 (multiple processes).

And last not least, you're right, mkdir was the missing puzzle for mounting. :oops:
Thank's again..
HTH

Rolf

Edit: btw: There is really no need for 5 Partitions on a pendrive (for me). I did it for testing and till now I was too lazy to delete it. I use only 2 partitions: 1 ntfs for copying files from windows and 1 ext3 with GRUB for some Puppies. Next I will use a 3rd partition for a truecrypt-container (works fine with my SD-card). :D
Ich verwende "frugal", und das ist gut so. :wink:
Raspberry Pi without Puppy? No, thanks.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#19 Post by sunburnt »

Hi rhadon; I wrote a little daemon script to watch usb-auto processes.
It shows only 1 usb-auto process until plugin, then for a moment there are 2 or 3 processes.
The others are probably the mount process as they`re different process numbers.
With 2 USBs plugged in, there`s only 1 usb-auto process.

The process that you are looking for is called: usb-auto ... NOT: usb-mount !
There`s a process: [usb-storage] , it`s the Puppy USB handler daemon (too bad it won`t mount it).
I could post my little processes daemon if it`ll help you...

Anyway... What we really need to know is...
What partitions are mounted when you have ONLY the USB with multi. partitions plugged in?
This way we`re testing only the multi. partition part of the code...
If it only mounts the first partition, then do the manual mount command.
Tell me if manual mounting did it, if not try the mount command with the FS type in it and tell me.

P.S. You did not say what the big difference between -b2 and -b3 is...

Thanks again for your help... Terry

User avatar
rhadon
Posts: 1292
Joined: Thu 27 Mar 2008, 11:05
Location: Germany

#20 Post by rhadon »

Hi sunburst,
sunburst wrote:The process that you are looking for is called: usb-auto ... NOT: usb-mount !
Yes, that's what I was talking about (see attachment "process-auto-mount01.jpg" in earlier post.
What partitions are mounted when you have ONLY the USB with multi. partitions plugged in?
Sorry, that I haven't mentioned before: on sda and sdb there is XP installed (sda1 and sdb1) plus a mini-partition for GRUB (sda3, 7MB) plus a mini-swap-patition (sda2, 23MB, built only for testing, not really useful). So for running Puppy I need one additional medium: sd-card, usb-stick or usb-cd. I tried all 3 with the same result: 3 processes usb-auto_mount plus 7 processes like usb-auto-mount sdXn.In the meantime I think this problem is caused by the internal chips sda and sdb.

Everytime only the first partition of each drive will be mounted.Exception: if I boot from sd-card (sdc3), sdc1 will not be mounted.

I can mount all ext3 and ntfs partitions manually without adding fs type (wiith mkdir first, lol).

With 'big difference' between -b2 and -b3 I opined that -b2 seems to run OK (meaning only one process of usb-auto_mount) but -b3 runs 3 times simultaneously everytime.

Last but not least there is no reason to solve this problem just for me. I mentioned in my first post that I don't need this program. I like to have control about what's mounted or not.Also I can see it could be very useful for others and I like to help (and of course to learn by the way). So whatever I can do, let me know..

Rolf
Ich verwende "frugal", und das ist gut so. :wink:
Raspberry Pi without Puppy? No, thanks.

Post Reply