我需要更换 FreeNAS 上 zpool 中的一个坏磁盘。
zpool status
节目
gptid/5fe33556-3ff2-11e2-9437-f46d049aaeca UNAVAIL 0 0 0 cannot open
我如何找到该磁盘的序列号?
更多的:
glabel status
给出:
Name Status Components
ufs/FreeNASs3 N/A da0s3
ufs/FreeNASs4 N/A da0s4
ufsid/4fa405ab96518680 N/A da0s1a
ufs/FreeNASs1a N/A da0s1a
ufs/FreeNASs2a N/A da0s2a
gptid/5f3c0517-3ff2-11e2-9437-f46d049aaeca N/A ada1p2
gptid/60570005-3ff2-11e2-9437-f46d049aaeca N/A ada3p2
gptid/60ebeaa5-3ff2-11e2-9437-f46d049aaeca N/A ada4p2
gptid/a767b8ef-1c95-11e2-af4c-f46d049aaeca N/A ada6p2
gptid/61925b86-3ff2-11e2-9437-f46d049aaeca N/A ada9p2
gptid/4599731b-8f15-11e1-a14c-f46d049aaeca N/A ada10p2
我没gptid/5fe33556
在那儿看到。
并camcontrol devlist
给出:
<Hitachi HDS723030BLE640 MX6OAAB0> at scbus0 target 0 lun 0 (pass0,ada0)
<ST3000VX000-9YW166 CV13> at scbus4 target 0 lun 0 (pass1,ada1)
<ST3000VX000-9YW166 CV13> at scbus6 target 0 lun 0 (pass3,ada3)
<Hitachi HDS723030BLE640 MX6OAAB0> at scbus7 target 0 lun 0 (pass4,ada4)
<ST3000DM001-9YN166 CC4C> at scbus8 target 0 lun 0 (pass5,ada5)
<WDC WD30EZRX-00MMMB0 80.00A80> at scbus8 target 1 lun 0 (pass6,ada6)
<WDC WD30EZRX-00MMMB0 80.00A80> at scbus9 target 0 lun 0 (pass7,ada7)
<ST3000DM001-9YN166 CC4C> at scbus9 target 1 lun 0 (pass8,ada8)
<Hitachi HDS723030BLE640 MX6OAAB0> at scbus10 target 0 lun 0 (pass9,ada9)
<Hitachi HDS5C3030ALA630 MEAOA580> at scbus11 target 0 lun 0 (pass10,ada10)
< USB Flash Memory 1.00> at scbus12 target 0 lun 0 (pass11,da0)
那是不是意味着那个ada2
磁盘坏了?
更新:
好的,我很确定那ada2
是坏磁盘。我有记录,所以我知道那是哪个磁盘。
但看起来我留了一个备用的 -ada0- 上次我在盒子里。我可以更换ada2和ada0远程?直到有人来办公室?
答案1
要获取磁盘序列,需要它正在运行并且可用:
camcontrol identify <device> |grep ^serial
(这可能是 (S)ATA 特有的)smartctl -i <device> |grep ^Serial
- 从机箱中取出后读取磁盘标签
对于你的情况,我认为第三种解决方案是唯一可用的。因此,假设你只想首先识别磁盘:
首先尝试 a glabel status
(因为您的驱动器未显示为DOWN
或REMOVED
):
$ glabel status
gptid/c7868819-ddc1-11e2-8c3e-00138f3fd9c7 N/A da0p1
gptid/c96da0bc-ddc1-11e2-8c3e-00138f3fd9c7 N/A da2p1
- 你可以使用以下命令查看你的分区
glabel status
然后您可以轻松识别磁盘设备名称(例如:da0用于gptid/c7868819-ddc1-11e2-8c3e-00138f3fd9c7
分区)。
/var/log/messages
您可以从(又名“ dmesg
”)查看系统启动日志:
$ dmesg | grep ^da0
da0 at mps0 bus 0 scbus0 target 0 lun 0
da0: <ATA ST3000DM001-1CH1 CC26> Fixed Direct Access SCSI-6 device
da0: 600.000MB/s transfers
da0: Command Queueing enabled
da0: 2861588MB (5860533168 512 byte sectors: 255H 63S/T 364801C)
您无法看到您的分区
glabel status
$ camcontrol devlist <ATA ST3000DM001-1CH1 CC26> at scbus0 target 0 lun 0 (pass0,da0) <ATA ST3000DM001-1CH1 CC26> at scbus0 target 4 lun 0 (pass2,da2)
从那里,您可以轻松发现哪一个缺失了(da1在这种情况下),然后查看dmesg
以识别该磁盘。
所以,这里没有真正的解决方案。我只是希望它能帮助你更清楚地了解事情。
了解更多:
答案2
#!/bin/sh
echo
echo $(basename $0) - Mounted Drives on $(hostname)
cat /etc/version
date
echo
diskinfo="$(glabel status | tail -n +2 | awk '{split($3,a,"p"); print a[1],$1}')"
echo "+========+==========================+==================+============================================+"
echo "| Device | DISK DESCRIPTION | SERIAL NUMBER | GPTID |"
echo "+========+==========================+==================+============================================+"
for d in $(echo "$diskinfo" | cut -d" " -f 1)
do
diskinf=$(diskinfo -v $d | grep '# Disk ')
diskdescription=$(echo "$diskinf" | grep '# Disk desc' | cut -d# -f 1 | xargs)
diskserialno=$(echo "$diskinf" | grep '# Disk ident' | cut -d# -f 1 | xargs)
diskgptid=$(echo "$diskinfo" | grep "^$d" | cut -d" " -f 2)
printf "| %-6s | %-24s | %-16s | %-42s |\n" "$d" "$diskdescription" "$diskserialno" "$diskgptid"
echo "+--------+--------------------------+------------------+--------------------------------------------+"
done
答案3
我编写了一个脚本,列出了所有 GPTID 以及相关的硬盘序列号和设备名称。
#!/bin/bash
#Use smartctl to get Serial Number - else dmesg is used
USESMART=0
#save glabel status to temporary file
CACHEGLABEL=1
if [ $CACHEGLABEL -eq 0 ]
then
GLCMD="glabel status"
else
GLTMP=/var/tmp/$0.glabel
glabel status > $GLTMP
GLCMD="cat $GLTMP"
fi
ADALOW=`ls /dev/ada[0-9] 2>/dev/null`
ADAHIGH=`ls /dev/ada[0-9][0-9] 2>/dev/null`
DALOW=`ls /dev/da[0-9] 2>/dev/null`
DAHIGH=`ls /dev/da[0-9][0-9] 2>/dev/null`
#check if all device nodes exist or skip
if [[ $ADALOW == *ls* ]]
then
$DALOW=
fi
if [[ $ADAHIGH == *ls* ]]
then
$ADAHIGH=
fi
if [[ $DALOW == *ls* ]]
then
$DALOW=
fi
if [[ $DAHIGH == *ls* ]]
then
$DAHIGH=
fi
for FILE in $ADALOW $ADAHIGH $DALOW $DAHIGH
do
DEV=${FILE##'/dev/'}
#echo -n "${DEV}: "
if [ $USESMART -eq 0 ]
then
SERIAL=`grep $DEV: /var/log/dmesg.today |grep -i Serial | awk '{print $(NF)}'`
else
SERIAL=`smartctl -a $FILE | grep -i 'Serial Number'| awk '{print $(NF)}'`
fi
#this skips all ufs drives
GPTID=`$GLCMD |grep 2$ |grep ${DEV}p|cut -d' ' -f1`
if [ "${GPTID}x" == 'x' ]
then
GPTID="No GPTID"
fi
if [ "${SERIAL}x" == 'x' ]
then
$SERIAL="Not found"
fi
echo ${DEV}: Serial $SERIAL \; GPTID=$GPTID
done
if [ $CACHEGLABEL -eq 1 ]
then
rm $GLTMP
fi
答案4
但上次我进到盒子里时,似乎留下了一个备用的 ada0。我可以远程用 ada0 替换 ada2 吗?直到有人来办公室?
是的,zpool replace