USB forceful removal
Greg KH
greg at kroah.com
Tue Jul 8 18:33:09 EDT 2014
On Tue, Jul 08, 2014 at 06:17:56PM -0400, Greg Freemyer wrote:
> On Tue, Jul 8, 2014 at 2:55 PM, Greg KH <greg at kroah.com> wrote:
> > On Wed, Jul 09, 2014 at 12:13:28AM +0530, AYAN KUMAR HALDER wrote:
> >> Hi All,
> >>
> >> When a usb mass-storage is attached for the first time, it gets a
> >> device (/dev/sda).
> >>
> >> When it is mounted and the device is manually removed and then when it
> >> is attached again, it gets a different name ie /dev/sdb.
> >
> > Really? Not on my system, what kernel are you using?
>
> Greg, I just tried the experiment and had the above described behavior:
>
> - Connect external USB-3 drive, drive assigned /dev/sdb
> - mount -r /dev/sdb1 /mnt
> - pull the usb connector
> - wait 30 seconds, and reconnect
> - drive assigned /dev/sdc
>
> I'm running openSUSE with the distro kernel 3.11.6-4-desktop.
>
> I then added "umount /mnt" before pulling the usb connector and
> /dev/sdc was re-used on reconnect.
If you use a "desktop automount system", you don't have to worry about
this as you don't have to mount the filesystem, it will happen
automagically at /var/run/media/ and then go away when the device is
unplugged.
But yes, you are right, if you explicitly mount the filesystem, the sd
name will stay around, which is the correct kernel functionality. Same
thing happens for lots of other types of dynamic devices (ttys, char
devices, etc.)
thanks,
greg k-h
More information about the Kernelnewbies
mailing list