26

I've an USB key that I want to format, but I can't :

  • format it in command line :

Results:

mint@mint ~ $ sudo mkfs.ext2 /dev/sdb
mke2fs 1.42.9 (4-Feb-2014)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
mkfs.ext2: Permission denied while trying to determine filesystem size
mint@mint ~ $ sudo mkfs.ext2 /dev/sdb1
mke2fs 1.42.9 (4-Feb-2014)
Could not stat /dev/sdb1 --- No such file or directory

The device apparently does not exist; did you specify it correctly?
  • create a partition :

Results:

mint@mint ~ $ sudo fdisk /dev/sdb
fdisk: unable to open /dev/sdb: No medium found
  • see it in GParted or in USB Stick Formatter

  • see a the partition with ls -l /dev/sd*

Results:

mint@mint ~ $ ls -l /dev/sd*
brw-rw---- 1 root disk 8,  0 Jan  4 14:43 /dev/sda
brw-rw---- 1 root disk 8,  1 Jan  4 12:07 /dev/sda1
brw-rw---- 1 root disk 8,  2 Jan  4 14:43 /dev/sda2
brw-rw---- 1 root disk 8,  5 Jan  4 11:22 /dev/sda5
brw-rw---- 1 root disk 8, 16 Jan  4 12:30 /dev/sdb
  • read from it

Results:

mint@mint ~ $ sudo dd if=/dev/sdb of=/tmp/xxx bs=512 count=1
dd: failed to open ‘/dev/sdb’: No medium found
mint@mint ~ $ sudo dmesg | tail
[22002.140008] usb 2-1.4: new high-speed USB device number 12 using ehci-pci
[22002.238743] usb 2-1.4: New USB device found, idVendor=090c, idProduct=3000
[22002.238748] usb 2-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[22002.238750] usb 2-1.4: Product: SM3252A MEMORY BAR  
[22002.238752] usb 2-1.4: Manufacturer: Silicon Motion,Inc. 
[22002.239190] usb-storage 2-1.4:1.0: USB Mass Storage device detected
[22002.239430] scsi37 : usb-storage 2-1.4:1.0
[22003.238585] scsi 37:0:0:0: Direct-Access              USB MEMORY BAR   1000 PQ: 0 ANSI: 0 CCS
[22003.241074] sd 37:0:0:0: Attached scsi generic sg2 type 0
[22003.246714] sd 37:0:0:0: [sdb] Attached SCSI removable disk
  • find it using fdisk :

Results:

mint@mint ~ $ sudo fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x2aa8f047

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   362375167   181186560    7  HPFS/NTFS/exFAT
/dev/sda2       362378205   823732874   230677335    f  W95 Ext'd (LBA)
Partition 2 does not start on physical sector boundary.
/dev/sda5       362378268   823732874   230677303+   7  HPFS/NTFS/exFAT
Partition 5 does not start on physical sector boundary.

fdisk -l /dev/sdb

mint@mint ~ $ sudo fdisk -l /dev/sdb
Cannot open /dev/sdb
  • see it with sudo cat /proc/partitions

Results :

mint@mint ~ $ sudo cat /proc/partitions
major minor  #blocks  name

   7        0    1548652 loop0
   8        0  488386584 sda
   8        1  181186560 sda1
   8        2          1 sda2
   8        5  230677303 sda5
  11        0    1593088 sr0
  • find any errors with dmesg | tail :

Results:

mint@mint ~ $ sudo dmesg | tail
[ 5519.189351] usb 2-1.4: new high-speed USB device number 10 using ehci-pci
[ 5519.288491] usb 2-1.4: New USB device found, idVendor=090c, idProduct=3000
[ 5519.288498] usb 2-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 5519.288502] usb 2-1.4: Product: SM3252A MEMORY BAR  
[ 5519.288505] usb 2-1.4: Manufacturer: Silicon Motion,Inc. 
[ 5519.289008] usb-storage 2-1.4:1.0: USB Mass Storage device detected
[ 5519.289150] scsi35 : usb-storage 2-1.4:1.0
[ 5520.292225] scsi 35:0:0:0: Direct-Access              USB MEMORY BAR   1000 PQ: 0 ANSI: 0 CCS
[ 5520.292771] sd 35:0:0:0: Attached scsi generic sg2 type 0
[ 5520.294124] sd 35:0:0:0: [sdb] Attached SCSI removable disk

And yet I see all the proper information (Manufacturer, ...) about it...

Any suggestions?

7
  • You are not using sudo in your second fdisk command or in the mkfs commands
    – golimar
    Commented Jan 4, 2017 at 16:22
  • @golimar : I've got the same answers with sudo : No medium found...
    – R3uK
    Commented Jan 4, 2017 at 16:33
  • What happens when you try to read from it? E.g. sudo dd if=/dev/sdb of=/tmp/xxx bs=512 count=1 (copy a block of 512 bytes to /tmp/xxx). Any error messages in dmesg or syslog after that? My best guess so far: something is wrong with your stick, it gets enumerated by USB, but doesn't react correctly when trying to access it.
    – dirkt
    Commented Jan 4, 2017 at 17:02
  • what about /proc/partitions?
    – golimar
    Commented Jan 4, 2017 at 17:05
  • 2
    If there are no partitions on the USB stick, then of course the kernel will detect no partitions. Googling "no medium found" block device linux USB` indicates that possibly this is a cheap Chinese fake stick, which doesn't work properly.
    – dirkt
    Commented Jan 4, 2017 at 17:29

1 Answer 1

35

Looks like you "soft" ejected the USB drive. Even though physically there's no separate medium you can eject you can still send an eject command to the USB drive. After that it's still being listed as an USB device but the storage is not "connected" anymore.

You can "insert" the medium again with:

eject -t /dev/<DEVICE> # short option
eject --trayclose /dev/<DEVICE> # long option

(this comment is based on https://bbs.archlinux.org/viewtopic.php?pid=1480958#p1480958)

There's also a similar question on https://unix.stackexchange.com/questions/7051/how-to-re-mount-a-usb-stick-after-unmounting-from-nautilus-without-disconnecting.

5
  • 1
    A note, that this can happen ie. on Debian (8, 9) when you install it. Even you install it from USB stick, installer seems to "eject" intallation medium which can be damn confusing when using sticks as it may look as your stick died or so. Commented Sep 24, 2018 at 10:42
  • 2
    Immediately fixed my problem.
    – Ken Ingram
    Commented May 6, 2020 at 17:49
  • Does removing it work?
    – rogerdpack
    Commented Jan 5, 2023 at 3:16
  • I have the same symptoms but when I try >eject -t /dev/sdc I get eject: CD-ROM tray close command failed: No such file or directory. Even though just like the OP, it's still listed in /dev. It's not in /proc/partitions, doesn't show up in testdisk or gparted Device drop down. Dmesg shows eject command creates an entry sd 3:0:0:0: ioctl_internal_
    – Dave Sims
    Commented Jan 19 at 1:22
  • sd 3:0:0:0: ioctl_internal_command: ILLEGAL REQUEST asc=0x53 ascq=0x2
    – Dave Sims
    Commented Jan 19 at 1:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .