Translations of this page:
Auto-Mount USB Storage Devices

What does this do?

These instructions show how to configure your Eee to silently mount different SD cards and USB thumb drives in the location of your choice. They'll be mounted at startup if their already inserted or mounted when you insert them, but without the GUI detection dialog. The GUI will still show for any device you haven't specifically configured.

For example, you could have one SD card full of games that automatically mounts itself under /home/user/games and another used for photos that automatically mounts under /home/user/photos.

You can then swap between the cards as needed, however you need to unmount them manually from the command line before removing them to avoid corrupting your data. There will also be no tray icon for inserted and mounted devices.

The following instructions can be repeated any number of times to configure different devices to be mounted in different locations

Find out the serial number of your device

  1. Insert your SD card or USB thumb drive
  2. Open the terminal (Ctrl-Alt-T in Easy mode, run konsole in Advanced). All actions below are performed in a terminal window. You may note some commands end with an ”&”. This makes them run in background, so that if you say run a GUI editor like KWrite, you can get your terminal prompt back for further commands, even with KWrite still running.
  3. Save the contents of a virtual file /proc/bus/usb/devices into a real file in your home directory
    cat /proc/bus/usb/devices > /home/user/usb_devices.txt
    
  4. Open /home/user/usb_devices.txt in an editor
    kwrite /home/user/usb_devices.txt &
    
  5. Find your device and serial number. Look for sections where the I: line ends with Driver=usb-storage, a few lines above you will find the serial number of the card reader. Some devices will also have a product name you might recognise. It is this name that prevents some of them mount properly, preventing you to access them. Look for a line with Product=USB DISK 2.0 (note this is just an example, and your name may be different or not there at all).
T:  Bus=05 Lev=01 Prnt=01 Port=04 Cnt=02 Dev#=  2 Spd=480 MxCh= 0
  D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
  P:  Vendor=0cf2 ProdID=6225 Rev= 1.00
  S:  Manufacturer=ENE
  S:  Product=UB6225
  S:  SerialNumber=146030377350
  C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=498mA
  I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
  E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
  E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

Note: You could also run this command from the terminal prompt:

grep -A 1 Product /proc/bus/usb/devices

This will show just the “Product” and “SerialNumber” lines of the above process.

Configure device detection

  1. Make note of the serial number, or just keep the file open for cut and paste.
  2. Edit /etc/udev/rules.d/50-xandros-udev.rules. You need to be root to do it:
    sudo kwrite /etc/udev/rules.d/50-xandros-udev.rules &
    
  3. Find the comment
    # usb, removable storage
  4. Immediately after this comment, so that it will replace the Asus dialog, add the following line, changing the serial number to match your device and optionally changing the name sdcard1 (in both places)
    BUS=="usb", KERNEL=="sd*", SYSFS{serial}=="146030377350", NAME="sdcard1", OPTIONS+="last_rule", RUN+="/bin/mount /dev/sdcard1"
  5. Make sure the above line is correct, especially taking care the number and placement of ”=” signs is matching. Probably the best thing to do is to copy and paste the line above, then change sdcard1 if required.

Create mount point directory

  1. Execute:
    mkdir /path/to/mount/point

    eg:

    mkdir /home/user/games
  2. If you want to create a mount point outside your /home/user directory you will have to add “sudo ” to the beginning of the command above.

Configure mount point

  1. Edit /etc/fstab. This, too, has to be done as root, so do:
    sudo kwrite /etc/fstab &
  2. Add a new line at the end
    /dev/sdcard1              /home/user/games    vfat    rw,uid=user
  3. If your device is formatted with a file system different to FAT32, substitute “vfat” with the appropriate label: ntfs for NTFS, ext2 for ext2, ext3 for ext3, and so on. You can have a look at the file system used by looking at the virtual file /etc/mtab while the device is still plugged in and mounted (it will be if you didn't remove it since you started this procedure).
    sudo cat /etc/mtab
  4. Now you can save and close all the files you have been editing, before:

Testing your new config

  1. Restart your Eee
  2. Device should now be mounted in correct location
  3. To remove the device, execute:
    sudo umount /path/to/mount/point

    then physically remove.

  4. IMPORTANT: If you don't do the above before removing the device then you'll corrupt your data. It may also be wise to execute a sync command beforehand as well (this should flush any delayed writes to all disks). I suggest creating a desktop icon that runs it.

Automatic umount

For instructions on how to set up an automatic umount see http://wiki.eeeuser.com/howto:properumountstorage

 
howto/automountusbstorage.txt · Last modified: 2008/05/16 19:09 by mumrel
 
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
This website is no longer under a Creative Commons license.
All rights are reserved by Eeeuser.com and each individual author
If you want to reproduce content, all individual contributers must be identified and you must seek permission from Eeeuser.com