差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
freebsd:001_020_proliant_microserver高機能nas化計画_osインストール編 [2011-10-17 00:15] Decomo |
freebsd:001_020_proliant_microserver高機能nas化計画_osインストール編 [2020-12-03 19:36] (現在) |
||
---|---|---|---|
行 1: | 行 1: | ||
====== ProLiant MicroServer高機能NAS化計画(OSインストール編) ====== | ====== ProLiant MicroServer高機能NAS化計画(OSインストール編) ====== | ||
+ | |||
+ | ===== 環境 ===== | ||
+ | |||
+ | * HP ProLiant MicroServer | ||
+ | * FreeBSD 9.0-BETA3 | ||
+ | |||
+ | 詳細は[[pc: | ||
===== sshで入れるFixit環境の作成 ===== | ===== sshで入れるFixit環境の作成 ===== | ||
=== RAMディスクを作ってシステムをコピー === | === RAMディスクを作ってシステムをコピー === | ||
- | |||
<cli prompt="# | <cli prompt="# | ||
- | # mdconfig -a -t malloc -s 2048M -u 10 | + | # umount |
- | # newfs -U /dev/md10 | + | # mdmfs -s 2048m md1 /tmp |
- | # mkdir /mdisk | + | # mkdir /tmp/dist |
- | # mount /dev/md10 /mdisk | + | # find . ! -regex '\./tmp' | cpio -pd /tmp/dist |
- | # cp -pR /dist /mdisk | + | |
</ | </ | ||
- | === 読み書き可能なFixit環境へ入る === | + | === コピーした環境へ入る === |
<cli prompt="# | <cli prompt="# | ||
- | # mount -t devfs devfs /mdisk/dist/dev | + | # mount -t devfs devfs /tmp/dist/dev |
- | # chroot /mdisk/dist | + | # chroot /tmp/dist |
</ | </ | ||
行 25: | 行 30: | ||
=== sshdの起動 === | === sshdの起動 === | ||
- | |||
<cli prompt="# | <cli prompt="# | ||
# echo ' | # echo ' | ||
行 33: | 行 37: | ||
=== rootパスワードの設定 === | === rootパスワードの設定 === | ||
- | |||
<cli prompt="# | <cli prompt="# | ||
# passwd | # passwd | ||
行 49: | 行 52: | ||
# dd if=/ | # dd if=/ | ||
</ | </ | ||
- | |||
=== GPTを作成 === | === GPTを作成 === | ||
行 58: | 行 60: | ||
=== パーティション追加 === | === パーティション追加 === | ||
- | freebsd-zfs領域をHDD目一杯まで使ってしまうと、HDD交換時に微妙な容量の差でRAIDが組めない事態が起こりうるので、最後の150Mは保険として未使用領域にする。 | + | freebsd-zfs領域をHDD目一杯まで使ってしまうと、HDD交換時に微妙な容量の差でRAIDが組めない事態が起こりうるので、保険として末尾100M(こんなに要らないだろうけど念のため)を未使用領域にする。 |
<cli prompt="# | <cli prompt="# | ||
- | # gpart add -b 40 -s 64k -t freebsd-boot ada0 # AFT対策としてセクタ40から使う | + | # gpart add -a 4k -s 64k -t freebsd-boot ada0 # AFT対策で-aで4kにアライメント |
- | # gpart add -b 40 -s 64k -t freebsd-boot ada1 | + | # gpart add -a 4k -s 64k -t freebsd-boot ada1 |
- | # gpart add -s 10g -t freebsd-swap -l swap0 ada0 | + | # gpart add -a 4k -s 10g -t freebsd-swap -l swap0 ada0 |
- | # gpart add -s 10g -t freebsd-swap -l swap1 ada1 | + | # gpart add -a 4k -s 10g -t freebsd-swap -l swap1 ada1 |
- | # gpart add -s 1443870247 | + | # gpart add -a 4k -s 1443972647 |
- | # gpart add -s 1443870247 | + | # gpart add -a 4k -s 1443972647 |
# gpart show | # gpart show | ||
- | => 34 1465149101 | + | => |
- | 34 | + | |
- | 40 | + | 162 1339125 |
+ | |||
+ | => 34 1465149101 | ||
+ | 34 | ||
+ | 40 | ||
| | ||
- | 20971688 | + | 20971688 |
- | | + | |
- | => 34 1465149101 | + | => 34 1465149101 |
- | 34 | + | 34 |
- | 40 | + | 40 |
| | ||
- | 20971688 | + | 20971688 |
- | | + | |
</ | </ | ||
行 89: | 行 95: | ||
=== ZFSプールの作成 === | === ZFSプールの作成 === | ||
+ | ZFSを4kセクタに最適化するため、nopデバイス経由でプールを作成する。 | ||
+ | |||
+ | プール生成時に決定されるZFSの内部パラメータashiftが12になっていればよく、値決定後はnopでアクセスする必要はないらしい。 | ||
+ | 詳しくは[[http:// | ||
+ | |||
<cli prompt="# | <cli prompt="# | ||
- | # zpool create zroot mirror / | + | # gnop create -S 4096 / |
+ | # gnop create -S 4096 / | ||
+ | # 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="# | <cli prompt="# | ||
- | zfs set checksum=fletcher4 zroot | + | # zfs set checksum=fletcher4 zroot |
- | zfs set compression=on zroot | + | # zfs set compression=on zroot |
- | zfs create -o normalization=formC zroot/sys | + | </cli> |
- | zfs create -o exec=on -o setuid=off zroot/ | + | |
- | chmod 1777 /zroot/sys/tmp | + | |
- | zfs create zroot/ | + | Macからのアクセスを考慮してNFCにする。 |
- | zfs create -o compression=gzip-9 zroot/ | + | <cli prompt="# "> |
- | zfs create -o compression=gzip-9 | + | # zfs create -o normalization=formC zroot/ROOT |
- | zfs create zroot/ | + | </cli> |
- | cd /zroot/sys; ln -s /usr/home home | + | <cli prompt="# "> |
- | zfs create -o compression=gzip-9 -o setuid=off zroot/ | + | # zfs create -o exec=on -o setuid=off zroot/ROOT/tmp |
- | zfs create | + | # chmod 1777 /zroot/ROOT/tmp |
- | zfs create -o compression=off -o exec=off -o setuid=off | + | |
- | zfs create zroot/sys/var | + | # zfs create zroot/ROOT/usr |
- | zfs create | + | # zfs create -o compression=gzip-9 zroot/ROOT/usr/include |
- | zfs create | + | # zfs create -o compression=gzip-9 zroot/ROOT/usr/src |
- | zfs create -o exec=on -o setuid=off | + | # zfs create zroot/ROOT/usr/home |
- | zfs create | + | |
- | 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 /zroot/sys/var/tmp | + | |
- | # zpool set bootfs=zroot 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/ROOT zroot | ||
</ | </ | ||
===== OSのインストール ==== | ===== OSのインストール ==== | ||
<cli prompt="# | <cli prompt="# | ||
- | # cd / | ||
# sh | # sh | ||
# cd / | # cd / | ||
- | # export DESTDIR=/ | + | # export DESTDIR=/ |
# for file in base.txz lib32.txz kernel.txz doc.txz ports.txz src.txz games.txz ; | # 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: | > do (cat $file | tar --unlink -xpvJf - -C ${DESTDIR: | ||
- | + | # zfs set readonly=on zroot/ROOT/var/empty | |
- | # zfs set readonly=on zroot/sys/var/empty | + | |
</ | </ | ||
- | ===== chrootして初期設定 ==== | + | ===== chrootしてOSの初期設定 ==== |
<cli prompt="# | <cli prompt="# | ||
- | # mount -t devfs devfs /zroot/sys/dev | + | # mount -t devfs devfs /zroot/ROOT/dev |
- | # chroot /zroot/sys | + | # chroot /zroot/ROOT |
# / | # / | ||
</ | </ | ||
- | Configure | + | * Configure |
- | > Root Password | + | |
- | > Networking | + | * User Management |
- | >> Interfaces | + | * 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 | ||
=== / | === / | ||
行 154: | 行 225: | ||
opensolaris_load=" | opensolaris_load=" | ||
zfs_load=" | zfs_load=" | ||
- | vfs.root.mountfrom=" | + | vfs.root.mountfrom=" |
cpufreq_load=" | cpufreq_load=" | ||
vfs.zfs.txg.timeout=" | vfs.zfs.txg.timeout=" | ||
行 186: | 行 257: | ||
EOF | EOF | ||
</ | </ | ||
- | |||
=== メールのエイリアスの生成 === | === メールのエイリアスの生成 === | ||
行 197: | 行 267: | ||
<cli prompt="# | <cli prompt="# | ||
# exit | # exit | ||
- | # umount /zroot/sys/dev | + | # umount /zroot/ROOT/dev |
</ | </ | ||
行 204: | 行 274: | ||
# cd / | # cd / | ||
# zpool export zroot && zpool import zroot | # zpool export zroot && zpool import zroot | ||
- | # cp / | + | # cp / |
</ | </ | ||
- | |||
===== マウントポイントの設定 ===== | ===== マウントポイントの設定 ===== | ||
行 212: | 行 281: | ||
# export LD_LIBRARY_PATH=/ | # export LD_LIBRARY_PATH=/ | ||
# zfs unmount -a | # zfs unmount -a | ||
- | # zfs set mountpoint=legacy zroot/sys | + | # zfs set mountpoint=legacy zroot/ROOT |
- | # zfs set mountpoint=/ | + | # zfs set mountpoint=/ |
- | # zfs set mountpoint=/ | + | # zfs set mountpoint=/ |
- | # zfs set mountpoint=/ | + | # zfs set mountpoint=/ |
</ | </ | ||
- | |||
===== 後始末 ===== | ===== 後始末 ===== | ||
行 224: | 行 292: | ||
# exit # sshから抜ける | # exit # sshから抜ける | ||
</ | </ | ||
- | |||
- | ====== STABLEに更新 ====== | ||
- | 8.2-RELEASEでAHCIを有効にすると、Marvellのチップを積んだSATAカードからのブートが「ROOT MOUNT ERROR」で失敗するため、STABLEに更新する(参考:[[http:// | ||
- | この情報を見つけるまで、設定を変えたり何度も再インストールしたりと凄く苦労した・・・。 | ||
- | |||
- | 8.3-RELEASE以降では修正されると思われる。 | ||
- | |||
- | cp / | ||
- | vi / | ||
- | / | ||
====== 参考サイト ====== | ====== 参考サイト ====== | ||
行 244: | 行 302: | ||
* [[http:// | * [[http:// | ||
* [[http:// | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||