差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
|
freebsd:001_020_proliant_microserver高機能nas化計画_osインストール編 [2011-09-19 00:13] 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 / |
| - | # zpool set bootfs=zroot zroot | + | # 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 | ||
| + | # gnop destroy / | ||
| + | # gnop destroy / | ||
| + | # zpool import | ||
| </ | </ | ||
| 行 98: | 行 154: | ||
| # zfs set checksum=fletcher4 zroot | # zfs set checksum=fletcher4 zroot | ||
| # zfs set compression=on zroot | # zfs set compression=on zroot | ||
| - | # zfs create -o exec=on -o setuid=off zroot/tmp | + | </ |
| - | # chmod 1777 /zroot/tmp | + | |
| + | Macからのアクセスを考慮してNFCにする。 | ||
| + | <cli prompt="# | ||
| + | # zfs create -o normalization=formC zroot/ | ||
| + | </ | ||
| + | |||
| + | <cli prompt="# | ||
| + | # zfs create -o exec=on -o setuid=off zroot/ROOT/tmp | ||
| + | # chmod 1777 /zroot/ROOT/tmp | ||
| + | |||
| + | # zfs create zroot/ | ||
| + | # zfs create -o compression=gzip-9 zroot/ | ||
| + | # zfs create -o compression=gzip-9 zroot/ | ||
| + | # zfs create zroot/ | ||
| - | # zfs create | + | # cd /zroot/ROOT; ln -s /usr/home home |
| - | # zfs create -o compression=gzip-9 zroot/usr/include | + | # zfs create -o compression=gzip-9 |
| - | # zfs create -o compression=gzip-9 zroot/usr/src | + | # zfs create -o compression=off -o exec=off -o setuid=off |
| - | # zfs create zroot/usr/home | + | # zfs create |
| - | # cd /zroot; ln -s /usr/home home | + | # zfs create |
| - | # zfs create -o compression=gzip-9 -o setuid=off zroot/usr/ports | + | # zfs create |
| - | # zfs create -o compression=off -o exec=off -o setuid=off zroot/usr/ports/distfiles | + | # zfs create -o exec=off |
| - | # zfs create -o compression=off -o exec=off -o setuid=off zroot/usr/ports/packages | + | # zfs create -o exec=on -o setuid=off -o compression=gzip-9 zroot/ |
| + | # zfs create | ||
| + | # zfs create | ||
| + | # zfs create -o exec=off -o setuid=off -o compression=gzip-9 zroot/ | ||
| + | # zfs create | ||
| + | # zfs create -o exec=on -o setuid=off -o compression=gzip-9 zroot/ | ||
| + | # chmod 1777 /zroot/ROOT/var/tmp | ||
| - | # zfs create zroot/var | + | # zpool set bootfs=zroot/ROOT zroot |
| - | # zfs create -o exec=off -o setuid=off | + | |
| - | # zfs create -o exec=off -o setuid=off | + | |
| - | # zfs create -o exec=on -o setuid=off zroot/ | + | |
| - | # zfs create -o exec=off -o setuid=off zroot/ | + | |
| - | # zfs create -o exec=off -o setuid=off zroot/ | + | |
| - | # zfs create -o exec=off -o setuid=off zroot/ | + | |
| - | # zfs create -o exec=off -o setuid=off zroot/ | + | |
| - | # zfs create -o exec=on -o setuid=off zroot/ | + | |
| - | # chmod 1777 / | + | |
| </ | </ | ||
| ===== OSのインストール ==== | ===== OSのインストール ==== | ||
| <cli prompt="# | <cli prompt="# | ||
| - | # cd / | ||
| # sh | # sh | ||
| - | # cd /8.2-RELEASE | + | # cd /usr/freebsd-dist/ |
| - | # export DESTDIR=/ | + | # export DESTDIR=/ |
| - | # for dir in base catpages dict doc games info lib32 manpages | + | # for file in base.txz lib32.txz kernel.txz |
| - | You are about to extract the base distribution into /zroot - are you SURE | + | > do (cat $file | tar --unlink -xpvJf - -C ${DESTDIR:-/}); done |
| - | you want to do this over your installed system | + | # zfs set readonly=on zroot/ROOT/var/empty |
| - | You are about to extract the doc distribution into / | + | |
| - | you want to do this over your installed system (y/n)? y | + | |
| - | Extracting ports tarball into /usr | + | |
| - | + | ||
| - | # cd src ; ./ | + | |
| - | # cd ../kernels ; ./ | + | |
| - | # cd /zroot/boot ; cp -Rlp GENERIC/* / | + | |
| - | + | ||
| - | # zfs set readonly=on zroot/ | + | |
| </ | </ | ||
| - | ===== chrootして初期設定 ==== | + | ===== chrootしてOSの初期設定 ==== |
| <cli prompt="# | <cli prompt="# | ||
| - | # mount -t devfs devfs / | + | # mount -t devfs devfs /zroot/ROOT/dev |
| - | # chroot /zroot | + | # chroot /zroot/ROOT |
| # / | # / | ||
| </ | </ | ||
| - | Configure | + | * Configure |
| - | > Root Password | + | |
| - | > Networking | + | * User Management |
| - | > Time Zone | + | * 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="# | <cli prompt="# | ||
| # cat << EOF > / | # cat << EOF > / | ||
| - | ahci_load=" | ||
| 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=" | ||
| 行 181: | 行 246: | ||
| sshd_enable=" | sshd_enable=" | ||
| + | EOF | ||
| + | </ | ||
| + | |||
| + | === swapの設定 === | ||
| + | <cli prompt="# | ||
| + | # cat << EOF > /etc/fstab | ||
| + | # | ||
| + | / | ||
| + | / | ||
| EOF | EOF | ||
| </ | </ | ||
| 行 193: | 行 267: | ||
| <cli prompt="# | <cli prompt="# | ||
| # exit | # exit | ||
| - | # umount /zroot/dev | + | # umount /zroot/ROOT/dev |
| </ | </ | ||
| 行 200: | 行 274: | ||
| # cd / | # cd / | ||
| # zpool export zroot && zpool import zroot | # zpool export zroot && zpool import zroot | ||
| - | # cp / | + | # cp / |
| - | </ | + | |
| - | + | ||
| - | ===== swapの設定 ==== | + | |
| - | <cli prompt="# | + | |
| - | # cat << EOF > / | + | |
| - | # | + | |
| - | / | + | |
| - | / | + | |
| - | EOF | + | |
| </ | </ | ||
| 行 216: | 行 281: | ||
| # export LD_LIBRARY_PATH=/ | # export LD_LIBRARY_PATH=/ | ||
| # zfs unmount -a | # zfs unmount -a | ||
| - | # zfs set mountpoint=legacy zroot | + | # zfs set mountpoint=legacy zroot/ROOT |
| - | # zfs set mountpoint=/ | + | # zfs set mountpoint=/ |
| - | # zfs set mountpoint=/ | + | # zfs set mountpoint=/ |
| - | # zfs set mountpoint=/ | + | # zfs set mountpoint=/ |
| </ | </ | ||
| - | |||
| ===== 後始末 ===== | ===== 後始末 ===== | ||
| 行 228: | 行 292: | ||
| # exit # sshから抜ける | # exit # sshから抜ける | ||
| </ | </ | ||
| - | |||
| - | ====== STABLEに更新 ====== | ||
| - | 8.2-RELEASEでAHCIを有効にすると、Marvellのチップを積んだSATAカードからのブートが「ROOT MOUNT ERROR」で失敗するため、STABLEに更新する(参考:[[http:// | ||
| - | この情報を見つけるまで、設定を変えたり何度も再インストールしたりと凄く苦労した・・・。 | ||
| - | |||
| - | 8.3-RELEASE以降では修正されると思われる。 | ||
| - | |||
| - | cp / | ||
| - | vi / | ||
| - | / | ||
| ====== 参考サイト ====== | ====== 参考サイト ====== | ||
| 行 248: | 行 302: | ||
| * [[http:// | * [[http:// | ||
| * [[http:// | * [[http:// | ||
| + | * [[http:// | ||
| + | * [[http:// | ||