到目前为止,我从未拥有过任何 SAS 驱动器,最近购买了 Fusion-MPT 2 控制器:
04:00.0 SCSI storage controller: Broadcom / LSI SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon] (rev 03)
以及希捷 ST10000NM002G 10TB SAS 驱动器。我已经插入所有东西,好消息是 mp3sas 模块正在检测控制器,并且也检测到磁盘。
坏消息是磁盘被识别为写保护:
[ 11.078668] sd 5:0:0:0: [sda] 19532873728 512-byte logical blocks: (10.0 TB/9.10 TiB)
[ 11.082640] sd 5:0:0:0: [sda] 4096-byte physical blocks
[ 11.086516] sd 5:0:0:0: [sda] Write Protect is on
[ 11.091759] sd 5:0:0:0: [sda] Mode Sense: df 00 90 08
[ 11.093572] sd 5:0:0:0: [sda] Write cache: disabled, read cache: enabled, supports DPO and FUA
[ 11.164638] sd 5:0:0:0: [sda] Attached SCSI disk
这意味着我可以很好地读取它,但不能向块设备写入任何内容。我尝试通过 sysfs 重置它:
# cat /sys/devices/pci0000:00/0000:00:03.1/0000:02:00.0/0000:03:00.0/0000:04:00.0/host5/port-5:0/end_device-5:0/target5:0:0/5:0:0:0/block/sda/ro
1
# echo 0 >/sys/devices/pci0000:00/0000:00:03.1/0000:02:00.0/0000:03:00.0/0000:04:00.0/host5/port-5:0/end_device-5:0/target5:0:0/5:0:0:0/block/sda/ro
bash: /sys/devices/pci0000:00/0000:00:03.1/0000:02:00.0/0000:03:00.0/0000:04:00.0/host5/port-5:0/end_device-5:0/target5:0:0/5:0:0:0/block/sda/ro: Permission denied
我还读到,显然对于 SAS 驱动器,可以使用 sg-utils(特别是该sg_format
工具)完成一些“格式化”,但是:
# sg_format --format /dev/sda
error opening device file: /dev/sda: Read-only file system
sg_format failed: Read-only file system
这也会失败,因为磁盘处于写保护状态。我也尝试过hdparm
:
# hdparm -I /dev/sda
/dev/sda:
ATA device, with non-removable media
Standards:
Likely used: 1
Configuration:
Logical max current
cylinders 0 0
heads 0 0
sectors/track 0 0
--
Logical/Physical Sector size: 512 bytes
device size with M = 1024*1024: 0 MBytes
device size with M = 1000*1000: 0 MBytes
cache/buffer size = unknown
Capabilities:
IORDY not likely
Cannot perform double-word IO
R/W multiple sector transfer: not supported
DMA: not supported
PIO: pio0
# hdparm -r /dev/sda
/dev/sda:
readonly = 1 (on)
# hdparm -r0 /dev/sda
/dev/sda:
setting readonly to 0 (off)
readonly = 1 (on)
# hdparm -r /dev/sda
/dev/sda:
readonly = 1 (on)
我不知道是磁盘坏了,控制器坏了还是我做错了什么。如何使磁盘以 R/W 模式运行?