我在大多数线程中浏览了关于这个主题的内容,不幸的是没有成功。我有以下情况。 fdisk 或parted 无法识别此sanDisk USB 闪存:
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):
分开/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
LSSB
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 |查询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:~#
所以基本上闪存是16GB,但既不fdisk
也不parted
认识gparted
它。在Nautilus
ist 中安装为 15 GB 卷。设备信息dmesg
也包含在内。我尝试删除分区,创建 fat32、ntfs,甚至使用 Windows 机器,但我仍然有这种奇怪的行为。我可以将闪存用作 15GB 卷,但我很想知道解释。
先谢谢了。
对评论和答案的回应
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
问题似乎是(无论出于何种原因)/dev/sdb
不是设备文件而是常规文件。ls -l
( -rw-r--r--
) 和parted
( )的输出都Model: (file)
表明了这一点。
这可以通过删除并重新创建/dev/sdb
(文件)来修复:
rm /dev/sdb
mknod /dev/sdb b 8 16