免责声明:我最初在 SF 上发布此内容:https://serverfault.com/q/645670,但我认为它更适合这里
首先,介绍一下上下文:我正在尝试在 16 Gb USB 闪存盘上刻录 ISO,但在正确设置基本 MBR + 可安装分区时遇到困难。
到目前为止,我收集了以下不匹配的信息:
/dev/sdb*
扩展为/dev/sdb
&/dev/sdb2
:这似乎表明一个索引为 2 的分区。如果我 mount/dev/sdb2
,df
告诉我这是一个 2.0M VFAT 文件系统。fdisk
&parted
两者都检测到/dev/sdb
具有 3929750 * 512 字节扇区 = 2 Gb 容量的设备。它们还都列出了一个/dev/sdb1
2 Gb 的唯一子分区。dmesg
正确 (?) 检测到 Kingston 16 Gb USB 闪存盘
调用partprobe
没有任何区别。
为什么操作系统检测到 /dev/sdb2 分区,而fdisk
&检测不到parted
?
其次:dmesg
“16 Gb 容量”信息从何而来?
一些命令输出详细信息:
$ uname -a
Linux DAEDALUS 3.13.0-39-generic #66-Ubuntu SMP Tue Oct 28 13:30:27 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ usb-devices | grep -A7 Bus=03
T: Bus=03 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 2
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=1d6b ProdID=0002 Rev=03.13
S: Manufacturer=Linux 3.13.0-39-generic xhci_hcd
S: Product=xHCI Host Controller
S: SerialNumber=0000:04:00.0
C: #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
$ ls -l /dev/sdb*
-rw-r--r-- 1 root root 2012049408 Nov 20 01:50 /dev/sdb
-rw-r--r-- 1 root root 2097152 Nov 20 01:18 /dev/sdb2
$ sudo fdisk -l /dev/sdb
Disk /dev/sdb: 2012 MB, 2012049408 bytes
158 heads, 33 sectors/track, 753 cylinders, total 3929784 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
Disk identifier: 0x3262a45b
Device Boot Start End Blocks Id System
/dev/sdb1 * 2048 3929783 1963868 83 Linux
$ sudo parted /dev/sdb unit s print
Model: (file)
Disk /dev/sdb: 3929784s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size File system Name Flags
1 2048s 3929750s 3927703s Linux filesystem boot
$ sudo fdisk -l /dev/sdb2
You must set cylinders.
You can do this from the extra functions menu.
Disk /dev/sdb2: 2 MB, 2097152 bytes
255 heads, 63 sectors/track, 0 cylinders, total 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
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
$ sudo parted /dev/sdb2 unit s print
Model: (file)
Disk /dev/sdb2: 4096s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
相关输出摘录dmesg
,显示它正确检测到 16 Gb 容量:
[Thu Nov 20 01:38:46 2014] usb-storage 2-1.2:1.0: USB Mass Storage device detected
[Thu Nov 20 01:38:46 2014] scsi22 : usb-storage 2-1.2:1.0
[Thu Nov 20 01:38:48 2014] scsi 22:0:0:0: Direct-Access Kingston DataTraveler G2 PMAP PQ: 0 ANSI: 0 CCS
[Thu Nov 20 01:38:48 2014] sd 22:0:0:0: Attached scsi generic sg2 type 0
[Thu Nov 20 01:38:49 2014] sd 22:0:0:0: [sdb] 31252480 512-byte logical blocks: (16.0 GB/14.9 GiB)
[Thu Nov 20 01:38:49 2014] sd 22:0:0:0: [sdb] Write Protect is off
[Thu Nov 20 01:38:49 2014] sd 22:0:0:0: [sdb] Mode Sense: 23 00 00 00
[Thu Nov 20 01:38:49 2014] sd 22:0:0:0: [sdb] No Caching mode page found
[Thu Nov 20 01:38:49 2014] sd 22:0:0:0: [sdb] Assuming drive cache: write through