*New 12.2 series Release:
2021-11-21: XigmaNAS 12.2.0.4.8860- released!

We really need "Your" help on XigmaNAS Language packages. Please help us today!

XigmaNAS talks on IRC https://web.libera.chat/#xigmanas, ircs://irc.libera.chat:6697 (TLS) or irc://irc.libera.chat:6667 (plain text)

[HOW TO] Diskless Freebsd on NAS4Free iSCSI target

Only Admin's or Moderators can move thread's to this sub-forum.
Nobody should start a new thread on this sub-forum.
Anybody can reply to a thread on this sub-forum.
Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
Hiji56
Advanced User
Advanced User
Posts: 170
Joined: Feb 13th, '21, 11:33
Status: Offline

[HOW TO] Diskless Freebsd on NAS4Free iSCSI target

#1

Post by Hiji56 »

"
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 all

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"";
}
Each client have his root-path, for another PXE programs, but iSCSI work without it.
Add next lines to rc.conf over webgui
dhcpd_enable = ""YES""
dhcpd_flags =""-q""
dhcpd_ifaces = ""vr0""
where vr0 - my nas LAN interface, name find on webgui page Network|Interface Management
Disable DHCP on router and Start DHCP server on NAS4Free.
Code: Select all

Code: Select all

/usr/local/etc/rc.d/isc-dhcpd start
Check how it work on local machines.
2. Create home folder for TFTP server. 75% BIOSes not know about www or iSCSI boot.
Code: Select all

Code: Select all

mkdir /mnt/data/tftpboot
I find very simple manual how to build PXE images and menu ""http://www.wonkity.com/~wblock/docs/html/pxe.html" here.
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 all

Code: 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
Check content /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 all

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
Target is ready for import files. Now I copy content from Aoyama's image into target install slice.
Code: Select all

Code: Select all

tar -c -f - -C /mnt/src/ . | tar -xvpf - -C /mnt/dest/
When ready - add to /boot/loader.conf
Code: Select all

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
Image now ready for boot and install Freebsd.
Code: Select all

Code: Select all

umount /mnt/src
unount /mnt/dest
mdconfig -d -u 11
mdconfig -d -u 10
4. Add to PXE menu next lines
label Freebsd
menu label Freebsd
kernel cmd.c32
append sanboot iscsi:<ipadress iSCSI server&>:tcp0:iqn.<[color=#FF0000"">Your.target.name&>
5. Boot from iSCSI, push on Freebsd menu label and when bootloader ask about boot - press F2.
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 all

Code: 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 
6. FreeBSD {without any storage} ready for next works - download and extract ports and sources
Enjoy
About speed
I have 100 mb Network - really fast boot. Faster then USB pen.
"
Post Reply