LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-23-2008, 05:34 PM   #1
carbide
LQ Newbie
 
Registered: Mar 2008
Posts: 2

Rep: Reputation: 0
Insert/remove USB disk leaves a permanent folder


Hi

I am having some problems when inserting and removing USB disks on a 2.6.12 kernel. This seems to leave a permanent folder in /dev/scsi/ each time. First time its denoted /dev/scsi/host0/bus0/target0/lun0 second time /dev/scsi/host1/bus0/target0/lun0 and so on. If I remove the USB disk before its "officially" registered the next time it will skip a number going from eg. host6 to host8.
Anybody seen this behavior before and is there anything you can do about it?

regards
 
Old 03-23-2008, 06:19 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
I suspect something like this is going on:
When you plug in the USB drive, hotplug detects the event and creates the device node.
When you are done with the USB drive, you unplug it and hotplug does not remove the device node. It's probably happening because you didn't umount the USB disk before removing it.

Try a test:
Plug the USB drive in and wait for the new device node to appear.
Manually umount the device, then unplug the USB drive.
Did the device node remain, or did it disappear?

You can also watch /etc/mtab for the appearance and disappearance of the USB device.

Then look in /etc/udev/rules.d/50-udev-rules. You may see something like this:
Code:
BUS="scsi", PROGRAM="/sbin/udev.get_persistent_device_name.sh", NAME="%k" SYMLINK="%c{1+}", MODE="0660", GROUP="disk"
BUS="usb", PROGRAM="/sbin/udev.get_persistent_device_name.sh", NAME="%k" SYMLINK="%c{1+}", MODE="0660", GROUP="disk"
BUS="ide", PROGRAM="/sbin/udev.get_persistent_device_name.sh", NAME="%k" SYMLINK="%c{1+}", MODE="0660", GROUP="disk"
BUS="ccw", PROGRAM="/sbin/udev.get_persistent_device_name.sh", NAME="%k" SYMLINK="%c{1+}", MODE="0660", GROUP="disk"
Or, those lines may refer to "/sbin/get-unique-drive-id.sh"; in which case, change the lines to read as above.

Last edited by bigrigdriver; 03-23-2008 at 06:29 PM.
 
Old 03-24-2008, 12:58 AM   #3
ak_random
Member
 
Registered: Jun 2007
Location: Silicon Valley, CA
Distribution: Xubuntu
Posts: 83

Rep: Reputation: 15
Quote:
Originally Posted by bigrigdriver View Post
I suspect something like this is going on:
When you plug in the USB drive, hotplug detects the event and creates the device node.
When you are done with the USB drive, you unplug it and hotplug does not remove the device node. It's probably happening because you didn't umount the USB disk before removing it.
In other words, hot plugging a USB device is graceful, but hot unplugging is not? That's rather annoying.
 
Old 03-25-2008, 03:42 AM   #4
carbide
LQ Newbie
 
Registered: Mar 2008
Posts: 2

Original Poster
Rep: Reputation: 0
thanks for your help on the matter.

The problem occurs even though the usb disc is not mounted. If I insert, remove and insert it again the host number in /dev/scsi/host1/bus0/target0/lun0 will be bumped up one value.

If I, as you suggested, mount/unmount the partion and remove the disc the folder scsi/host1/bus0/target0/lun0 is still not removed from the device folder, so I gather its not related to mounting/unmounting but rather a problem with the scsi mass storage driver.

Output when inserting the usb disk:

# usb 1-1: new full speed USB device using at91rm9200-ohci and address 8
# usb 1-1: Product: DataTraveler2.0
# usb 1-1: Manufacturer: Kingston
# usb 1-1: SerialNumber: 0711080251452
# scsi6 : SCSI emulation for USB Mass Storage devices
# Vendor: Kingston Model: DataTraveler2.0 Rev: 1.00
# Type: Direct-Access ANSI SCSI revision: 02
# SCSI device sda: 1956735 512-byte hdwr sectors (1002 MB)
# sda: Write Protect is off
# sda: assuming drive cache: write through
# SCSI device sda: 1956735 512-byte hdwr sectors (1002 MB)
# sda: Write Protect is off
# sda: assuming drive cache: write through
# /dev/scsi/host6/bus0/target0/lun0:<7>usb-storage: queuecommand called
# p1
# Attached scsi removable disk sda at scsi6, channel 0, id 0, lun 0

Here I take a look at the scsi device folder and it is now using host6, also notice that it has jumped from host1 to host5 which has happened because I inserted/removed the disk a couple of times without waiting for the device to be completely registered:

ls /dev/scsi/
host0 host1 host5 host6

And from the last line of logout put I could see it has attached the disk sda at scsi6.

Another funny thing is that I have no device sda in /dev. If I want to mount the disk I have to use /dev/scsi/host6/bus0/target0/lun0/part1.

regards
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
WINE and Starcraft... Please insert disk? Tsumeone Linux - Games 24 01-31-2006 09:59 PM
Boot Disk Failure, Insert System Disk and Press Enter!! novkhan Linux - Hardware 1 12-15-2005 07:39 PM
Insert Boot-Disk and press any key computerlady911 Linux - Laptop and Netbook 7 10-04-2004 12:56 PM
pcmcia->insert twice to activate then remove to freeze Brain Drop Linux - Laptop and Netbook 8 08-02-2004 07:15 AM
Please insert Disk 4? kaega2 Mandriva 6 06-19-2004 01:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:59 PM.

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