ZFSプールを暗号化する方法は?

ZFSプールを暗号化する方法は?

tankはじめに:私は元のプールを作成したTrueNAS(SCALE)を実行しました。

Ubuntuサーバーで新しく作成されたプールのキーを割り当て/変更しようとすると、次のエラーが発生しますKey change error: Dataset not encrypted.

user@homeserver:~$ sudo zfs change-key -o keylocation=file:///path/to/zpool.key -o keyformat=raw flash
Key change error: Dataset not encrypted.

user@homeserver:~$ zfs get encryption tank 
NAME  PROPERTY    VALUE        SOURCE
tank  encryption  aes-256-gcm  -

user@homeserver:~$ zfs get encryption flash
NAME   PROPERTY    VALUE        SOURCE
flash  encryption  off          default

プールの作成に使用するコマンドは次のとおりです。

sudo zpool create -o failmode=continue -o autoexpand=on -o autotrim=on -o feature@async_destroy=enabled -o feature@empty_bpobj=enabled -o feature@lz4_compress=enabled -o feature@multi_vdev_crash_dump=enabled -o feature@spacemap_histogram=enabled -o feature@enabled_txg=enabled -o feature@hole_birth=enabled -o feature@extensible_dataset=enabled -o feature@embedded_data=enabled -o feature@bookmarks=enabled -o feature@filesystem_limits=enabled -o feature@large_blocks=enabled -o feature@large_dnode=enabled -o feature@sha512=enabled -o feature@skein=enabled -o feature@edonr=enabled -o feature@userobj_accounting=enabled -o feature@encryption=enabled -o feature@project_quota=enabled -o feature@device_removal=enabled -o feature@obsolete_counts=enabled -o feature@zpool_checkpoint=enabled -o feature@spacemap_v2=enabled -o feature@allocation_classes=enabled -o feature@resilver_defer=enabled -o feature@bookmark_v2=enabled -o feature@redaction_bookmarks=enabled -o feature@redacted_datasets=enabled -o feature@bookmark_written=enabled -o feature@log_spacemap=enabled -o feature@livelist=enabled -o feature@device_rebuild=enabled -o feature@zstd_compress=enabled -o feature@draid=enabled flash mirror /dev/disk/by-partuuid/XXX /dev/disk/by-partuuid/XXX

私は何が間違っていて、どのようflashに同じ方法で暗号化できますかtank

ベストアンサー1

デフォルトのZFS暗号化は、プールを暗号化せずにファイルシステムのみを暗号化します。また、ファイルシステムを作成するときは、各ファイルシステムの暗号化を設定する必要があります。プールのルートファイルシステムの場合、これはプールの作成時にルートファイルシステムの暗号化を設定する必要があることを意味します。

したがって、既存のプールと同様に暗号化されたルートファイルシステムを使用して新しいプールを作成する前に、新しいプールを削除する必要があります。

# zpool destroy flash

zpool createその後、上記のコマンドを追加オプションとマージしてプールを再作成します。資本の使用に注意してください-O

# zpool create \
    (your options from above) \
    -O encryption=on \
    -O keyformat=(whatever) \
    -O keylocation=(whatever) \
    flash \
    mirror /dev/gpt/diskA-serial-num /dev/gpt/diskB-serial-num

最後に確認:

# zfs get encryption,keyformat,keylocation flash
NAME   PROPERTY     VALUE        SOURCE
flash  encryption   aes-256-gcm  -
flash  keyformat    (whatever)   -
flash  keylocation  (whatever)   local

おすすめ記事