OpenMediaVault セットアップのメモ
By takagiwa on Saturday, July 31 2021, 10:39 - Raspberry Pi - Permalink
個人的なセットアップのメモ
Raspberry Pi 4B 8GB に Raspberry Pi OS を入れて、OMV のサイトのスクリプトでインストール。
https://github.com/hannesd/omv-zfs-ras-nas
基本的なところはここ。
ホスト名は前のシステムとぶつかるので後で切り替えた。OMV 上でやったらエラーになったので raspi-config で書き換え。
System → Date & Time で、タイムゾーンは Asia/Tokyo に。ntp はひとまず NICT 。
Access Rights Management → User でアクセスする PC のユーザーを追加。
ZFS はこちらを参照 https://legacy.gitbook.com/book/chibiegg/how-to-zfs
2台の USB HDD にパーティションを作る。
pi@raspberrypi:~ $ sudo parted /dev/sda GNU Parted 3.2 Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mklabel New disk label type? gpt Warning: Partition(s) on /dev/sda are being used. Ignore/Cancel? I Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No? Y Error: Partition(s) 1 on /dev/sda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes. Ignore/Cancel? I (parted) quit Information: You may need to update /etc/fstab. pi@raspberrypi:~ $ sudo parted /dev/sdb GNU Parted 3.2 Using /dev/sdb Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mklabel New disk label type? gpt Warning: Partition(s) on /dev/sdb are being used. Ignore/Cancel? I Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No? Y Error: Partition(s) 1 on /dev/sdb have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes. Ignore/Cancel? I (parted) quit Information: You may need to update /etc/fstab. $ sudo shutdown -r now pi@omv:~ $ sudo parted /dev/sda GNU Parted 3.2 Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mkpart Partition name? []? zfs1 File system type? [ext2]? zfs Start? 2048s End? -1s Warning: You requested a partition from 1049kB to 3001GB (sectors 2048..5860533167). The closest location we can manage is 1049kB to 3001GB (sectors 2048..5860533134). Is this still acceptable to you? Yes/No? Y (parted) print Model: WDC WD30 EZRX-00D8PB0 (scsi) Disk /dev/sda: 3001GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 3001GB 3001GB zfs zfs1 (parted) quit Information: You may need to update /etc/fstab. pi@omv:~ $ sudo parted /dev/sdb GNU Parted 3.2 Using /dev/sdb Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mkpart Partition name? []? zfs2 File system type? [ext2]? zfs Start? 2048s End? -1s Warning: You requested a partition from 1049kB to 3001GB (sectors 2048..5860533167). The closest location we can manage is 1049kB to 3001GB (sectors 2048..5860533134). Is this still acceptable to you? Yes/No? Y (parted) print Model: TOSHIBA DT01ACA300 (scsi) Disk /dev/sdb: 3001GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 3001GB 3001GB zfs zfs2 (parted) quit Information: You may need to update /etc/fstab. pi@omv:~ $ sudo zpool create -O acltype=posixacl -O xattr=sa -O atime=off -O dnodesize=auto -O compression=lz4 -o ashift=12 tank mirror /dev/disk/by-partlabel/zfs1 /dev/disk/by-partlabel/zfs2 invalid vdev specification use '-f' to override the following errors: /dev/disk/by-partlabel/zfs1 contains a filesystem of type 'ext4' /dev/disk/by-partlabel/zfs2 contains a filesystem of type 'ext4' pi@omv:~ $ ls /dev/disk/by-partlabel/ zfs1 zfs2 pi@omv:~ $ sudo zpool create -f -O acltype=posixacl -O xattr=sa -O atime=off -O dnodesize=auto -O compression=lz4 -o ashift=12 tank mirror /dev/disk/by-partlabel/zfs1 /dev/disk/by-part label/zfs2 pi@omv:~ $ sudo zpool status pool: tank state: ONLINE config: NAME STATE READ WRITE CKSUM tank ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 zfs1 ONLINE 0 0 0 zfs2 ONLINE 0 0 0 errors: No known data errors pi@omv:~ $ sudo zfs create tank/Books pi@omv:~ $ sudo zfs create tank/DLNA pi@omv:~ $ sudo zfs create tank/Downloads pi@omv:~ $ sudo zfs create tank/Pictures
System → Plugins で github の手順で作ったプラグインをアップロードしインストール。Storage に ZFS の項目がでてくる。
Services → SMB/CIFS の設定。とりあえず Enable にして Save と Apply 。
Shares を開いて Add 、Shared folder の右の+、例えば Name は Books と入力、Device はプルダウンで tank/Books を選択、Path は Device の選択のあと自動的に Books とでた。これで Save 。戻った画面でも Save 。そして Apply 。
他も同様にいれる。
DLNA サーバーを入れる。System → Plugins で検索窓で dlna と入力して現れる minidlna を入れる。
Services → DNA を開き Enable にして Save 、Apply 。Shares を開いて、Add 、Shared Folder に対象のフォルダを選択して Save 、Apply 。
Web UI での作業はここまで。
munin-node を入れる。munin の server は他にいる。
$ sudo apt install munin-node $ sudo vi /etc/munin/munin-node.conf (allow でサーバーのアドレスを追加、hostname にドメイン付きで設定) $ sudo systemctl restart munin-node
ドメイン名に問題があったので、ルーターの local server と local domain を書き換え。