先日、OpenMediaVault + Banana Pi でなんちゃって RAIDという記事を書いたのですが、面白いプラグインがあったので試してみました。
目次
概要
SnapRAID は一言で言うと、擬似的に RAID5/6 を再現する仕組みです。
RAID との違い
- 起動ドライブに利用できない
SnapRAID は OSの上で動くプログラムのため、起動ドライブを冗長化することはできません。 - リアルタイムで同期しない
同期(sync)しないと、他データドライブやパリティが更新されません。
あくまでオリジナルに対して同期を取る形になるため、定期的な同期処理が必要です。 - データドライブ以外に生データは保存されない
後述しますが、データとパリティは同一ドライブ上に共存できないため、データ用に利用するドライブ以外にアクセスしてデータを直接確認することはできません。 - パリティは分散されない
パリティを保存するドライブは明示的に指定する必要があります。
※コンテンツ同様に複数ドライブに割り当てて保存することが可能ですが、すべて複製(コピー)です。 - データドライブはまとめられない
RAID5 などのように複数のドライブをまとめて一つのボリュームとして見せる機能はありません。 - RPO・RTO は 0 ではない
上記「リアルタイムで同期しない」とも重複しますが、RPO・RTO を 0 にすることはできません。
※SnapRAID はデータドライブを(生データのままでは)冗長化しないので、リビルドしないとデータを閲覧する状態に戻すことができません。- RPO(Recovery Point Objective)
過去のどの時点までのデータを復元できるか。 - PTO(Recovery Time Objective)
復旧までにどの程度の時間がかかるか。
- RPO(Recovery Point Objective)
Is SnapRAID suitable to backup the home/My Documents directory?
No. If you have a limited amount of data that can be easily saved in an external USB HD, or in online backup services, it doesn't make sense to use SnapRAID. SnapRAID should be used when you have to backup a very large amount of data, many Tera bytes, and a full backup copy of a such amount of data is not possible in any other way.
SnapRAIDはhome / My Documentsディレクトリのバックアップに適していますか?
いいえ。外付けUSB HDやオンラインバックアップサービスに簡単に保存できるデータの量が限られている場合は、SnapRAIDを使用しても意味がありません。SnapRAIDは、非常に大量のデータ(多くのTeraバイト)をバックアップする必要がある場合に使用する必要があり、そのような量のデータの完全バックアップコピーは他の方法では不可能です。
ファイルコピーとの違い
- データ転送はブロック単位
ブロック単位で同期するため、通常のファイルコピーより高速です。
構成
SnapRAID は以下の3つのファイル群から構成されます。
- データ
- コンテンツ
- パリティ
データ
文字通り、実際のファイルです。
コンテンツ
リカバリに利用する情報(ファイルリストなど)です。
複数のディスクに分散して(冗長的に)作成することが推奨されています。
※最低でも2つ以上のディスクに作成する必要あり。
base on SnapRAID
What's the SnapRAID 'content' file?
It's the file used by SnapRAID to save the list of all files present in your array with all the checksum, timestamp and any other information needed.
These file will be of about few GiB depending of how big is your array. Approximatively for 10 TB of data, you'll need 500 MiB of content file.
SnapRAIDの「コンテンツ」ファイルとは何ですか?
SnapRAIDがアレイに存在するすべてのファイルのリストをすべてのチェックサム、タイムスタンプ、その他必要な情報と共に保存するために使用するファイルです。
これらのファイルは、配列の大きさにもよりますが、数GiB程度になります。およそ10 TBのデータには、500 MiBのコンテンツファイルが必要です。
パリティ
エラー訂正/データ復旧用のエラー訂正コードを保管します。
※(単一のアーカイブファイルとして保管されますが)データと同じ容量を消費するようです。
base on SnapRAID
What's the SnapRAID 'content' file?
It's the file used by SnapRAID to save the list of all files present in your array with all the checksum, timestamp and any other information needed.
These file will be of about few GiB depending of how big is your array. Approximatively for 10 TB of data, you'll need 500 MiB of content file.
SnapRAIDの「パリティ」ファイルと「Nパリティ」ファイルとは何ですか?
これらは、復旧に使用されるパリティデータを格納するためにSnapRAIDによって使用されるファイルです。
これらのファイルは、アレイの1つのディスクに格納される最大量のデータとしてサイズが大きくなります。
パリティとデータの共存は不可
同一ドライブに、データとパリティを同居させようとすると下記メッセージが表示されエラーになります。
A data drive cannot be a parity drive.
導入計画
パリティを格納するディスク
OMV で使う場合 ext4 がベターでしょう(Debinaベースなので)。
For the parity disks, follow these suggestions:
パリティディスクの場合は、次の提案に従ってください。
Parity Result (Google翻訳) ext3 No. It doesn't support the fallocate() command needed to allocated the parity files. You can anyway use it if you limit the use of the parity disk to contain only the parity file. いいえ。パリティファイルの割り当てに必要なfallocate()コマンドはサポートされていません。 パリティディスクの使用をパリティファイルだけに限定する場合は、とにかく使用できます。
ext4 OK XFS OK Btrfs OK. But ensure to build SnapRAID with the libblkid library to get UUID support. You will be warned at every run if this doesn't happen. OK。 しかし、UUIDをサポートするためにlibblkidライブラリを使用してSnapRAIDを必ず構築してください。 これが起こらなければあなたはあらゆる実行で警告されるでしょう。
NTFS OK in Windows. No in Linux, as it doesn't support fallocate() command needed to allocated the parity files. You can anyway use it if you limit the use of the parity disk to contain only the parity file. Windowsでは問題ありません。 Linuxでは、パリティファイルを割り当てるために必要なfallocate()コマンドをサポートしていないため、Linuxでは使用できません。 パリティディスクの使用をパリティファイルだけに限定する場合は、とにかく使用できます。
導入
[システム] - [プラグイン] で「openmediavault-snapraid 3.7.3」を選択して [インストール] を押下すると導入されます。
導入後、[サービス] - [SnapRAID] から設定できます。
リビルド手順
導入時にリカバリ手順などを確認しておくのは定石だと思いますが、テストしてみて気がついた点を記載しておきます。
注意点
- デバイス名
Web管理画面でディスク故障時に sync し直すには、同じデバイス名(/dev/sdbなど)である必要があるようです。
これが問題になるケースとしては、例えばテスト用デバイスの後ろにリビルド対象のデバイスがある場合ですが、その場合でもUSBメモリなどを間に挟んでおけば問題ありません。
※デバイス名が異なってもコマンドベースなら大丈夫だと思います(未確認)。
手順
新たなドライブを接続した後に以下から「fix(修正)」を選択します。
- [サービス] - [ドライブ] - [ツール] - [fix(修正)]
また、fix 後に sync の実行をおすすめします。
- [サービス] - [ドライブ] - [ツール] - [同期(sync)]
※同期は不要だが、簡易的な同期確認(動作確認)が取れます。
同期エラーになる場合
結果ウィンドウに下記メッセージが出る場合、指示通りにシェルから実行します。
※場合によってメッセージは異なります。
私の場合は「snapraid --force-empty sync」を実行しました。
DANGER! One or more the parity files are smaller than expected!
It's possible that the parity disks are not mounted.
If instead you are adding a new parity level, you can 'sync' using 'snapraid --force-full sync' to force a full rebuild of the parity.
危険! 1つ以上のパリティファイルが予想よりも小さいです。
パリティディスクがマウントされていない可能性があります。
代わりに新しいパリティレベルを追加するのであれば、 'snapraid --force-full sync'を使用して同期して、パリティを完全に再構築することができます。
$ sudo snapraid --force-empty sync
Self test...
Loading state from /srv/dev-disk-by-label-USB3hiSpeed/snapraid.content...
Scanning disk originalDrive...
Using 2 MiB of memory for the file-system.
Initializing...
Resizing...
Saving state to /srv/dev-disk-by-label-USB3hiSpeed/snapraid.content...
Saving state to /srv/dev-disk-by-label-RAID1/snapraid.content...
Verifying /srv/dev-disk-by-label-USB3hiSpeed/snapraid.content...
Verifying /srv/dev-disk-by-label-RAID1/snapraid.content...
Syncing...
Using 16 MiB of memory for 32 cached blocks.
100% completed, 13959 MB accessed in 0:06
Everything OK
Saving state to /srv/dev-disk-by-label-USB3hiSpeed/snapraid.content...
Saving state to /srv/dev-disk-by-label-RAID1/snapraid.content...
Verifying /srv/dev-disk-by-label-USB3hiSpeed/snapraid.content...
Verifying /srv/dev-disk-by-label-RAID1/snapraid.content...
問題ない場合
問題ない場合は「Nothing to do」が表示されるので、そのまま画面を閉じます。
Self test...
Loading state from /srv/dev-disk-by-label-USB3hiSpeed/snapraid.content...
Scanning disk originalDrive...
Using 1 MiB of memory for the file-system.
Initializing...
Resizing...
Saving state to /srv/dev-disk-by-label-USB3hiSpeed/snapraid.content...
Saving state to /srv/dev-disk-by-label-RAID1/snapraid.content...
Verifying /srv/dev-disk-by-label-USB3hiSpeed/snapraid.content...
Verifying /srv/dev-disk-by-label-RAID1/snapraid.content...
Syncing...
Using 16 MiB of memory for 32 cached blocks.
Nothing to do