This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

Wednesday, July 29, 2015

Diskless Computer via NFS with ArchLinux

# pacman -S tftp-hpa dhcp nfs-utils btrfs-progs mkinitcpio mkinitcpio-nfs-utils
# pacman -S dhcp
# nano /etc/dhcpd.conf
allow booting;
allow bootp;

authoritative;
option domain-name-servers 192.168.0.10;
option architecture code 93 = unsigned integer 16;

group {
    next-server 192.168.0.10;
    if option architecture = 00:07 {
        filename "/grub/x86_64-efi/core.efi";
    } else {
        filename "/grub/i386-pc/core.0";
    }

    subnet 192.168.0.0 netmask 255.255.255.0 {
        option routers 192.168.0.1;
        range 192.168.0.128 192.168.0.254;
    }
}

# pacman –S tftp-hpa
# cp /usr/lib/systemd/system/tftpd.service /etc/systemd/system
# nano /etc/systemd/system/tftpd.service
[Unit]
Description=hpa's original TFTP daemon

[Service]
ExecStart=/usr/sbin/in.tftpd -s /srv/arch/boot
StandardInput=socket
StandardOutput=inherit
StandardError=journal


Run tftpd
# systemctl start tftpd.socket
Enable to run at boot time:
# systemctl enable tftpd.socket
Created symlink from /etc/systemd/system/sockets.target.wants/tftpd.socket to /usr/lib/systemd/system/tftpd.socket.
# pacman –S nfs-utils
# nano /etc/exports
/srv       *(rw,fsid=0,no_root_squash,no_subtree_check)
/srv/arch  *(rw,no_root_squash,no_subtree_check)
# mkdir /srv/arch
# sudo systemctl start nfs-idmapd.service           
# sudo systemctl start nfs-mountd.service
Client installation
# pacman –S btrfs.progs
# 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"
# pacman –S devtools arch-install-scripts
# pacstrap -d "$root" base mkinitcpio-nfs-utils nfs-utils
# 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}
Edit $root/etc/mkinitcpio.conf and add nfsv4 to MODULES, net_nfs4 to HOOKS, and /usr/bin/mount.nfs4 to BINARIES.
# nano /srv/arch/etc/mkinitcpio.conf
Next, we chroot our installation and run mkinitcpio:
# arch-chroot "$root" mkinitcpio -p linux
Client configuration
# pacman --root "$root" --dbpath "$root/var/lib/pacman" -S grub
Create a grub prefix on the target installation for both architectures using grub-mknetdir.
# arch-chroot "$root" grub-mknetdir --net-directory=/boot --subdir=grub
# nano "$root/boot/grub/grub.cfg"
menuentry "Arch Linux" {
    linux /vmlinuz-linux quiet add_efi_memmap ip=:::::eth0:dhcp nfsroot=192.168.0.10:/arch
    initrd /initramfs-linux.img
}