差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
freebsd:001_020_proliant_microserver高機能nas化計画_osインストール編 [2011-11-03 13:54] Decomo |
freebsd:001_020_proliant_microserver高機能nas化計画_osインストール編 [2020-12-03 19:36] |
||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== ProLiant MicroServer高機能NAS化計画(OSインストール編) ====== | ||
- | |||
- | ===== 環境 ===== | ||
- | |||
- | * HP ProLiant MicroServer | ||
- | * FreeBSD 9.0-BETA3 | ||
- | |||
- | 詳細は[[pc: | ||
- | |||
- | ===== sshで入れるFixit環境の作成 ===== | ||
- | |||
- | === RAMディスクを作ってシステムをコピー === | ||
- | <cli prompt="# | ||
- | # umount /dev/md1 | ||
- | # mdmfs -s 2048m md1 /tmp | ||
- | # mkdir /tmp/dist | ||
- | # find . ! -regex ' | ||
- | </ | ||
- | |||
- | === コピーした環境へ入る === | ||
- | <cli prompt="# | ||
- | # mount -t devfs devfs / | ||
- | # chroot /tmp/dist | ||
- | </ | ||
- | |||
- | === ネットワークの設定 === | ||
- | <cli prompt="# | ||
- | # ifconfig bge0 192.168.65.1 netmask 255.255.255.0 | ||
- | </ | ||
- | |||
- | === sshdの起動 === | ||
- | <cli prompt="# | ||
- | # echo ' | ||
- | # echo ' | ||
- | # / | ||
- | </ | ||
- | |||
- | === rootパスワードの設定 === | ||
- | <cli prompt="# | ||
- | # passwd | ||
- | Changing local password for root | ||
- | New Password: ******** | ||
- | Retype New Password: ******** | ||
- | </ | ||
- | | ||
- | ===== ZFSファイルシステムの作成 ===== | ||
- | |||
- | === パーティションテーブル初期化 === | ||
- | 本来はgpart destroyで消すべきだが、面倒なので… | ||
- | <cli prompt="# | ||
- | # dd if=/ | ||
- | # dd if=/ | ||
- | </ | ||
- | |||
- | === GPTを作成 === | ||
- | <cli prompt="# | ||
- | # gpart create -s gpt ada0 | ||
- | # gpart create -s gpt ada1 | ||
- | </ | ||
- | |||
- | === パーティション追加 === | ||
- | freebsd-zfs領域をHDD目一杯まで使ってしまうと、HDD交換時に微妙な容量の差でRAIDが組めない事態が起こりうるので、保険として末尾100M(こんなに要らないだろうけど念のため)を未使用領域にする。 | ||
- | <cli prompt="# | ||
- | # gpart add -b 40 -s 64k -t freebsd-boot ada0 # AFT対策としてセクタ40から使う | ||
- | # gpart add -b 40 -s 64k -t freebsd-boot ada1 | ||
- | # gpart add -s 10g -t freebsd-swap -l swap0 ada0 | ||
- | # gpart add -s 10g -t freebsd-swap -l swap1 ada1 | ||
- | # gpart add -s 1443972647 -t freebsd-zfs ada0 | ||
- | # gpart add -s 1443972647 -t freebsd-zfs ada1 | ||
- | # gpart show | ||
- | => | ||
- | | ||
- | 162 1339125 | ||
- | |||
- | => 34 1465149101 | ||
- | 34 | ||
- | 40 | ||
- | | ||
- | 20971688 | ||
- | 1464944328 | ||
- | |||
- | => 34 1465149101 | ||
- | 34 | ||
- | 40 | ||
- | | ||
- | 20971688 | ||
- | 1464944328 | ||
- | </ | ||
- | |||
- | === ブートコード書き込み === | ||
- | <cli prompt="# | ||
- | # gpart bootcode -b /boot/pmbr -p / | ||
- | # gpart bootcode -b /boot/pmbr -p / | ||
- | </ | ||
- | |||
- | === ZFSプールの作成 === | ||
- | ZFSを4kセクタに最適化するため、nopデバイス経由でプールを作成する。 | ||
- | |||
- | プール生成時に決定されるZFSの内部パラメータashiftが12になっていればよく、値決定後はnopでアクセスする必要はないらしい。 | ||
- | 詳しくは[[http:// | ||
- | |||
- | <cli prompt="# | ||
- | # gnop create -S 4096 /dev/ada0p3 | ||
- | # gnop create -S 4096 /dev/ada1p3 | ||
- | # zpool create zroot mirror / | ||
- | # zdb | ||
- | zroot: | ||
- | version: 28 | ||
- | name: ' | ||
- | state: 0 | ||
- | txg: 4 | ||
- | pool_guid: 3928702653704672869 | ||
- | hostname: '' | ||
- | vdev_children: | ||
- | vdev_tree: | ||
- | type: ' | ||
- | id: 0 | ||
- | guid: 3928702653704672869 | ||
- | create_txg: 4 | ||
- | children[0]: | ||
- | type: ' | ||
- | id: 0 | ||
- | guid: 10151570094065059124 | ||
- | metaslab_array: | ||
- | metaslab_shift: | ||
- | ashift: 12 ← ' | ||
- | asize: 739309256704 | ||
- | is_log: 0 | ||
- | create_txg: 4 | ||
- | children[0]: | ||
- | type: ' | ||
- | id: 0 | ||
- | guid: 4580562153177664810 | ||
- | path: '/ | ||
- | phys_path: '/ | ||
- | whole_disk: 1 | ||
- | create_txg: 4 | ||
- | children[1]: | ||
- | type: ' | ||
- | id: 1 | ||
- | guid: 4968329952742307772 | ||
- | path: '/ | ||
- | phys_path: '/ | ||
- | whole_disk: 1 | ||
- | create_txg: 4 | ||
- | # zpool export zroot | ||
- | # gnop destroy / | ||
- | # gnop destroy / | ||
- | # zpool import zroot | ||
- | </ | ||
- | |||
- | === ファイルシステムの作成と色々設定 === | ||
- | <cli prompt="# | ||
- | # zfs set checksum=fletcher4 zroot | ||
- | # zfs set compression=on zroot | ||
- | </ | ||
- | |||
- | Macからのアクセスを考慮してNFCにする。 | ||
- | <cli prompt="# | ||
- | # zfs create -o normalization=formC zroot/ROOT | ||
- | </ | ||
- | |||
- | <cli prompt="# | ||
- | # zfs create -o exec=on -o setuid=off zroot/ | ||
- | # chmod 1777 / | ||
- | |||
- | # zfs create zroot/ | ||
- | # zfs create -o compression=gzip-9 zroot/ | ||
- | # zfs create -o compression=gzip-9 zroot/ | ||
- | # zfs create zroot/ | ||
- | |||
- | # cd / | ||
- | # zfs create -o compression=gzip-9 -o setuid=off zroot/ | ||
- | # zfs create -o compression=off -o exec=off -o setuid=off zroot/ | ||
- | # zfs create -o compression=off -o exec=off -o setuid=off zroot/ | ||
- | |||
- | # zfs create zroot/ | ||
- | # zfs create -o exec=off -o setuid=off -o compression=gzip-9 zroot/ | ||
- | # zfs create -o exec=off -o setuid=off zroot/ | ||
- | # zfs create -o exec=on -o setuid=off -o compression=gzip-9 zroot/ | ||
- | # zfs create -o exec=off -o setuid=off zroot/ | ||
- | # zfs create -o exec=off -o setuid=off -o compression=gzip-9 zroot/ | ||
- | # zfs create -o exec=off -o setuid=off -o compression=gzip-9 zroot/ | ||
- | # zfs create -o exec=off -o setuid=off zroot/ | ||
- | # zfs create -o exec=on -o setuid=off -o compression=gzip-9 zroot/ | ||
- | # chmod 1777 / | ||
- | |||
- | # zpool set bootfs=zroot/ | ||
- | </ | ||
- | |||
- | ===== OSのインストール ==== | ||
- | <cli prompt="# | ||
- | # sh | ||
- | # cd / | ||
- | # export DESTDIR=/ | ||
- | # for file in base.txz lib32.txz kernel.txz doc.txz ports.txz src.txz games.txz ; | ||
- | > do (cat $file | tar --unlink -xpvJf - -C ${DESTDIR: | ||
- | # zfs set readonly=on zroot/ | ||
- | </ | ||
- | |||
- | ===== chrootしてOSの初期設定 ==== | ||
- | <cli prompt="# | ||
- | # mount -t devfs devfs / | ||
- | # chroot /zroot/ROOT | ||
- | # / | ||
- | </ | ||
- | * Configure | ||
- | * Root Password : rootパスワードの設定 | ||
- | * User Management | ||
- | * User : ユーザーの追加 | ||
- | * Time Zone | ||
- | * Select local or UTC (Greenwich Mean Time) clock : Yes (UTCで運用。JSTを使う場合はNo) | ||
- | * Asia → Japan → Yes | ||
- | * Networking | ||
- | * Intarfaces | ||
- | * bge0 | ||
- | * IPv6 configuration : No | ||
- | * DFCP configuration : No | ||
- | * 設定 | ||
- | * Bring up : No | ||
- | |||
- | === / | ||
- | <cli prompt="# | ||
- | # cat << EOF > / | ||
- | opensolaris_load=" | ||
- | zfs_load=" | ||
- | vfs.root.mountfrom=" | ||
- | cpufreq_load=" | ||
- | vfs.zfs.txg.timeout=" | ||
- | |||
- | kern.maxusers=512 | ||
- | vm.kmem_size=" | ||
- | vm.kmem_size_max=" | ||
- | vfs.zfs.arc_min=" | ||
- | vfs.zfs.arc_max=" | ||
- | EOF | ||
- | </ | ||
- | |||
- | === / | ||
- | <cli prompt="# | ||
- | # cat << EOF >> / | ||
- | zfs_enable=" | ||
- | powerd_enable=" | ||
- | powerd_flags=" | ||
- | cpufreq_load=" | ||
- | |||
- | sshd_enable=" | ||
- | EOF | ||
- | </ | ||
- | |||
- | === swapの設定 === | ||
- | <cli prompt="# | ||
- | # cat << EOF > /etc/fstab | ||
- | # | ||
- | / | ||
- | / | ||
- | EOF | ||
- | </ | ||
- | |||
- | === メールのエイリアスの生成 === | ||
- | <cli prompt="# | ||
- | # cd /etc/mail | ||
- | # make aliases | ||
- | </ | ||
- | |||
- | === chroot環境から抜ける === | ||
- | <cli prompt="# | ||
- | # exit | ||
- | # umount / | ||
- | </ | ||
- | |||
- | ===== zpool.cacheの更新 ===== | ||
- | <cli prompt="# | ||
- | # cd / | ||
- | # zpool export zroot && zpool import zroot | ||
- | # cp / | ||
- | </ | ||
- | |||
- | ===== マウントポイントの設定 ===== | ||
- | <cli prompt="# | ||
- | # export LD_LIBRARY_PATH=/ | ||
- | # zfs unmount -a | ||
- | # zfs set mountpoint=legacy zroot/ROOT | ||
- | # zfs set mountpoint=/ | ||
- | # zfs set mountpoint=/ | ||
- | # zfs set mountpoint=/ | ||
- | </ | ||
- | |||
- | ===== 後始末 ===== | ||
- | <cli prompt="# | ||
- | # exit # shから抜ける | ||
- | # exit # sshから抜ける | ||
- | </ | ||
- | |||
- | ====== 参考サイト ====== | ||
- | * [[http:// | ||
- | * [[http:// | ||
- | * [[http:// | ||
- | * [[http:// | ||
- | * [[http:// | ||
- | * [[http:// | ||
- | * [[http:// | ||
- | * [[http:// | ||
- | * [[http:// | ||