本文说明了为基于 x86 的系统更换 rpool 中故障磁盘的步骤。
假设c0t0d0和c0t1d0在ZFS rpool中有镜像,需要替换c0t1d0。
- 如下输出所示,c0t1d0 有很多错误,需要更换。
# iostat -En ... c0t1d0 Soft Errors: 0 Hard Errors: 35 Transport Errors: 137630 Vendor: SEAGATE Product: ST914602SSUN146G Revision: 0400 Serial No: 071791R032 Size: 146.81GB <146810535936 bytes> ...
spool status 命令还会将磁盘显示为出现“错误过多”状态的故障。
# zpool status -v ... c0t1d0s0 FAULTED 3 6.71K 0 too many errors ...
- 在更换故障磁盘之前,我们必须将其从 rpool 中删除。
使用“zfs detach”命令将磁盘从 ZFS 控制中移除。
# zpool detach rpool c0t1d0s0
- 按如下方式进行物理更换:
# cfgadm -al ... c1::dsk/c0t1d0 disk connected configured unknown
# cfgadm -c unconfigure c0::dsk/c0t1d0 CAUTION for any hardware requirement: Physically replace the drive
- 检查是否有剩余设备。
# ls -l /dev/dsk/c0t1d0s0
如果是,使用“devfsadm”命令清理设备树。
# devfsadm -Cv
- 物理插入新磁盘。
Solaris 磁盘配置应自动完成。
如果需要,我们可以运行“devfsadm”命令。
使用 format 或者 cfgadm 命令验证新磁盘。
# devfsadm # cfgadm -al # echo | format
- 用 fdisk 和 format -e 标记新磁盘(在“label”条目下选择“SMI label”)
# fdisk /dev/rdsk/c0t1d0s2 No fdisk table exists. The default partition for the disk is: a 100% "SOLARIS System" partition Type "y" to accept the default partition, otherwise type "n" to edit the partition table. Then choose "y"
fdisk 选项也可以用于:
# fdisk /dev/rdsk/c0t1d0p0
也可以在“format -e”下使用 fdisk 完成此更改。
# format -e c0t1d0 format> fdisk ...
然后根据需要更改标签。
# format -e c0t1d0 format> label [0] SMI Label [1] EFI Label Specify Label type[0]:
- 通过将分区表从现有磁盘复制到新磁盘来创建分区。
# prtvtoc -s /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2
- 重新装上副镜像
# zpool attach rpool c0t0d0s0 c0t1d0s0
- 让 ZFS 重新同步新添加的镜像。
# zpool status -v
- 在更换的磁盘中安装引导加载程序
# installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c0t1d0s0
日期:2020-09-17 00:15:26 来源:oir作者:oir