Topic: Automounting SD or other storage with Openbox Autostart
Hey all,
My first ever linux tip-idea below after I fiddled for a good while trying to figure it out. The goal was to automatically mount my SD card partitions to particular locations so that when Dropbox fired up, the location it was looking for would be ready. For some reason a simple fstab edit was not working, so this is what I came up with that seems to be working.
NOTE: Turns out this was necessary because of certain powersaving configurations that avoided turning on (polling) my SD card slot on without be manually asked.
First locate and note the partition or disk you want to mount: for instance /dev/sdb1 or /dev/sdc etc. (Using gparted is a very easy gui way to do this.)
Create directories you want to mount to with terminal: enter following commands
sudo mkdir /media/dropbox(to create a media directory for dropbox...may want something esle.)
Edit fstab file in Terminal (presume you've installed gedit):
enter command:
sudo gedit /etc/fstabAt the end add lines for all the partitions you want to edit in the following formulas:
location_of_disk <tab> mount_point <tab> filesystem <tab> option,option,option <tab> 0 <tab> 0.
for example, to mount /dev/sdb1 to /media/dropbox using a fat32 files system i want read/write and execute capabilities i would write...
/dev/sdb1 /media/dropbox vfat noauto,user,exec,rw 0 0Save and close fstab.
Create a new shell script to mount disks or partitions:
Create a new text file and remember where you put it... for instance /home/user/bin/mount.sh
Write the very simple script in just created file:
#!/bin/bash
mount /media/dropbox
#end**Note: just add additional 'mount /location' commands for each addition disk or partition you added to your fstab.
Make script executable in terminal with command:
chmod +x /home/user/bin/mount.sh Open autostart.sh via the Openbox Config meun.
Add the following lines:
#Mount Media for Dropbox
(sleep 2s && /home/user/bin/mount.sh) & **Note, using the sleep command is optional (i think). Make sure to place this mount before any program which may try to access files on it.
Reboot your computer, and hopefully your media should be automatically mounted.
Let me know if you have any corrections / simplifications. This way has given me the most consistent results yet. However I should note I've been using linux all of a week.
Cheers.
Last edited by jmbarnes (2010-03-23 02:41:44)