kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: greg@kroah.com (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: USB forceful removal
Date: Tue, 8 Jul 2014 15:33:09 -0700	[thread overview]
Message-ID: <20140708223309.GA6310@kroah.com> (raw)
In-Reply-To: <CAGpXXZ+NEX1926uXCW-7f6uXjVRM9eefYUbywrnWOpMKaKTRAw@mail.gmail.com>

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@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

  reply	other threads:[~2014-07-08 22:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-08 18:43 USB forceful removal AYAN KUMAR HALDER
2014-07-08 18:55 ` Greg KH
2014-07-08 22:17   ` Greg Freemyer
2014-07-08 22:33     ` Greg KH [this message]
2014-07-09 19:06       ` AYAN KUMAR HALDER

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140708223309.GA6310@kroah.com \
    --to=greg@kroah.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).