我有一个带有 ext4 的 4 TB Verbatim 外部硬盘。
可以成功挂载到我的树莓派上。
我正在尝试将其插入我具有 SSH root 访问权限的 WD Mybook Live Duo 设备。
当我插入设备时,我收到以下dmesg
消息:
usb 1-1: new high speed USB device using dwc_otg and address 2
usb 1-1: New USB device found, idVendor=18a5, idProduct=0400
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1: Product: USB 3.0 Desktop HD
usb 1-1: Manufacturer: Verbatim
usb 1-1: SerialNumber: 306239230569
usb 1-1: configuration #1 chosen from 1 choice
usbcore: registered new interface driver libusual
Initializing USB Mass Storage driver...
scsi2 : SCSI emulation for USB Mass Storage devices
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
scsi 2:0:0:0: Direct-Access ST4000DM 000-1F2168 CC52 PQ: 0 ANSI: 6
sd 2:0:0:0: Attached scsi generic sg2 type 0
sd 2:0:0:0: [sdc] Very big device. Trying to use READ CAPACITY(16).
usb-storage: device scan complete
sd 2:0:0:0: [sdc] 7814037168 512-byte logical blocks: (4.00 TB/3.63 TiB)
sd 2:0:0:0: [sdc] Write Protect is off
sd 2:0:0:0: [sdc] Mode Sense: 1f 00 00 08
sd 2:0:0:0: [sdc] Assuming drive cache: write through
sd 2:0:0:0: [sdc] Very big device. Trying to use READ CAPACITY(16).
sd 2:0:0:0: [sdc] Assuming drive cache: write through
sdc: sdc1
sd 2:0:0:0: [sdc] Very big device. Trying to use READ CAPACITY(16).
sd 2:0:0:0: [sdc] Assuming drive cache: write through
sd 2:0:0:0: [sdc] Attached SCSI disk
4TB的大小似乎被正确识别。
请注意,该消息Very big device. Trying to use READ CAPACITY(16).
似乎不是错误,因为它也发生在我的 Raspberry 上,但一切正常。
设备/dev/sdc
和/dev/sdc1
出现。所以,我猜至少它能识别分区表。
(我无法运行,fdisk -l
因为它没有安装在设备上,并且我不想在该设备上搞乱太多)
当我运行时,mount /dev/sdc1 ./mymountpoint/
我收到以下错误dmesg
:
EXT4-fs (sdc1): filesystem too large to mount safely on this system
hdparm -I /dev/sdc
显示绝对垃圾:
NAS:/DataVolume# hdparm -I /dev/sdc
/dev/sdc:
SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 0a 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ATA device, with removable media
Serial Number: abhs¦UU
Media Serial Num: ¦U¦¦yYT¦UU
Media Manufacturer: H
Transport: Parallel, ATA8-APT
Standards:
Used: unknown (minor revision code 0x5555)
Supported: 9 7 6 5
Likely used: 9
Configuration:
Logical max current
cylinders 21845 0
heads 4352 0
sectors/track 61711 0
--
Logical Sector size: 512 bytes
Physical Sector size: 4096 bytes
Logical Sector-0 offset: 2796032 bytes
device size with M = 1024*1024: 2864663189 MBytes
device size with M = 1000*1000: 3003817068 MBytes (3003817 GB)
cache/buffer size = unknown
Nominal Media Rotation Rate: 11884
Capabilities:
IORDY(may be)(can be disabled)
Standby timer values: spec'd by Vendor
R/W multiple sector transfer: Max = 0 Current = ?
Recommended acoustic management value: 18, current value: 0
DMA: sdma15
PIO: unknown
* READ BUFFER DMA command
* Long physical sector diagnostics
* CFast specification support
Security:
Master password revision code = 112
supported
enabled
locked
not frozen
expired: security count
supported: enhanced erase
Security level high
Logical Unit WWN Device Identifier: 776f000000000013
NAA : 7
IEEE OUI : 76f000
Unique ID : 000000013
Integrity word not set (found 0x1400, expected 0xbaa5)
NAS:/DataVolume# lsusb
显示:
Bus 001 Device 003: ID 18a5:0400 Verbatim, Ltd
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
我该怎么做才能让硬盘在此系统上运行?
(我想用它来创建备份,rsync
因为我的网络非常慢)
Raspberry 上的 Linux:
uname --all
Linux raspberrypi 3.12.22+ #691 PREEMPT Wed Jun 18 18:29:58 BST 2014 armv6l GNU/Linux
NAS 上的 Linux:
uname --all
Linux NAS 2.6.32.11-svn70860 #1 Thu May 17 13:32:51 PDT 2012 ppc GNU/Linux
更新
以下是hdparm
我从 Raspberry Pi 或 Ubuntu Live CD 获得的正确信息:
desinfect@desinfect:/dev$ sudo hdparm -I /dev/sdb
/dev/sdb:
ATA device, with non-removable media
Model Number: ST4000DM000-1F2168
Serial Number: Z300ZT7T
Firmware Revision: CC52
Transport: Serial, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
Used: unknown (minor revision code 0x0029)
Supported: 8 7 6 5
Likely used: 8
Configuration:
Logical max current
cylinders 16383 16383
heads 16 16
sectors/track 63 63
--
CHS current addressable sectors: 16514064
LBA user addressable sectors: 268435455
LBA48 user addressable sectors: 7814037168
Logical Sector size: 512 bytes
Physical Sector size: 4096 bytes
Logical Sector-0 offset: 0 bytes
device size with M = 1024*1024: 3815447 MBytes
device size with M = 1000*1000: 4000787 MBytes (4000 GB)
cache/buffer size = unknown
Form Factor: 3.5 inch
Nominal Media Rotation Rate: 5900
Capabilities:
LBA, IORDY(can be disabled)
Queue depth: 32
Standby timer values: spec'd by Standard, no device specific minimum
R/W multiple sector transfer: Max = 16 Current = ?
Advanced power management level: 128
Recommended acoustic management value: 208, current value: 0
DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6
Cycle time: min=120ns recommended=120ns
PIO: pio0 pio1 pio2 pio3 pio4
Cycle time: no flow control=120ns IORDY flow control=120ns
Commands/features:
Enabled Supported:
* SMART feature set
Security Mode feature set
* Power Management feature set
* Write cache
* Look-ahead
* Host Protected Area feature set
* WRITE_BUFFER command
* READ_BUFFER command
* DOWNLOAD_MICROCODE
* Advanced Power Management feature set
Power-Up In Standby feature set
* SET_FEATURES required to spinup after power up
SET_MAX security extension
* 48-bit Address feature set
* Device Configuration Overlay feature set
* Mandatory FLUSH_CACHE
* FLUSH_CACHE_EXT
* SMART error logging
* SMART self-test
* General Purpose Logging feature set
* WRITE_{DMA|MULTIPLE}_FUA_EXT
* 64-bit World wide name
Write-Read-Verify feature set
* WRITE_UNCORRECTABLE_EXT command
* {READ,WRITE}_DMA_EXT_GPL commands
* Segmented DOWNLOAD_MICROCODE
* Gen1 signaling speed (1.5Gb/s)
* Gen2 signaling speed (3.0Gb/s)
* Gen3 signaling speed (6.0Gb/s)
* Native Command Queueing (NCQ)
* Phy event counters
* unknown 76[15]
DMA Setup Auto-Activate optimization
Device-initiated interface power management
* Software settings preservation
* SMART Command Transport (SCT) feature set
* SCT LBA Segment Access (AC2)
unknown 206[7]
unknown 206[12] (vendor specific)
Security:
Master password revision code = 65534
supported
not enabled
not locked
not frozen
not expired: security count
supported: enhanced erase
508min for SECURITY ERASE UNIT. 508min for ENHANCED SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 5000c500651cc162
NAA : 5
IEEE OUI : 000c50
Unique ID : 0651cc162
Checksum: correct
desinfect@desinfect:/dev$ sudo fdisk -l /dev/sdb
Warnung: GPT (GUID-Partitionstabelle) auf '/dev/sdb' erkannt! Das Hilfsprogramm Fdisk unterstützt GPT nicht. Verwenden Sie GNU Parted.
Disk /dev/sdb: 4000.8 GB, 4000787030016 bytes
255 Köpfe, 63 Sektoren/Spur, 486401 Zylinder, zusammen 7814037168 Sektoren
Einheiten = Sektoren von 1 × 512 = 512 Bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Festplattenidentifikation: 0x7453181c
Gerät boot. Anfang Ende Blöcke Id System
/dev/sdb1 1 4294967295 2147483647+ ee GPT
硬盘有GPT。 gparted 显示了 4 MB 未分区区域,其余 3.6 TB 用于 ext4 分区。parted
确实显示为:
$ parted --list
Modell: ST4000DM 000-1F2168 (scsi)
Festplatte /dev/sdb: 4001GB
Sektorgröße (logisch/physisch): 512B/512B
Partitionstabelle: gpt
Nummer Anfang Ende Größe Dateisystem Name Flags
1 4194kB 4001GB 4001GB ext4 linux
NAS 使用 2 个 4 TB 硬盘,并使用 mdraid 进行镜像。我想知道为什么NAS使用它们没有问题......
答案1
你不能这样做,fdisk
因为你的 4TB 设备的 512b 扇区的 MBR 最大值已经是两倍。您需要使用 GPT 对其进行格式化。
从维基百科:
MBR 中分区表的组织将磁盘的最大可寻址存储空间限制为 2 TB(232 × 512 字节)。
获取gdisk
软件包并重新格式化磁盘(虽然在我看来应该已经是了)。如果您从无法安装 GPT 磁盘的计算机上查看该磁盘,那么保护性 MBR 会解释乱码hdparm
。
另外,我看到列出的物理扇区大小为 4kb - 这更有意义 - 并且使 MBR 可行,但正如您所见,相当笨重。解决方案在于更新分区表。
更多来自维基百科
由于分区信息使用起始块地址和长度存储在 MBR 分区表中,因此理论上可以以这样的方式定义分区:为具有 512 字节扇区的磁盘分配的空间给出的总大小接近 4 TB,如果除一个分区外的所有分区均低于 2 TB 限制,并且最后一个分区被指定为从块 232−1 开始或接近块 232−1,并将大小指定为最多 232−1,从而定义需要 33 而不是的分区32位用于要访问的扇区地址。然而,实际上,只有某些支持 LBA-48 的操作系统(包括内部使用 64 位扇区地址的 Linux、FreeBSD 和 Windows 7)真正支持这一点。
由于代码空间限制以及 MBR 分区表仅支持 32 位的性质,引导扇区即使启用支持 LBA-48 而不是 LBA-28,也经常使用 32 位计算,除非它们是专门设计来支持的LBA-48 的完整地址范围或仅在 64 位平台上运行。任何内部使用 32 位扇区地址的引导代码或操作系统都会导致地址绕回访问该分区,从而导致所有分区均出现严重数据损坏。
对于扇区大小不是 512 字节的磁盘(例如 USB 外部驱动器)也存在限制。扇区大小为 4,096 会导致使用 MBR 定义的分区大小增加八倍,从而允许分区大小高达 16 TiB(232 × 4096 字节)。比 Windows XP 更新的 Windows 版本以及 Mac OS X 支持更大的扇区大小,并且 Linux 内核自 2.6.31 或 2.6.32 以来就支持更大的扇区大小,但存在引导加载程序、分区工具和计算机 BIOS 实现的问题存在一定的局限性,因为它们通常通过硬连线为扇区缓冲区仅保留 512 字节,从而导致内存因扇区大小较大而被覆盖。这也可能导致不可预测的行为,因此当兼容性和标准一致性存在问题时应避免。
这里有一个 Western Digital .pdf 的链接,讨论了在非常大的驱动器上使用更大的 MBR 扇区大小的可能性。显然 2.6.32 内核是第一个引入对此功能的支持的内核。我不知道它是否是编译时选项,但可能在构建您自己的 NAS 内核时它太新了。
显然还有其他可能性。来自.pdf
Older Linux Kernel version (all 2.4 and pre‐2.6.32) computing
environments with a legacy BIOS and MBR partition table scheme
encounter a barrier at 2.19 TB because they can address only up
to 232 logical blocks. Be sure to use kernels that contain support
for drives greater than 2.19TB. The kernels released after April
2010 have support for large capacity drives using 4096 sector sizes.
...
How You Can Take Advantage of Large Capacity Drives in Linux
• Use fdisk from util‐linux‐ng >= 2.17.2 or parted/gparted
• Use +size {M, G} convention to specify "Last sector"
(e.g. +5G to create 5GiB partition) then fdiskl aligns the
size to physical block boundary
• Remember that fdisk(8) always follows your wishes ‐‐ it means
that if you explicitly define first/last sector number then
the partition could be misaligned.
• Start the extended partition at sector 64 (the default is 63),
and end it at sector (total amount of sectors on the drive – 1)