2

I went through what I found about this subject in the most of the threads, unfortunately without success. I have the following situation. fdisk or parted doesn't recognize this sanDisk USB flash:

fdisk -l

root@debian:~# fdisk -l
Disk /dev/sda: 477 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: Intenso SSD SATA
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000b7798

Device     Boot    Start        End   Sectors   Size Id Type
/dev/sda1           2048   11913215  11911168   5.7G 82 Linux swap / Solaris
/dev/sda2  *    11913216 1000215215 988302000 471.3G 83 Linux

fdisk /dev/sdb

root@debian:~# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sdb: 2 MiB, 2097152 bytes, 4096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x88dde89e

Device     Boot Start   End Sectors Size Id Type
/dev/sdb1        2048  4095    2048   1M 83 Linux

Command (m for help):

parted /dev/sdb

root@debian:~# parted /dev/sdb
GNU Parted 3.2
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Model:  (file)
Disk /dev/sdb: 2097kB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  2097kB  1049kB  primary

(parted)

df -h

root@debian:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev             16G  2.0M   16G   1% /dev
tmpfs           3.2G  9.7M  3.1G   1% /run
/dev/sda2       463G  162G  281G  37% /
tmpfs            16G  717M   15G   5% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs            16G     0   16G   0% /sys/fs/cgroup
tmpfs           3.2G  4.1M  3.2G   1% /run/user/1000
/dev/sdb1        15G   36M   14G   1% /media/USB/54c3f6a6-033c-434a-a6bc-44d60ba82df8

lsblk

root@debian:~# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0   477G  0 disk 
├─sda1   8:1    0   5.7G  0 part [SWAP]
└─sda2   8:2    0 471.3G  0 part /
sdb      8:16   1  14.3G  0 disk 
└─sdb1   8:17   1  14.3G  0 part /media/USB/54c3f6a6-033c-434a-a6bc-44d60ba82df8
sr0     11:0    1  1024M  0 rom  

lsusb

root@debian:~# lsusb 
Bus 003 Device 002: ID 8087:8000 Intel Corp. 
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 023: ID 0781:5591 SanDisk Corp. Ultra Flair
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 008: ID 138a:0017 Validity Sensors, Inc. VFS 5011 fingerprint sensor
Bus 002 Device 005: ID 058f:9540 Alcor Micro Corp. AU9540 Smartcard Reader
Bus 002 Device 006: ID 413c:2006 Dell Computer Corp. 
Bus 002 Device 004: ID 413c:1004 Dell Computer Corp. 
Bus 002 Device 011: ID 0765:5010 X-Rite, Inc. X-Rite Pantone Color Sensor
Bus 002 Device 010: ID 5986:026a Acer, Inc 
Bus 002 Device 012: ID 17ef:6019 Lenovo 
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

lsmod | grep usb

root@debian:~# lsmod | grep usb
btusb                  53248  0
btrtl                  16384  1 btusb
btbcm                  16384  1 btusb
btintel                24576  1 btusb
bluetooth             647168  11 btrtl,btintel,btbcm,bnep,btusb
usb_storage            73728  2 uas
usbhid                 57344  0
hid                   135168  2 usbhid,hid_generic
scsi_mod              249856  6 sd_mod,usb_storage,uas,libata,sg,sr_mod
usbcore               294912  9 xhci_hcd,ehci_pci,usbhid,usb_storage,uvcvideo,ehci_hcd,btusb,xhci_pci,uas
usb_common             16384  1 usbcore

hdparm -I /dev/sdb

root@debian:~# hdparm -I /dev/sdb

/dev/sdb:
 HDIO_DRIVE_CMD(identify) failed: Inappropriate ioctl for device

smartctl -i /dev/sdb1

root@debian:~# smartctl -i /dev/sdb1
smartctl 6.6 2017-11-05 r4594 [x86_64-linux-4.19.0-9-amd64] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Vendor:               SanDisk
Product:              Ultra USB 3.0
Revision:             1.00
Compliance:           SPC-4
User Capacity:        15,376,318,464 bytes [15.3 GB]
Logical block size:   512 bytes
Serial number:        4C530000080316205084
Device type:          disk
Local Time is:        Sat Jun 20 17:35:53 2020 CEST
SMART support is:     Available - device has SMART capability.
SMART support is:     Enabled
Temperature Warning:  Disabled or Not Supported
root@debian:~# dd if=/dev/zero of=/dev/sdb bs=1M
dd: error writing '/dev/sdb': No space left on device
15873+0 records in
15872+0 records out
16643719168 bytes (17 GB, 16 GiB) copied, 4.11023 s, 4.0 GB/s
root@debian:~# fdisk -l
Disk /dev/sda: 477 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: Intenso SSD SATA
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000b7798

Device     Boot    Start        End   Sectors   Size Id Type
/dev/sda1           2048   11913215  11911168   5.7G 82 Linux swap / Solaris
/dev/sda2  *    11913216 1000215215 988302000 471.3G 83 Linux


root@debian:~#

So basically the flash is 16GB, but neither fdisk nor parted nor gparted recognize it. In Nautilus ist is mounted as a 15 GB volume. The device information is in dmesg as well. I tried to delete the partition, creating fat32, ntfs, and even using a Windows machine for that, but I still have this weird behavior. I can use the flash as a 15GB volume, but I am very interested to know the explanation.

Thanks in advanced.

responses to comments and answers

root@debian:~# ls -l /dev/sdb
-rw-r--r-- 1 root root 16643719168 Jun 20 18:28 /dev/sdb

root@debian:~# blockdev --getsz /dev/sdb
32507264

root@debian:~# ls -l /dev/sdb
-rw-r--r-- 1 root root 16643719168 Jun 20 18:50 /dev/sdb

root@debian:~# df -h /dev
Filesystem      Size  Used Avail Use% Mounted on
udev             16G     0   16G   0% /dev
1
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – terdon
    Commented Jun 22, 2020 at 9:22

1 Answer 1

5

The problem seems to be that (for whatever reason) /dev/sdb is not a device file but a regular file. Both the output of ls -l (-rw-r--r--) and parted (Model: (file)) schow that.

This can be fixed by deleting and recreating /dev/sdb (the file):

rm /dev/sdb
mknod /dev/sdb b 8 16
2
  • 1
    @Max, I have seen similar cases, where the solution was simple: Remove that /dev/sdb file which might have been created by mistake for example if you tried to clone from an iso file to a non-existing block device.
    – sudodus
    Commented Jun 20, 2020 at 17:07
  • @sudodus: you got it. I just deleted the file /dev/sdb and that's it. remounted it and created an anew partition with ext4 file system. It is now recognized. Thanks to every one who tried to help on this and special thanks to @Hauke Laging and @sudodus.
    – Max
    Commented Jun 20, 2020 at 17:16

You must log in to answer this question.

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