Home
Packages
Forums
Wiki
GitLab
Security
AUR
Download
コンテンツにスキップ
メインメニュー
メインメニュー
サイドバーに移動
非表示
案内
メインページ
目次
コミュニティに貢献
最近の出来事
おまかせ表示
特別ページ
交流
ヘルプ
貢献
最近の更新
最近の議論
新しいページ
統計
リクエスト
ArchWiki
検索
検索
表示
アカウント作成
ログイン
個人用ツール
アカウント作成
ログイン
ディスクレスシステムのソースを表示
ページ
議論
日本語
閲覧
ソースを閲覧
履歴を表示
ツール
ツール
サイドバーに移動
非表示
操作
閲覧
ソースを閲覧
履歴を表示
全般
リンク元
関連ページの更新状況
ページ情報
表示
サイドバーに移動
非表示
←
ディスクレスシステム
あなたには「このページの編集」を行う権限がありません。理由は以下の通りです:
この操作は、次のグループに属する利用者のみが実行できます:
登録利用者
。
このページのソースの閲覧やコピーができます。
[[Category:Arch の入手とインストール]] [[en:Diskless system]] {{Related articles start}} {{Related|NFS}} {{Related|NFS/トラブルシューティング}} {{Related|PXE}} {{Related|Mkinitcpio#net を使う}} {{Related articles end}} [[Wikipedia:Diskless node]] より: :''ディスクレスノード (またはディスクレスワークステーション) とは、ディスクドライブを使わずに、ネットワークブートを利用してサーバーからオペレーティングシステムをロードするワークステーション、またはパーソナルコンピュータのことである。'' == サーバー設定 == まず最初に、以下をインストールする必要があります: * ディスクレスノードに IP アドレスを割り当てるための [[Dhcpd|DHCP]] サーバー。 * ブートイメージを転送するための [[TFTP]] サーバー (全ての PXE オプション ROM の必須要件)。 * Arch 環境をディスクレスノードにエクスポートするためのネットワークストレージ ([[NFS]] または NBD)。 {{Note|{{pkg|dnsmasq}} は DHCP と TFTP サーバーの両方として使うことができます。詳しくは [[dnsmasq]] の記事を参照。}} === DHCP === ISC {{Pkg|dhcp}} をインストールして設定: {{hc|/etc/dhcpd.conf|2= allow booting; allow bootp; authoritative; option domain-name-servers 10.0.0.1; option architecture code 93 = unsigned integer 16; group { next-server 10.0.0.1; if option architecture = 00:07 { filename "/grub/x86_64-efi/core.efi"; } else { filename "/grub/i386-pc/core.0"; } subnet 10.0.0.0 netmask 255.255.255.0 { option routers 10.0.0.1; range 10.0.0.128 10.0.0.254; } } }} {{Note|{{ic|next-server}} should be the address of the TFTP server; everything else should be changed to match your network}} RFC 4578 には "Client System Architecture Type" dhcp オプションが定義されています。上記の設定の場合、PXE クライアントが x86_64-efi バイナリ (タイプ 0x7) をリクエストした場合、適切に返答し、そうでない場合はレガシーなバイナリを使います。これによって、同一のネットワークセグメント上で同時に UEFI とレガシーな BIOS のクライアントを起動できるようにしています。 ISC DHCP の [[systemd]] サービスを起動してください。 === TFTP === TFTP サーバーはブートローダーやカーネル、initramfs などをクライアントに転送にするのに使います。 TFTP の root は {{ic|/srv/arch/boot}} に設定してください。詳しくは [[TFTP]] を参照。 === ネットワークストレージ === NFS と NBD どちらを使用する場合でも複数のクライアントを扱うことができますが、大きな違いとして、NBD では (ファイルシステムを直接操作するため) {{ic|copyonwrite}} モードを使う必要があります。そのため、クライアントが切断すると全ての書き込みが破棄されます。ただし、場合によってはこれが望ましいということも考えられます。 ==== NFS ==== サーバーに {{Pkg|nfs-utils}} をインストールしてください。 Arch 環境の root を [[NFS]] の exports に追加する必要があります: {{hc|/etc/exports|2= /srv *(rw,fsid=0,no_root_squash,no_subtree_check) /srv/arch *(rw,no_root_squash,no_subtree_check) }} そして、NFS サービスを起動してください: {{ic|rpc-idmapd}} {{ic|rpc-mountd}}。 ==== NBD ==== {{Pkg|nbd}} をインストールして設定します。 {{hc|# vim /etc/nbd-server/config|2= [generic] user = nbd group = nbd [arch] exportname = /srv/arch.img copyonwrite = false }} {{Note|Set {{ic|copyonwrite}} to true if you want to have multiple clients using the same NBD share simultaneously; refer to {{ic|man 5 nbd-server}} for more details.}} {{ic|nbd}} systemd サービスを起動してください。 == クライアントのインストール == 次に、サーバーのサブディレクトリに完全な Arch Linux 環境を構築します。起動時、ディスクレスノードは DHCP サーバーから IP アドレスを取得して、PXE を使ってホストから起動し、構築した環境を root としてマウントします。 === ディレクトリのセットアップ === 最低でも1ギガバイトの[[Wikipedia: Sparse file|スパースファイル]]を作成して、ファイル上に btrfs ファイルシステムを作成してください (もちろん、必要であればブロックデバイスや [[LVM]] を使うこともできます)。 # truncate -s 1G /srv/arch.img # mkfs.btrfs /srv/arch.img # export root=/srv/arch # mkdir -p "$root" # mount -o loop,discard,compress=lzo /srv/arch.img "$root" {{Note|Creating a separate filesystem is required for NBD but optional for NFS and can be skipped/ignored.}} === ブートストラップのインストール === {{Pkg|devtools}} と {{Pkg|arch-install-scripts}} をインストールしてから {{ic|mkarchroot}} を実行してください。 # pacstrap -d "$root" base mkinitcpio-nfs-utils nfs-utils {{Note|In all cases {{Pkg|mkinitcpio-nfs-utils}} is still required. {{ic|ipconfig}} used in early-boot is provided only by the latter.}} そして initramfs を生成してください。 ==== NFS ==== NFSv4 のマウントをするためには {{ic|net}} フックに細かい修正を加える必要があります ({{ic|net}} フックのデフォルトである {{ic|nfsmount}} はサポートされていません)。 # sed s/nfsmount/mount.nfs4/ "$root/usr/lib/initcpio/hooks/net" > "$root/usr/lib/initcpio/hooks/net_nfs4" # cp $root/usr/lib/initcpio/install/net{,_nfs4} クライアント側で {{pkg|mkinitcpio-nfs-utils}} がアップデートされたときに上書きされないように {{ic|net}} のコピーを作成する必要があります。 {{ic|$root/etc/mkinitcpio.conf}} を編集して {{ic|MODULES}} に {{ic|nfsv4}} を、{{ic|HOOKS}} に {{ic|net_nfs4}} を、{{ic|BINARIES}} に {{ic|/usr/bin/mount.nfs4}} を追加してください。 そして、作成した環境に [[chroot]] して ''mkinitcpio'' を実行します: # arch-chroot "$root" mkinitcpio -p linux ==== NBD ==== クライアントに {{AUR|mkinitcpio-nbd}} パッケージをインストールする必要があります。''makepkg'' でビルドしてインストールしてください: # pacman --root "$root" --dbpath "$root/var/lib/pacman" -U mkinitcpio-nbd-0.4-1-any.pkg.tar.xz {{ic|HOOKS}} 行の {{ic|net}} の後ろに {{ic|nbd}} を追加する必要があります。{{ic|net}} はネットワークの設定を行いますが、カーネル行で {{ic|nfsroot}} が指定されていない場合 NFS のマウントは行いません。 == クライアント設定 == 以下の設定の他に、[[ネットワーク設定#ホストネームの設定|ホストネーム]]、[[時刻#タイムゾーン|タイムゾーン]]、[[ロケール#システム全体のロケールを設定する|ロケール]]、[[コンソールでのキーボード設定|キーマップ]]なども設定する必要があります。[[インストールガイド]]を見て下さい。 === ブートローダー === ==== GRUB ==== ドキュメントで明記はされていませんが、GRUB は PXE によるロードをサポートしています。 # pacman --root "$root" --dbpath "$root/var/lib/pacman" -S grub Create a grub prefix on the target installation for both architectures using {{ic|grub-mknetdir}}. # arch-chroot "$root" grub-mknetdir --net-directory=/boot --subdir=grub Luckily for us, grub-mknetdir creates prefixes for all currently compiled/installed targets, and the {{Pkg|grub}} maintainers were nice enough to give us both in the same package, thus grub-mknetdir only needs to be run once. Now we create a trivial GRUB configuration: {{hc|# vim "$root/boot/grub/grub.cfg"|2= menuentry "Arch Linux" { linux /vmlinuz-linux quiet add_efi_memmap ip=:::::eth0:dhcp nfsroot=10.0.0.1:/arch initrd /initramfs-linux.img } }} [[GRUB]] dark-magic will {{ic|1=set root=(tftp,10.0.0.1)}} automatically, so that the kernel and initramfs are transferred via TFTP without any additional configuration, though you might want to set it explicitly if you have any other non-tftp menuentries. {{Note|Modify your kernel line as-necessary, refer to [[Syslinux#Pxelinux|Pxelinux]] for NBD-related options}} ==== Pxelinux==== {{Pkg|syslinux}} には [[Syslinux|Pxelinux]] が含まれています。詳しくは [[Syslinux#Pxelinux]] を参照。 === マウントポイントの追加 === ==== NBD root ==== In late boot, you will want to switch your root filesystem mount to both {{ic|rw}}, and enable {{ic|1=compress=lzo}}, for much improved disk performance in comparison to [[NFS]]. {{hc|# vim "$root/etc/fstab"|2= /dev/nbd0 / btrfs rw,noatime,discard,compress=lzo 0 0 }} ==== Program state directories ==== You could mount {{ic|/var/log}}, for example, as tmpfs so that logs from multiple hosts do not mix unpredictably, and do the same with {{ic|/var/spool/cups}}, so the 20 instances of cups using the same spool do not fight with each other and make 1,498 print jobs and eat an entire ream of paper (or worse: toner cartridge) overnight. {{hc|# vim "$root/etc/fstab"|2= tmpfs /var/log tmpfs nodev,nosuid 0 0 tmpfs /var/spool/cups tmpfs nodev,nosuid 0 0}} It would be best to configure software that has some sort of state/database to use unique state/database storage directories for each host. If you wanted to run [http://puppetlabs.com/ puppet], for example, you could simply use the {{ic|%H}} specifier in the puppet unit file: {{hc|# vim "$root/etc/systemd/system/puppetagent.service"|2= [Unit] Description=Puppet agent Wants=basic.target After=basic.target network.target [Service] Type=forking PIDFile=/run/puppet/agent.pid ExecStartPre=/usr/bin/install -d -o puppet -m 755 /run/puppet ExecStart=/usr/bin/puppet agent --vardir=/var/lib/puppet-%H --ssldir=/etc/puppet/ssl-%H [Install] WantedBy=multi-user.target }} Puppet-agent creates vardir and ssldir if they do not exist. If neither of these approaches are appropriate, the last sane option would be to create a [http://www.freedesktop.org/wiki/Software/systemd/Generators systemd generator] that creates a mount unit specific to the current host (specifiers are not allowed in mount units, unfortunately). == クライアントの起動 == === NBD === If you are using NBD, you will need to umount the {{ic|arch.img}} before/while you boot your client. This makes things particularly interesting when it comes to kernel updates. You cannot have your client filesystem mounted while you are booting a client, but that also means you need to use a kernel separate from your client filesystem in order to build it. You will need to first copy {{ic|$root/boot}} from the client installation to your tftp root (i.e. {{ic|/srv/boot}}). # cp -r "$root/boot" /srv/boot You will then need to umount {{ic|$root}} before you start the client. # umount "$root" {{Note|To update the kernel in this setup, you either need to mount {{ic|/srv/boot}} using [[NFS]] in [[fstab]] on the client (prior to doing the kernel update) or mount your client filesystem after the client has disconnected from NBD}} == 参照 == * [https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt kernel.org: Mounting the root filesystem via NFS (nfsroot)] * [http://www.syslinux.org/wiki/index.php/PXELINUX syslinux.org: pxelinux FAQ]
このページで使用されているテンプレート:
テンプレート:AUR
(
ソースを閲覧
)
テンプレート:Hc
(
ソースを閲覧
)
テンプレート:Ic
(
ソースを閲覧
)
テンプレート:META Related articles start
(
ソースを閲覧
)
テンプレート:Man
(
ソースを閲覧
)
テンプレート:Note
(
ソースを閲覧
)
テンプレート:Pkg
(
ソースを閲覧
)
テンプレート:Related
(
ソースを閲覧
)
テンプレート:Related articles end
(
ソースを閲覧
)
テンプレート:Related articles start
(
ソースを閲覧
)
ディスクレスシステム
に戻る。
検索
検索
ディスクレスシステムのソースを表示
話題を追加