替换 ZFS RAID1 中坏掉的磁盘 by ety001

View this thread on steempeak.com
· @ety001 · (edited)
$16.89
替换 ZFS RAID1 中坏掉的磁盘
用了三天的 SSD 硬盘就报警了,你信吗?

以前我不信,但是最近我信了。上周在京东上买了两块 2TB 的 SSD 硬盘,拿来做 ZFS RAID1。

结果才用了3天,就收到了报警。得亏是做的 RAID1 不丢数据,赶紧的拔盘申请京东的换货。

![image.png](https://cdn.steemitimages.com/DQmWKLYBXm1M8p8RcG7LAWgAyci8DxgUUArRi5gh6ZGjh9P/image.png)

昨天新的 SSD 到了,赶紧的安装上。

使用 zpool 命令对损坏硬盘进行替换,因为UI界面不支持替换操作。

先看下目前的状态

```
zpool status -v ssd-main
```

![image.png](https://cdn.steemitimages.com/DQmaneCZmvh9ZJLXCF6yTAB56G3DBd1whYKjPioZQzYuVET/image.png)

可以看到故障盘拔掉后,有一个残余信息。

我们需要看一下新安装的盘的名字

![image.png](https://cdn.steemitimages.com/DQmazWDgTbu4MSUAg9iwN4scuVQ9pjcCD1NgYpNNGx4Zzfo/image.png)

新硬盘在 `/dev/sdb` 上。为了稳妥,我们使用磁盘的 id 来进行接下来的操作。

使用 `/dev/sdx` 这种形式进行部署,在主板拔掉一些硬盘的情况下,盘符会发生变化,造成不可预估的错误。

```
root@pvemain:~# ls -l /dev/disk/by-id/
total 0
lrwxrwxrwx 1 root root  9 Sep 25 05:12 ata-Colorful_SL500_2TB_2021060900049 -> ../../sdb
......
```

拿到硬盘 ID 是 `ata-Colorful_SL500_2TB_2021060900049`。接下来使用 `zpool` 命令替换掉损坏的盘就可以了。

```
zpool replace ssd-main 10854339447243245570 ata-Colorful_SL500_2TB_2021060900049
```

![image.png](https://cdn.steemitimages.com/DQmXxmeR8pGVs3MfjS9nPWFmzp7RuUsnVVNowSQTkwuMb5k/image.png)

执行后,可以看到出现了 replacing 信息。这里的截图是我最开始我使用的 sdb 的,后来我又改成用硬盘 ID 了。

方法也很简单,先摘掉不想要的盘

```
zpool detach ssd-main sdb
```

之后,再把盘加入进去

```
zpool attach ssd-main ata-Colorful_SL500_2TB_2021060901040 ata-Colorful_SL500_2TB_2021060900049
```

![image.png](https://cdn.steemitimages.com/DQmRzw46dT2NsYMwjiVeEUxk5SB6VxZxQJFAEKdYzTu4YkG/image.png)

attach 后需要重新做盘,所以耐心等待即可。

---

**ET碎碎念,每周更新,欢迎订阅,点赞,转发!**
![](https://cdn.steemitimages.com/DQmNqMmFcstxiRQqGStZSSEPEN4Z23cywF1whi91qbGTXxn/640.gif)

---
#### 好用不贵的VPS推荐
[https://1hour.win](https://1hour.win)

---

**感谢你的阅读,我是中文区见证人之一,欢迎通过 [AuthSteem](http://auth.steem.fans/sign/account-witness-vote?witness=ety001&approve=1) 来给我投票,或者打开 [https://steemitwallet.com/~witnesses](https://steemitwallet.com/~witnesses) 页面,输入 *ety001* 进行投票。**

![2.gif](https://steemitimages.com/DQmZfJo3F8NXpFx7nenQA3zTU9jg6YoRQvfyeeHgSYpdqr4/2.gif)

**中文区的见证人目前有:**
支持一下他们(按字母顺序),*一人可以有30票*:
- @cn-witnesses| [投票](https://auth.steem.fans/sign/account_witness_vote?approve=1&witness=cn-witnesses)
- @ety001| [投票](https://auth.steem.fans/sign/account_witness_vote?approve=1&witness=ety001)
- @familyonline-tv| [投票](https://auth.steem.fans/sign/account_witness_vote?approve=1&witness=familyonline-tv)
- @fuli| [投票](https://auth.steem.fans/sign/account_witness_vote?approve=1&witness=fuli)
- @justyy |[投票](https://auth.steem.fans/sign/account_witness_vote?approve=1&witness=justyy)
- @ldsn001| [投票](https://auth.steem.fans/sign/account_witness_vote?approve=1&witness=ldsn001)
- @lemooljiang| [投票](https://auth.steem.fans/sign/account_witness_vote?approve=1&witness=lemooljiang)
- @maiyude | [投票](https://auth.steem.fans/sign/account_witness_vote?approve=1&witness=maiyude)
- @smt-wherein| [投票](https://auth.steem.fans/sign/account_witness_vote?approve=1&witness=smt-wherein)

---

**Thank you for reading.  I'm a witness. I would really appreciate your witness vote! You can vote by [SteemLogin](https://steemlogin.com/sign/account-witness-vote?witness=ety001&approve=1). Or open [https://steemitwallet.com/~witnesses](https://steemitwallet.com/~witnesses) page, input *ety001* to vote.**

![2.gif](https://steemitimages.com/DQmZfJo3F8NXpFx7nenQA3zTU9jg6YoRQvfyeeHgSYpdqr4/2.gif)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 61 others
👎  
properties (23)
post_id94,262,094
authorety001
permlinkzfs-raid1
categorycn
json_metadata{"tags":["cn-dev","wherein","raid","zfs"],"image":["https:\/\/cdn.steemitimages.com\/DQmWKLYBXm1M8p8RcG7LAWgAyci8DxgUUArRi5gh6ZGjh9P\/image.png","https:\/\/cdn.steemitimages.com\/DQmaneCZmvh9ZJLXCF6yTAB56G3DBd1whYKjPioZQzYuVET\/image.png","https:\/\/cdn.steemitimages.com\/DQmazWDgTbu4MSUAg9iwN4scuVQ9pjcCD1NgYpNNGx4Zzfo\/image.png","https:\/\/cdn.steemitimages.com\/DQmXxmeR8pGVs3MfjS9nPWFmzp7RuUsnVVNowSQTkwuMb5k\/image.png","https:\/\/cdn.steemitimages.com\/DQmRzw46dT2NsYMwjiVeEUxk5SB6VxZxQJFAEKdYzTu4YkG\/image.png","https:\/\/cdn.steemitimages.com\/DQmNqMmFcstxiRQqGStZSSEPEN4Z23cywF1whi91qbGTXxn\/640.gif","https:\/\/steemitimages.com\/DQmZfJo3F8NXpFx7nenQA3zTU9jg6YoRQvfyeeHgSYpdqr4\/2.gif"],"app":"steemit\/0.2","format":"markdown","users":["cn-witnesses","ety001","familyonline-tv","fuli","justyy","ldsn001","lemooljiang","maiyude","smt-wherein"],"links":["https:\/\/1hour.win","http:\/\/auth.steem.fans\/sign\/account-witness-vote?witness=ety001&approve=1","https:\/\/steemitwallet.com\/~witnesses","https:\/\/auth.steem.fans\/sign\/account_witness_vote?approve=1&witness=cn-witnesses","https:\/\/auth.steem.fans\/sign\/account_witness_vote?approve=1&witness=ety001","https:\/\/auth.steem.fans\/sign\/account_witness_vote?approve=1&witness=familyonline-tv","https:\/\/auth.steem.fans\/sign\/account_witness_vote?approve=1&witness=fuli","https:\/\/auth.steem.fans\/sign\/account_witness_vote?approve=1&witness=justyy","https:\/\/auth.steem.fans\/sign\/account_witness_vote?approve=1&witness=ldsn001","https:\/\/auth.steem.fans\/sign\/account_witness_vote?approve=1&witness=lemooljiang","https:\/\/auth.steem.fans\/sign\/account_witness_vote?approve=1&witness=maiyude","https:\/\/auth.steem.fans\/sign\/account_witness_vote?approve=1&witness=smt-wherein","https:\/\/steemlogin.com\/sign\/account-witness-vote?witness=ety001&approve=1"]}
created2021-09-24 21:34:15
last_update2021-09-24 22:09:33
depth0
children1
net_rshares28,611,752,402,244
last_payout2021-10-01 21:34:15
cashout_time1969-12-31 23:59:59
total_payout_value9.348 SBD
curator_payout_value7.540 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length3,290
author_reputation190,546,071,796,324
root_title"替换 ZFS RAID1 中坏掉的磁盘"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (126)
@blues529 ·
👍

[WhereIn Android] (http://www.wherein.io)
properties (22)
post_id94,276,237
authorblues529
permlinkwherein-1632575520013
categorycn
json_metadata{}
created2021-09-25 13:12:06
last_update2021-09-25 13:12:06
depth1
children0
net_rshares0
last_payout2021-10-02 13:12:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length44
author_reputation27,825,594,022,071
root_title"替换 ZFS RAID1 中坏掉的磁盘"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000