BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 02-24-2007, 12:33 PM   #1 (permalink)
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Posts: 2,166
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Reference: mass storage + linux

Please Login to Remove!

This isn't a HowTo -- merely a reference example of how things should look on your linux system when USB Mass Storage is working properly; if yours is not working, take a look at my syslog et. al. for a little sanity check. The exact results will vary on a distro-by-distro bases, this is a Fedora Core 6 system.

Assumptions:
- BB device with external SD card (8100, 8800, etc.)
- modern linux kernel with 'usb-storage' module compiled
- standard USB cable
- BB device set to USB Storage either 'Yes' or 'Prompt' mode

First, make sure your device at lease has Mass Storage turned on in some fashion -- Options, Advanced Options, Media Card on the handset. The settings should be pretty clear what to do.

(for reference, 'ender' is my laptop's name)

First, prepare to watch your syslog messages; gain root privileges and tail the log. I like to hit Enter a few times after running this to create some blank space on screen so it's easier to see.

Code:
[root@ender /root]
# tail -f /var/log/messages
My device will be set to 'Yes' for this example. Plug in your device and your kernel should automatically load the module "usb-storage" for you, and detect the BB sd card as a scsi device (so drives sda, or sdb, etc.).

Code:
Feb 24 10:16:08 ender kernel: usb 5-3.5: new full speed USB device using ehci_hcd and address 38
Feb 24 10:16:08 ender kernel: usb 5-3.5: config index 0 descriptor too short (expected 69, got 32)
Feb 24 10:16:08 ender kernel: usb 5-3.5: configuration #1 chosen from 1 choice
Feb 24 10:16:08 ender kernel: Initializing USB Mass Storage driver...
Feb 24 10:16:08 ender kernel: scsi2 : SCSI emulation for USB Mass Storage devices
Feb 24 10:16:08 ender kernel: usbcore: registered new interface driver usb-storage
Feb 24 10:16:08 ender kernel: USB Mass Storage support registered.
Feb 24 10:16:13 ender kernel: scsi 2:0:0:0: Direct-Access     RIM      BlackBerrySdCard 0001 PQ: 0 ANSI: 4 CCS
Feb 24 10:16:13 ender kernel: SCSI device sdb: 3970048 512-byte hdwr sectors (2033 MB)
Feb 24 10:16:13 ender kernel: sdb: Write Protect is off
Feb 24 10:16:13 ender kernel: sdb: assuming drive cache: write through
Feb 24 10:16:13 ender kernel: SCSI device sdb: 3970048 512-byte hdwr sectors (2033 MB)
Feb 24 10:16:13 ender kernel: sdb: Write Protect is off
Feb 24 10:16:13 ender kernel: sdb: assuming drive cache: write through
Feb 24 10:16:13 ender kernel:  sdb:
Feb 24 10:16:13 ender kernel: sd 2:0:0:0: Attached scsi removable disk sdb
Feb 24 10:16:13 ender kernel: sd 2:0:0:0: Attached scsi generic sg1 type 0
Feb 24 10:16:14 ender hald: mounted /dev/sdb on behalf of uid 500
Above you see the kernel has loaded usb-storage, which in turn detected the card and has assigned it drive "sdb" (sda is my internal disk, a SATA drive). Furthermore the Fedora Core subsystem has automatically mounted my device for me, which may or may not happen with your particular distro.

If you need to mount it by hand, here is the entry from /etc/mtab (the place where the kernel tracks mounts, don't edit this file!) on my machine that corresponds to the mount:

Code:
/dev/sdb /media/disk vfat rw,noexec,nosuid,nodev,shortname=winnt,uid=500 0 0
This line, in a slightly tidier version, can be added to your /etc/fstab file (you *can* edit this file, but make sure you know what you're doing. when in doubt make a backup first.) to automount it for you; this part is distro specific, so use the best practices as appropriate. Most modern distros have a GUI tool to set this up, so try using that first.

When you unmount the device: if you need to just yank the cable out and go (say you're in a hurry) at least be sure to type "sync" on the commandline real quick to force all writes to disk. The better way, of course, is to properly unmount the device using the 'umount' command or the Eject menu option if it shows on your desktop.

The messages with a clean unmount and cable disconnect - I will use the 'Unmount Volume' rightmouse option on my Fedora Core desktop - should look like this more or less:

Code:
Feb 24 10:24:45 ender hald: unmounted /dev/sdb from '/media/disk' on behalf of uid 500
Feb 24 10:24:54 ender kernel: usb 5-3.5: USB disconnect, address 38
If you just yank the cable out and go, it might look like this:

Code:
Feb 24 10:26:03 ender kernel: usb 5-3.5: USB disconnect, address 39
Feb 24 10:26:03 ender kernel: VFS: busy inodes on changed media.
Feb 24 10:26:03 ender kernel: scsi 3:0:0:0: rejecting I/O to dead device
Feb 24 10:26:03 ender last message repeated 3 times
Feb 24 10:26:03 ender kernel: sdb : READ CAPACITY failed.
Feb 24 10:26:03 ender kernel: sdb : status=0, message=00, host=1, driver=00 
Feb 24 10:26:03 ender kernel: sdb : sense not available. 
Feb 24 10:26:03 ender kernel: scsi 3:0:0:0: rejecting I/O to dead device
Feb 24 10:26:03 ender kernel: sdb: Write Protect is off
Feb 24 10:26:03 ender kernel: sdb: assuming drive cache: write through
Feb 24 10:26:03 ender hald[2556]: forcibly attempting to lazy unmount /dev/sdb as enclosing drive was disconnected
Feb 24 10:26:03 ender kernel: scsi 3:0:0:0: rejecting I/O to dead device
Feb 24 10:26:03 ender hald: unmounted /dev/sdb from '/media/disk' on behalf of uid 0
As you can see by the syslog spam, it's not a good thing to just yank out the cable - try and avoid that if you can and properly unmount the device. But, we live in the real world and sometimes that's not always possible.

==
NOTE: kernel "kernel-2.6.19-1.2911.fc6" was used in the above examples on a ThinkPad T43 with the Pearl 8100 plugged into an external powered USB 2.0 hub. So, you do not need to be directly plugged in to the machine on a direct USB port, hubs work fine. I would *not* recommend using a non-powered USB hub.
__________________
[ Linux & BlackBerry ] http://www.blackberryforums.com/linux-users-corner/

Last edited by rivviepop : 02-24-2007 at 12:36 PM.
Offline  
Old 02-24-2007, 12:38 PM   #2 (permalink)
BlackBerry God
 
LunkHead's Avatar
 
Join Date: Jan 2005
Location: Here
Model: 850
OS: 0.0.00001
PIN: kie swear
Carrier: USPS Priority
Posts: 10,992
Post Thanks: 160
Thanked 158 Times in 59 Posts
Default

You Sir, ROCK!

*bows* giving the 'I am not worthy' move
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.