[HOW TO] Diskless Freebsd on NAS4Free iSCSI target
Posted: Feb 27th, '21, 08:26
"
"by alexey123ยป07 Oct 2012 01:56
I find in internet many ways, but I want full mashine, without mfsroot, without read-only root and so.. My way is iSCSI boot from NAS4Free target.
1. Install DHCP server. May be some way, for example ""https://www.xigmanas.com/oldforums/view ... 1&t=92""
I use isc-dhcpd4.2 on NAS4Free with very simple config
Code: Select allEach client have his root-path, for another PXE programs, but iSCSI work without it.Code: Select all
subnet 10.0.0.0 netmask 255.255.255.0 { range 10.0.0.40 10.0.0.60; option domain-name-servers 10.0.0.138; option routers 10.0.0.138; option broadcast-address 10.0.0.255; default-lease-time 1600; max-lease-time 7200; next-server 10.0.0.1; # TFTP server address filename ""gpxelinux.0""; }
Add next lines to rc.conf over webguiwhere vr0 - my nas LAN interface, name find on webgui page Network|Interface Managementdhcpd_enable = ""YES""
dhcpd_flags =""-q""
dhcpd_ifaces = ""vr0""
Disable DHCP on router and Start DHCP server on NAS4Free.
Code: Select allCheck how it work on local machines.Code: Select all
/usr/local/etc/rc.d/isc-dhcpd start
2. Create home folder for TFTP server. 75% BIOSes not know about www or iSCSI boot.
Code: Select allI find very simple manual how to build PXE images and menu ""http://www.wonkity.com/~wblock/docs/html/pxe.html" here.Code: Select all
mkdir /mnt/data/tftpboot
All tested, all work.
Also work ""https://www.xigmanas.com/oldforums/view ... 5&t=93" Raul's building
Start TFTP server over webgui
3. For iSCSI boot need download freebsd install image , special prepared by Daisuke Aoyama for x64 CPU
""http://shell.peach.ne.jp/aoyama/archives/2115">Original page
""http://www.peach.ne.jp/archives/isboot/ ... -0.2.6.img"
Put downloaded image into NAS4free /mnt/data folder , attach it as md device and mount it
Code: Select allCheck content /mnt/srcCode: Select all
mdconfig -a -t vnode -f /mnt/data/FreeBSD-9.1-RC1-amd64-memstick-isboot-0.2.6.img -u 10 mkdir /mnt/src mount /dev/md10 /mnt/src
For x86 CPU need download image from ""ftp://ftp.freebsd.org/pub/FreeBSD/relea ... k.img"here, check into /boot/kernel folder isboot.ko module and add to /boot/loader string isboot_load=YES
3.a Prepare iSCSI target. I create target with 15G size, but size is small, I'll re-create it in future
Extent
Attachment dead(Hiji56)
Target
Attachment dead(Hiji56)
Partitioning target. For targets I use folder on my file storage /mnt/disk/isci and my target named [color=#0000BF"">extent5[/u]
I divide the disk into two partitions - the first for a future system, second - for the installation and I make boot manager.
As result - when I press on start F2 key, I begin work from Aoyama's image, when I press F1 key - I boot from full FreeBSD
Code: Select allTarget is ready for import files. Now I copy content from Aoyama's image into target install slice.Code: Select all
mdconfig -a -t vnode -f /mnt/disk/isci/extent5 -u 11 gpart create -s mbr md11 gpart add -s 14G -t freebsd md11 gpart add -s 800m -t freebsd md11 gpart add -s 795m -t freebsd-ufs md11s2 gpart bootcode -b /boot/boot md11s1 gpart bootcode -b /boot/boot md11s2 gpart bootcode -b /boot/boot0 md11 newfs /dev/md11s2a mkdir /mnt/dest mount /dev/md11s1a /mnt/dest
Code: Select allWhen ready - add to /boot/loader.confCode: Select all
tar -c -f - -C /mnt/src/ . | tar -xvpf - -C /mnt/dest/
Code: Select allImage now ready for boot and install Freebsd.Code: Select all
echo 'vfs.root.mountfrom=""ufs:/dev/da0s2a"">> /mnt/dest/boot/loader.conf echo 'vfs.root.mountfrom.options=rw""' >> /mnt/dest/boot/loader.conf
Code: Select all4. Add to PXE menu next linesCode: Select all
umount /mnt/src unount /mnt/dest mdconfig -d -u 11 mdconfig -d -u 10
5. Boot from iSCSI, push on Freebsd menu label and when bootloader ask about boot - press F2.label Freebsd
menu label Freebsd
kernel cmd.c32
append sanboot iscsi:<ipadress iSCSI server&>:tcp0:iqn.<[color=#FF0000"">Your.target.name&>
and make standart install FreeBSD on first partition.
After install and reboot - boot from F1 - new installed FreeBSD
If system not find root on first boot - manually input rootpath
tape /dev/da0s1a
After success boot and edit /etc/ssh/sshd_config edit /boot/loader.conf
Code: Select all6. FreeBSD {without any storage} ready for next works - download and extract ports and sourcesCode: Select all
echo 'vfs.root.mountfrom=""ufs:/dev/da0s1a""'>> /mnt/dest/boot/loader.conf echo 'vfs.root.mountfrom.options=rw""' >> /mnt/dest/boot/loader.conf
Enjoy
About speed
I have 100 mb Network - really fast boot. Faster then USB pen.