差分
このページの2つのバージョン間の差分を表示します。
次のリビジョン | 前のリビジョン | ||
freebsd:001_020_proliant_microserver高機能nas化計画_osインストール編 [2011-09-17 11:01] 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ディスクを作ってシステムをコピー === | ||
- | + | < | |
- | < | + | # umount |
- | # mdconfig -a -t malloc -s 2048M -u 10 | + | # mdmfs -s 2048m md1 /tmp |
- | # newfs -U /dev/md10 | + | # mkdir /tmp/dist |
- | # mkdir /mdisk | + | # find . ! -regex '\./tmp' | cpio -pd /tmp/dist |
- | # mount /dev/md10 /mdisk | + | |
- | # cp -pR /dist /mdisk | + | |
</ | </ | ||
- | === 読み書き可能なFixit環境へ入る === | + | === コピーした環境へ入る === |
- | + | < | |
- | < | + | # mount -t devfs devfs /tmp/dist/dev |
- | # mount -t devfs devfs /mdisk/dist/dev | + | # chroot /tmp/dist |
- | # chroot /mdisk/dist | + | |
</ | </ | ||
=== ネットワークの設定 === | === ネットワークの設定 === | ||
- | + | < | |
- | <cli> | + | |
# ifconfig bge0 192.168.65.1 netmask 255.255.255.0 | # ifconfig bge0 192.168.65.1 netmask 255.255.255.0 | ||
</ | </ | ||
=== sshdの起動 === | === sshdの起動 === | ||
- | + | < | |
- | <cli> | + | |
# echo ' | # echo ' | ||
# echo ' | # echo ' | ||
行 35: | 行 37: | ||
=== rootパスワードの設定 === | === rootパスワードの設定 === | ||
- | + | < | |
- | <cli> | + | |
# passwd | # passwd | ||
Changing local password for root | Changing local password for root | ||
行 47: | 行 48: | ||
=== パーティションテーブル初期化 === | === パーティションテーブル初期化 === | ||
本来はgpart destroyで消すべきだが、面倒なので… | 本来はgpart destroyで消すべきだが、面倒なので… | ||
- | <cli> | + | < |
# dd if=/ | # dd if=/ | ||
# dd if=/ | # dd if=/ | ||
</ | </ | ||
- | |||
=== GPTを作成 === | === GPTを作成 === | ||
- | <cli> | + | < |
# gpart create -s gpt ada0 | # gpart create -s gpt ada0 | ||
# gpart create -s gpt ada1 | # gpart create -s gpt ada1 | ||
行 60: | 行 60: | ||
=== パーティション追加 === | === パーティション追加 === | ||
- | freebsd-zfs領域をHDD目一杯まで使ってしまうと、HDD交換時に微妙な容量の差でRAIDが組めなくなる事が起こりうるので、最後の150Mは保険として未使用領域にする。 | + | freebsd-zfs領域をHDD目一杯まで使ってしまうと、HDD交換時に微妙な容量の差でRAIDが組めない事態が起こりうるので、保険として末尾100M(こんなに要らないだろうけど念のため)を未使用領域にする。 |
- | < | + | < |
- | # 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 |
- | | + | |
</ | </ | ||
+ | === ブートコード書き込み === | ||
+ | <cli prompt="# | ||
+ | # gpart bootcode -b /boot/pmbr -p / | ||
+ | # gpart bootcode -b /boot/pmbr -p / | ||
+ | </ | ||
- | 1465149168 | + | === ZFSプールの作成 === |
- | WDC WD20EARX-00PASB0 3907029168セクタ=1862.6963GiB | + | ZFSを4kセクタに最適化するため、nopデバイス経由でプールを作成する。 |
- | Hitachi HDS722020ALA330 3907029168セクタ=1863.0166GiB | + | |
- | ブートコード書き込み | + | プール生成時に決定されるZFSの内部パラメータashiftが12になっていればよく、値決定後はnopでアクセスする必要はないらしい。 |
- | gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0 | + | 詳しくは[[http: |
- | gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1 | + | |
- | ZFSカーネルモジュールの読込み | + | <cli prompt="# |
- | kldload | + | # gnop create -S 4096 /dev/ada0p3 |
- | # kldload | + | # gnop create -S 4096 / |
+ | # zpool create zroot mirror /dev/ada0p3.nop / | ||
+ | # 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: '/dev/gpt/boot0a.nop' | ||
+ | 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 | ||
+ | </ | ||
- | Create ZFS Pool zroot | + | === ファイルシステムの作成と色々設定 === |
- | zpool create | + | <cli prompt="# |
- | zpool set bootfs=zroot | + | # zfs set checksum=fletcher4 |
+ | # zfs set compression=on zroot | ||
+ | </ | ||
- | zfs set checksum=fletcher4 zroot | + | Macからのアクセスを考慮してNFCにする。 |
- | zfs set compression=on zroot | + | <cli prompt="# "> |
- | zfs create -o exec=on -o setuid=off | + | # zfs create -o normalization=formC zroot/ROOT |
- | chmod 1777 /zroot/tmp | + | </cli> |
- | zfs create zroot/usr | + | <cli prompt="# |
- | zfs create -o compression=gzip-9 zroot/ | + | # zfs create -o exec=on -o setuid=off zroot/ROOT/tmp |
- | zfs create | + | # chmod 1777 /zroot/ROOT/tmp |
- | zfs create zroot/ | + | |
- | cd /zroot; ln -s /usr/home home | + | |
- | zfs create -o compression=gzip-9 | + | # zfs create zroot/ |
- | zfs create -o compression=off -o exec=off -o setuid=off | + | # zfs create -o compression=gzip-9 zroot/ROOT/usr/include |
- | zfs create | + | # zfs create -o compression=gzip-9 zroot/ROOT/usr/src |
+ | # zfs create zroot/ROOT/usr/home | ||
- | zfs create | + | # cd /zroot/ROOT; ln -s /usr/home home |
- | zfs create | + | # zfs create -o compression=gzip-9 -o setuid=off zroot/ROOT/usr/ports |
- | zfs create -o exec=off -o setuid=off zroot/ | + | # zfs create -o compression=off -o exec=off -o setuid=off zroot/ROOT/usr/ports/distfiles |
- | zfs create -o exec=on | + | # zfs create -o compression=off -o exec=off -o setuid=off zroot/ROOT/usr/ports/packages |
- | zfs create -o exec=off -o setuid=off zroot/ | + | |
- | zfs create | + | |
- | zfs create -o exec=off -o setuid=off zroot/var/mail | + | |
- | zfs create -o exec=off -o setuid=off zroot/ | + | |
- | zfs create -o exec=on | + | |
- | chmod 1777 /zroot/var/tmp | + | |
- | cd / | + | # zfs create zroot/ROOT/var |
- | sh | + | # zfs create |
- | cd /8.2-RELEASE | + | # zfs create -o exec=off -o setuid=off zroot/ROOT/ |
- | export DESTDIR=/zroot | + | # zfs create -o exec=on -o setuid=off -o compression=gzip-9 |
- | # for dir in base catpages dict doc games info lib32 manpages ports; do (cd $dir ; ./install.sh) ; done | + | # zfs create -o exec=off -o setuid=off zroot/ |
- | You are about to extract the base distribution into /zroot - are you SURE | + | # zfs create -o exec=off -o setuid=off -o compression=gzip-9 zroot/ROOT/ |
- | you want to do this over your installed system (y/n)? y | + | # zfs create -o exec=off -o setuid=off -o compression=gzip-9 |
- | You are about to extract the doc distribution into / | + | # zfs create |
- | you want to do this over your installed system (y/n)? y | + | # zfs create -o exec=on -o setuid=off -o compression=gzip-9 zroot/ |
- | Extracting ports tarball into /usr | + | # chmod 1777 /zroot/ROOT/var/tmp |
- | cd src ; ./ | + | # zpool set bootfs=zroot/ROOT zroot |
- | cd ../kernels ; ./ | + | </cli> |
- | cd /zroot/boot ; cp -Rlp GENERIC/* /zroot/boot/ | + | |
- | zfs set readonly=on 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/ROOT/var/empty | ||
+ | </ | ||
- | mount -t devfs devfs / | + | ===== chrootしてOSの初期設定 ==== |
- | chroot /zroot | + | <cli prompt="# |
- | / | + | # mount -t devfs devfs /zroot/ROOT/dev |
- | + | # chroot /zroot/ROOT | |
- | Configure | + | # / |
- | > Root Password | + | </ |
- | > Networking | + | |
- | > Time Zone | + | |
+ | * 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 | ||
- | cat << EOF > / | + | === / |
- | ahci_load=" | + | <cli prompt="# |
+ | # cat << EOF > / | ||
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=" | ||
行 167: | 行 235: | ||
vfs.zfs.arc_max=" | vfs.zfs.arc_max=" | ||
EOF | EOF | ||
+ | </ | ||
- | cat << EOF >> / | + | === / |
+ | <cli prompt="# | ||
+ | # cat << EOF >> / | ||
zfs_enable=" | zfs_enable=" | ||
powerd_enable=" | powerd_enable=" | ||
行 176: | 行 247: | ||
sshd_enable=" | sshd_enable=" | ||
EOF | EOF | ||
+ | </ | ||
- | cd /etc/mail | + | === swapの設定 === |
- | make aliases | + | <cli prompt="# |
- | + | # cat << EOF > / | |
- | exit | + | # |
- | umount / | + | |
- | + | ||
- | cd / | + | |
- | zpool export zroot && zpool import zroot | + | |
- | cp / | + | |
- | + | ||
- | cat << EOF > /zroot/ | + | |
- | # Device | + | |
/ | / | ||
/ | / | ||
EOF | EOF | ||
+ | </ | ||
- | # export LD_LIBRARY_PATH=/lib | + | === メールのエイリアスの生成 === |
- | # zfs unmount -a | + | <cli prompt="# |
+ | # cd /etc/mail | ||
+ | # make aliases | ||
+ | </ | ||
- | zfs set mountpoint=legacy zroot | + | === chroot環境から抜ける === |
- | zfs set mountpoint=/tmp zroot/tmp | + | <cli prompt="# "> |
- | zfs set mountpoint=/usr zroot/usr | + | # exit |
- | zfs set mountpoint=/ | + | # umount |
+ | </cli> | ||
+ | ===== zpool.cacheの更新 ===== | ||
+ | <cli prompt="# | ||
+ | # cd / | ||
+ | # zpool export zroot && zpool import zroot | ||
+ | # cp / | ||
+ | </ | ||
- | shから抜ける | + | ===== マウントポイントの設定 ===== |
- | exit | + | <cli prompt="# |
+ | # export LD_LIBRARY_PATH=/ | ||
+ | # zfs unmount -a | ||
+ | # zfs set mountpoint=legacy zroot/ | ||
+ | # zfs set mountpoint=/ | ||
+ | # zfs set mountpoint=/ | ||
+ | # zfs set mountpoint=/ | ||
+ | </ | ||
- | sshから抜ける | + | ===== 後始末 |
- | exit | + | <cli prompt="# "> |
- | + | # exit # shから抜ける | |
- | ====== STABLEに更新 | + | # exit # sshから抜ける |
- | cp / | + | </cli> |
- | vi / | + | |
- | /usr/ | + | |
====== 参考サイト ====== | ====== 参考サイト ====== | ||
* [[http:// | * [[http:// | ||
- | * [[http:// | + | * [[http:// |
+ | * [[http:// | ||
* [[http:// | * [[http:// | ||
* [[http:// | * [[http:// | ||
行 221: | 行 302: | ||
* [[http:// | * [[http:// | ||
* [[http:// | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||