The thesis (available in Italian only) project developed a new procedure based on BitTorrent to improve the performance of the usual network boot based on PXE-DHCP-TFTP. The project is almost completed and at the moment, the next version will offer personalized boot parameters.
The instructions available on this page will be updated as needed in the future; for any suggestion please contact me by email (davide[dot]bruschi[at]studenti[dot]unimi[dot]it ) or compile the form at the end of this page.
Note: for a complete description of the project, see the thesis (in italian) at the beginning of this page or read this paper.
If you find this project useful or interesting and if you decide to use it, please leave a comment at the end of this page. :)
The new boot procedure works as described below:
Il server DHCP/TFTP richiede le seguenti modifiche: The DHCP/TFTP server needs the following changes:
Here we provide a general version of the scripts and files for the tool use:
default base label base kernel ./bzImage append initrd=./rootfs4.lzma lang=it_IT kmap=it rw root=/dev/null ip=dhcp vga=normal autologin
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # This script use the bittorrent and aria2 packages available on the repository + #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #Activating tracker in background on port 8000 (obviously you can set the port that you prefer) echo ">>> Starting Tracker http://indirizzodelserver:8000/announce" /usr/bin/bittorrent-tracker --port 8000 --dfile dfile > log_tracker.txt & #Creating and adding torrents to the tracker (needed every time because #if the file changes it has a different hash in the metafile) #(you can set ip and port as you prefer) echo ">>> Creating and adding torrents to the tracker" /usr/bin/maketorrent-console http://indirizzodelserver:8000/announce SILab #Start the client with all the torrent fiels in the current directory echo ">>> Starting torrents condivision" #setting seed-ratio at 999.0 so it will be never reached #so aria2 will stay active until you will close it by hand aria2c --enable-dht=false --disable-ipv6=true --bt-seed-unverified=true --seed-ratio=999.0 --listen-port=6882 SILab.torrent #In the comment: the version with RPC activated #aria2c --enable-rpc --rpc-listen-all --disable-ipv6=true --bt-seed-unverified=true --seed-ratio=999.0 *.torrent #Kill the tracker at the end of the job (you can do it by hand) echo ">>> killing tracker" kill $(pidof -x bittorrent-tracker)
#!/bin/ash #Download through torrent (version without RPC) aria2c --enable-dht=false --disable-ipv6=true --seed-time=0 --file-allocation=none -j5 /torrent/SILab.torrent #Prepare ed run kexec (example with our image) kexec -l SILab/2.6.39-gentoo-r3 --append="ramdisk_size=1228800 root=/dev/ram rw ip=dhcp udev nodevfs" --initrd=SILab/diskless.img.gz kexec -e
NOTE: the boot script inside the images below is called by “etc/init.d/local.sh” instead of being specified in “etc/rcS.conf”; anyway the result is the same
NOTE2: the images are posted in inverted order so the first one is always the last one
Kernel SliTaz (kernel v3.2.53)
Kernel SliTaz (kernel v3.2.53)
(At the moment the dhcp's discover is optimized for the SiLab lab. at the University of the Study of Milan; soon we'll release e new general version)
In this case is not necessary to edit the image directly. You just have to tell Slitaz where to find the script and the file .torrent needed.
To do that, you have to do the following things:
default base label base kernel ./bzImage append initrd=./rootfs4.lzma lang=it_IT kmap=it rw root=/dev/null ip=dhcp vga=normal autologin boottorrent=http://indirizzo_del_server/percorso/file.tar.gz
Doing this, when Slitaz starts, as first thing, will start the download of the tar.gz with the correct script and .torrent files and then will perform the boot using bittorrent for downloading the final system. If the final system changes, you just have to update the .torrent file in the tar.gz.
NOTE1: it's important that the file is a tar.gz, otherwise, slitaz will not work properly
NOTE2: in case you want to edit the image by hand, the boottorrent parameter is read from /etc/init.d/bootopts.sh and the download is done in the same place; the decompression of the tar.gz archive and the execution of the script are done from /etc/init.d/local.sh (this script needs the bash interpreter for working properly, so we installed it and changed the script's head from #!/bin/sh to #!/bin/bash)
With the non parameterized version you have to edit the already existing scripts by hand as shown below:
> mkdir tmp > cd tmp/ > cpio -id < ../initrd
> find . | cpio --create --format=’newc’ > ../newinitrd > cd ../ > lzma newinitrd
NOTE: in case of problems with the file's permissions we can get all the rights with the (very drastic) “sudo chmod -R 777 *”; this command doesn't create security problems because the image will be used in a controlled situation and just for the time needed for the download of the final system…
The details and the results of the tests are available in the thesis at the beginning of this page; below we report some short results for give you an idea of the improvements obtained:
124 PC; LAN 100Mbps Connection LAN ←→ Server = 4x100Mbps (LACP)
Final Operating System = about 420MB
Old procedure = PXE boot with transfer based on TFTP protocol