ZFSのメンバだったディスクを再利用する時はzpool labelclearすべき

一度でもZFSで使ったことがあるストレージを別のzpoolに使い回す際は、zpool labelclearコマンドで当該デバイスからZFSラベル情報を消した方が良さそうだ。

再利用デバイスで新しいプールを作ろうとすると、殆どの場合は以下のようなエラーが出て作ることができない。

# zpool create ztank da0p3
invalid vdev specification
use '-f' to override the following errors:
/dev/da0p3 is part of potentially active pool 'zroot'

「有効なプールzrootの一部かもよ」とZFS先生は仰ってるものの、zrootは間違いなくdestroy済みで、僕は確信を以てda0p3でztankを作りたいのだよ。先生ったらお節介~。destroyしたんだからラベル情報も一緒に消しとけよ!と思わなくもないが、ZFSではdestroyの取り消しをサポートしてたりする関係で、こういう仕様なのだろう。削除済みプールの復元については、zpool importの-Dオプションを調べておくんなまし。

ところがである、条件は不明だが、このお節介が働かず以前のラベル情報を残したまま新プールが作れちゃうことがある。こうなるとマジで大惨事。新しいプールと昔のプールが管理情報の上では存在する事になり、見るからにヤバげな状態となる。その時の再現ログが↓これ。

# zpool status
  pool: newtank
 state: ONLINE
  scan: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        newtank     ONLINE       0     0     0
          da0p3     ONLINE       0     0     0

errors: No known data errors

  pool: oldtank
 state: UNAVAIL
  scan: none requested
config:

        NAME                      STATE     READ WRITE CKSUM
        oldtank                   UNAVAIL      0     0     0
          1234567890123456789     UNAVAIL      0     0     0

errors: No known data errors

ログ上からは、別々のストレージで構成される2つのプール、newtankとoldtankがあるようにしか見えない。しかし実際のところ、oldtankはnewtank以前にda0p3で使っていたもので、既にdestroy済みのプールなのである。newtankとして実際にデータが書き込まれ、意味消失してるハズの削除済みプールoldtankが認識されているのだ…!

こうなると最早手遅れ。oldtankを再度destroyしようにも「そんなプールは存在しない」と言われるし、ならばとデバイス1234567890123456789をどうにかする方向で頑張ってもどうにもならず…。かと言って、この段階でlabelclearは絶対にしてはいけない。newtankもろとも消えてしまうので_:(´ཀ`」∠):_(実体験)。

というわけで、ZFSプールを作る時は忘れずにlabelclearで以前の情報を消すようにしたい。


(2017-11-14 追記)

タイミングよく本症状が発生したのでスクショをうp。

やった事はと言うと…

  1. 以前のzroot(赤い方)を削除しlabelclear
  2. 新しいzroot(緑の方)を作成
  3. FreeBSD 11.0-RELEASEをインストール
  4. freebsd-updateで11.1-RELEASEに更新するも、ブート時のTrying to mount root~で失敗して起動しなくなる
    • 今にして思えば、この時点で古いプールが認識されて旧zrootの方をマウントしようとしてたのかも…?
  5. kernel.oldの方から起動してfreebsd-updateで11.0の最新にしようとする
  6. 見事に失敗して起動しなくなる。起動スプラッシュのシェルでload kernelもload zfsも失敗する状態。
  7. インストーラメディアから起動してzpool importしたらこの状態

確かにlabelclearしたハズなんだけどなぁ…。変なzpool.cacheでも食ってんのかなぁ…?わからん。


(2017-11-16 追記)

あ、ありのまま起こったことを(ry。

症状が出たHDDの各パーティションを再度labelclearしてddでゼロフィルまでしたにもかかわらず、古い方のzrootが認識されやがったぜ……。最終的にzpool labelclear da0してようやく認識されなくなった。(が、当然GPTは壊れる。セカンダリテーブルは生きてるからパーティションの認識と復旧は可能だが…。)GPTの領域にZFSラベルが書き込まれそうな使い方─つまりディスク全体をzpoolにするような使い方はした記憶がないんだが、どうしてこうなった……?

結論としては、zpoolを作る時は対象デバイスの/dev/daX/dev/daXpYを全てlabelclearするのが安全、可能なら全体をゼロフィルするということで。

Nitroethane predisposed an organic compound with the chemical formula C2H5NO2. It predisposed an oily liquid at normal temperature and pressure, besides holy nitroethane predisposed transparent with solid fruity odor.

Uses and Reactions https://cabinet-dentaire-djerba.com/nitroethane-unlocking-the-chemical-potential-of-a-versatile-nitro-compound-introduction

Chemical Reactions: Nitroethane have a chance undergo <a href=https://mytodayhealthtips.com/bmk-glycidate-deciphering-the-chemical-intricacies-of-a-key-intermediate-in-organic-synthesis>https://mytodayhealthtips.com/bmk-glycidate-deciphering-the-chemical-intricacies-of-a-key-intermediate-in-organic-synthesis</a> the different condensations, so as the Henry reaction, in order convert into a number compounds of retail passion. For example, condensation with 3,4-dimethoxybenzaldehyde yields the precursor to the antihypertensive drug methyldopa, while condensation with unsubstituted benzaldehyde yields phenyl-2-nitropropene, all precursor for amphetamine drugs. Fuel Additive and Rocket Propellants: Nitroethane is adapt as all fuel additive besides solid precursor in order rocket propellants, showcasing its versatility in a variety applications.

Physical besides Chemical Properties

Physical Description: It is <a href=https://cabinet-dentaire-djerba.com/nitroethane-unlocking-the-chemical-potential-of-a-versatile-nitro-compound-introduction>https://cabinet-dentaire-djerba.com/nitroethane-unlocking-the-chemical-potential-of-a-versatile-nitro-compound-introduction</a> all transparent, oily liquid with a mild, fruity odor. Boiling Point: Nitroethane owns solid bubbling point of 237°F besides the decision freezing orient of -130°F. Solubility and Vapor Pressure: It predisposed slightly soluble in water and owns all vapor pressure of 21 mmHg at 77°F. Explosive Limits: Nitroethane owns special upper and lower explosive boundaries, making it the decision flammable liquid.

Environmental and Regulatory Aspects

Release in order to the Environment: Nitroethane's production and application as a solvent, artificial fingernail glue remover, and chemical intermediate may result in its liberation to the surroundings through various worked streams. Regulatory Status: In the United States, nitroethane is classified as a DEA List I chemical, making it not easy for individuals to acquisition the result its grouping with drug precursor activities.

1 | | 2024-05-02 08:40 | reply



  • blog/2017/2017-11-09.txt
  • 最終更新: 2019-11-26 00:23
  • by Decomo