Arch Linux 构建 NFSROOT启动的无盘系统

配置并编译内核参考:

https://www.cnblogs.com/kinglongmee/p/5043656.html

https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt

#编译内核参考文档 Arch

https://wiki.archlinux.org/index.php/Kernels/Compilation/Traditional_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)#%E7%BC%96%E8%AF%91%E5%86%85%E6%A0%B8%E6%A8%A1%E5%9D%97

https://www.tldp.org/HOWTO/NFS-Root-4.html

原文参考: 如何制作nfs root 完整系统

https://wiki.archlinux.org/index.php/Diskless_system

https://wiki.archlinux.org/index.php/Diskless_system#NFS

参考文章:

https://www.bbsmax.com/A/gGdXyZYz4m/

NFS服务搭建,依赖nfs-utils包

具体配置:

vi /etc/exports

/srv      *(rw,fsid=0,no_root_squash,no_subtree_check)

/srv/arch  *(rw,no_root_squash,no_subtree_check)


构建NFSROOT启动的initramfs文件,使用内核进行构建,内核需要已经启用NFS相关配置的内核

Now the initramfs needs to be constructed.

NFS

Trivial modifications to the net hook are required in order for NFSv4 mounting to work (not supported by nfsmount--the default for the net hook).

# sed s/nfsmount/mount.nfs4/ "$root/usr/lib/initcpio/hooks/net" > "$root/usr/lib/initcpio/hooks/netnfs4"

# cp $root/usr/lib/initcpio/install/net{,nfs4}

The copy of net is unfortunately needed so it does not get overwritten when mkinitcpio-nfs-utils is updated on the client installation.

Edit $root/etc/mkinitcpio.conf and add nfsv4 to MODULES, netnfs4 to HOOKS, and /usr/bin/mount.nfs4 to BINARIES.

Next, we chroot our installation and run mkinitcpio:

# arch-chroot "$root" mkinitcpio -p linux


以下修改没有理解;

# vim "$root/etc/fstab"

tmpfs  /var/log        tmpfs    nodev,nosuid    0 0

tmpfs  /var/spool/cups tmpfs    nodev,nosuid    0 0

但是貌似很重要


ipxe客户端中的内核启动命令:

#下载内核

kernel tftp://${net0/gateway}/arch/boot/x86_64/vmlinuz-linux548

initrd tftp://${net0/gateway}/arch/boot/intel_ucode.img

initrd tftp://${net0/gateway}/arch/boot/x86_64/initramfs-linux548.img

#内核参数 nfsroot= 参数中的 ‘:’ 特别重要

imgargs vmlinuz-linux548 initrd=intel_ucode.img initrd=initramfs-linux548.img root=/dev/nfs nfsroot=${net0/gateway}:/arch verify=n ip=dhcp imgtrust --allow

#启动

boot

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容