使用sg_format重新格式化 520B 扇区大小的 EMC 硬盘

文章目录[隐藏]

前言

前段时间迷上了捡垃圾,在二手市场里到处乱逛,看上了这块东芝的5SRB384C,卖家报价150欧,我砍价到120欧 运费一共127欧。到手的时候还美滋滋的觉得赚到了。

没想到插上R730(H730)阵列卡之后显示不支持,扇区大小是520b:

但是这个硬盘的接口是图中这样的,中间7根金手指不是在背面而是在正面,和我见过的其他SAS盘不一样。同时它还附带了一个转接框,把中间的金手指转换到背面。



后面我又尝试了把这张盘插到外置阵列柜中,依然无效。

解决方案

首先你要有一个支持SAS的直通卡,我之前卡住好几个月就是因为没有直通卡,差点就放弃了。前段时间收了一个R230,内置的H330阵列卡我没啥用,就拿来试试看刷直通,也是一堆坑,后面有空了细说一下吧.....

总之在使用HBA直连硬盘后,通过`sg_scan`找到需要格式化的硬盘,这里是/dev/sg1



root@PVE-BE-105:~# sg_scan -i

/dev/sg0: scsi0 channel=0 id=0 lun=0

    ATA       Micron_5200_MTFD  U020 [rmb=0 cmdq=1 pqual=0 pdev=0x0] 

/dev/sg1: scsi0 channel=0 id=1 lun=0

    TOSHIBA   5SRB384C EMC3840  QC4F [rmb=0 cmdq=1 pqual=0 pdev=0x0]

格式化前先看一下这个盘的扇区情况,确实是520的block size,也可以看到这里的磁盘大小是3.82TB而不是3.84TB:



root@PVE-BE-105:~# sg_readcap /dev/sg1

READ CAPACITY (10) indicates device capacity too large

  now trying 16 byte cdb variant

Read Capacity results:

   Protection: prot_en=0, p_type=0, p_i_exponent=0

   Logical block provisioning: lbpme=1, lbprz=1

   Last LBA=7348420607 (0x1b5ffffff), Number of logical blocks=7348420608

   Logical block length=520 bytes

   Logical blocks per physical block exponent=3 [so physical block length=4160 bytes]

   Lowest aligned LBA=0

Hence:

   Device size: 3821178716160 bytes, 3644160.0 MiB, 3821.18 GB, 3.82 TB

然后开始重新格式化扇区,设置扇区大小为512。这里要等很久很久,我没有用screen执行而是直接在PVE的console里执行的,按下回车就后悔了,生怕断掉。。。。



root@PVE-BE-105:~# sg_format --format --size=512 /dev/sg1

    TOSHIBA   5SRB384C EMC3840  QC4F   peripheral_type: disk [0x0]

      << supports protection information>>

      Unit serial number: 57L0A13VT3EE

      LU name: 50000397cc8b3665

Mode Sense (block descriptor) data, prior to changes:

  <<< longlba flag set (64 bit lba) >>>

  Number of blocks=7348420608 [0x1b6000000]

  Block size=520 [0x208]

A FORMAT UNIT will commence in 15 seconds ALL data on /dev/sg1 will be DESTROYED Press control-C to abort

A FORMAT UNIT will commence in 10 seconds ALL data on /dev/sg1 will be DESTROYED Press control-C to abort

A FORMAT UNIT will commence in 5 seconds ALL data on /dev/sg1 will be DESTROYED Press control-C to abort

Format unit has started Format unit in progress, 19.92% done Format unit in progress, 21.09% done Format unit in progress, 21.87% done Format unit in progress, 22.65% done Format unit in progress, 23.82% done Format unit in progress, 24.60% done Format unit in progress, 25.39% done Format unit in progress, 26.56% done Format unit in progress, 27.34% done Format unit in progress, 28.51% done Format unit in progress, 29.29% done Format unit in progress, 30.07% done Format unit in progress, 31.24% done Format unit in progress, 32.03% done Format unit in progress, 32.81% done Format unit in progress, 33.98% done Format unit in progress, 34.76% done Format unit in progress, 35.93% done Format unit in progress, 36.71% done Format unit in progress, 37.49% done Format unit in progress, 38.67% done Format unit in progress, 39.45% done Format unit in progress, 40.23% done Format unit in progress, 41.40% done Format unit in progress, 42.18% done Format unit in progress, 43.35% done Format unit in progress, 44.14% done Format unit in progress, 44.92% done Format unit in progress, 46.09% done Format unit in progress, 46.87% done Format unit in progress, 47.65% done Format unit in progress, 48.82% done Format unit in progress, 49.60% done Format unit in progress, 50.78% done Format unit in progress, 51.56% done Format unit in progress, 52.34% done Format unit in progress, 53.51% done Format unit in progress, 54.29% done Format unit in progress, 55.46% done Format unit in progress, 56.24% done Format unit in progress, 57.03% done Format unit in progress, 58.20% done Format unit in progress, 58.98% done Format unit in progress, 59.76% done Format unit in progress, 60.93% done Format unit in progress, 61.71% done Format unit in progress, 62.88% done Format unit in progress, 63.67% done Format unit in progress, 64.45% done Format unit in progress, 65.62% done Format unit in progress, 66.40% done Format unit in progress, 67.18% done Format unit in progress, 68.35% done Format unit in progress, 69.14% done Format unit in progress, 70.31% done Format unit in progress, 71.09% done Format unit in progress, 71.87% done Format unit in progress, 73.04% done Format unit in progress, 73.82% done Format unit in progress, 74.60% done Format unit in progress, 75.78% done Format unit in progress, 76.56% done Format unit in progress, 77.73% done Format unit in progress, 78.51% done Format unit in progress, 79.29% done Format unit in progress, 80.46% done Format unit in progress, 81.24% done Format unit in progress, 82.03% done Format unit in progress, 83.20% done Format unit in progress, 83.98% done Format unit in progress, 85.15% done Format unit in progress, 85.93% done Format unit in progress, 86.71% done Format unit in progress, 87.88% done Format unit in progress, 88.67% done Format unit in progress, 89.84% done Format unit in progress, 90.62% done Format unit in progress, 91.40% done Format unit in progress, 92.57% done Format unit in progress, 93.35% done Format unit in progress, 94.14% done Format unit in progress, 95.31% done Format unit in progress, 96.09% done Format unit in progress, 97.26% done Format unit in progress, 98.04% done Format unit in progress, 98.82% done FORMAT UNIT Complete

来确认一下扇区是否格式化完成了,可以看到变成了512的block size,并且空间变成了3.84TB:



root@PVE-BE-105:~# sg_readcap /dev/sg1

READ CAPACITY (10) indicates device capacity too large

  now trying 16 byte cdb variant

Read Capacity results:

   Protection: prot_en=0, p_type=0, p_i_exponent=0

   Logical block provisioning: lbpme=1, lbprz=1

   Last LBA=7501512703 (0x1bf1fffff), Number of logical blocks=7501512704

   Logical block length=512 bytes

   Logical blocks per physical block exponent=3 [so physical block length=4096 bytes]

   Lowest aligned LBA=0

Hence:

   Device size: 3840774504448 bytes, 3662848.0 MiB, 3840.77 GB, 3.84 TB

但是lsblk的时候发现磁盘还是不可用状态:



root@PVE-BE-105:~# lsblk

NAME                 MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS

sda                    8:0    0  1.7T  0 disk 

├─sda1                 8:1    0 1007K  0 part 

├─sda2                 8:2    0    1G  0 part /boot/efi

└─sda3                 8:3    0  1.7T  0 part 

  ├─pve-root         252:0    0  128G  0 lvm  /

  ├─pve-data_tmeta   252:1    0 15.9G  0 lvm  

  │ └─pve-data-tpool 252:3    0  1.6T  0 lvm  

  │   └─pve-data     252:4    0  1.6T  1 lvm  

  └─pve-data_tdata   252:2    0  1.6T  0 lvm  

    └─pve-data-tpool 252:3    0  1.6T  0 lvm  

      └─pve-data     252:4    0  1.6T  1 lvm  

sdb                    8:16   0    0B  0 disk

结语

少捡垃圾!!!太费时间了,前前后后至少有十整天在弄这个东西,劳心费神!得不偿失!
而且最气人的是这个盘的smart终于可以读了,已经是战损级别成色了:



root@PVE-BE-105:~# smartctl -a /dev/sdb

smartctl 7.3 2022-02-28 r5338 [x86_64-linux-6.8.8-4-pve] (local build)

Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION === Vendor: TOSHIBA Product: 5SRB384C EMC3840 Revision: QC4F Compliance: SPC-4 User Capacity: 3,840,774,504,448 bytes [3.84 TB] Logical block size: 512 bytes Physical block size: 4096 bytes LU is resource provisioned, LBPRZ=1 Rotation Rate: Solid State Device Form Factor: 2.5 inches Logical Unit id: 0x50000397cc8b3665 Serial number: 57L0A13VT3EE Device type: disk Transport protocol: SAS (SPL-4) Local Time is: Sat Aug 3 21:46:59 2024 CEST SMART support is: Available - device has SMART capability. SMART support is: Enabled Temperature Warning: Enabled

=== START OF READ SMART DATA SECTION === SMART Health Status: OK

Percentage used endurance indicator: 15% Current Drive Temperature: 45 C Drive Trip Temperature: 63 C

Accumulated power on time, hours:minutes 37645:56 Manufactured in week 20 of year 2017 Specified cycle count over device lifetime: 33554432 Accumulated start-stop cycles: 26 Elements in grown defect list: 4228

Error counter log: Errors Corrected by Total Correction Gigabytes Total ECC rereads/ errors algorithm processed uncorrected fast | delayed rewrites corrected invocations [10^9 bytes] errors read: 0 65502 10146 10146 0 1772350.077 0 write: 0 0 0 0 0 688425.501 0 verify: 0 1728 180 180 0 149042.929 0

Non-medium error count: 680

No Self-tests have been logged


This article is under CC BY-NC-SA 4.0 license.
Please quote the original link:https://www.liujason.com/article/1263.html
Licensed under CC BY-NC-SA 4.0
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy