Network booting PartedMagic
PartedMagic provides from version 2020_02_23 two ways of transferring boot files from server to client. Older versions support only first method. First method is letting the boot-loaded download everything from server to memory in form of ram-disks (contained in PXE package). Second method uses boot-loader to download only kernel and base ram-disks. Download of the main .SQFS file and additional modules is handled from within running Linux kernel. This allows for files to be loaded from TFTP, HTTP or FTP server of NFS share. This method uses the files from ISO.
Kernel parameters for file download
To use the second method, it is necessary to provide kernel parameters describing the source. The parameters are:
netsrc: download methodneturl: path to the downloaded filesnetargs: additional arguments for download
HTTP/FTP download: netsrc=wget
neturl must point to directory with .SQFS file and additional modules and scripts. In case of HTTP, the server must provide directory listing in order for the download to work. Make sure to include trailing slash, otherwise wget will download content of parent directory as well.
netargs are used as additional arguments to wget. Default arguments are:
--no-check-certificate --reject index.html* --quiet --continue --show-progress --recursive -nH --no-parent
Examples:
Download files from HTTP server:
netsrc=wget neturl="http://<http-server>/tftp/pmagic/pmodules/"
Download files from anonymous FTP server:
netsrc=wget neturl="ftp://<ftp-server>/tftp/pmagic/pmodules/
Download files from password-protected FTP server without storing password
netsrc=wget neturl="ftp://<ftp-server>/tftp/pmagic/pmodules/" netargs="--ask-password --ftp-user=myusername"
TFTP download: netsrc=tftp
While TFTP is used in boot-loader, download using running kernel may provide better stability and speed.
neturl is composed of three fields separated by colon.
tftp-server:path to pmodules:extra_file1,extra_file2,...
First field (mandatory) is IP or host-name of TFTP server. Second field (mandatory) is path to pmodules directory. Third field (optional) is coma-separated list of additional files to download. Files are specified with path relative to second field.
netargs can provide additional arguments to busybox-tftp. The only one available is -b SIZE Transfer blocks of SIZE octets. Default block size is 32768. You may try increasing the block size for faster file transfer, but larger block may lead to transfer errors. Safe block size is between 512 – 1468 bytes, as single block fits into single Ethernet packet without fragmentation. Note: The block size must be supported by the TFTP server as well.
Examples
Download only main .SQFS
netsrc=tftp neturl="<tftp-server>:/pmagic/pmodules"
Download main .SQFS and additional modules (from pmodules directory)
netsrc=tftp neturl="<tftp-server>:/pmagic/pmodules:module1.tar.xz,module2.tar.xz"
Download only main file with small blocks:
netsrc=tftp neturl="<tftp-server>:/pmagic/pmodules" netargs="-b 512"
NFS download: netsrc=nfs
Download files recursively from NFS mount. The NFS mount is used only during boot and is unmounted once files are copied to memory.
neturl Path (including server) to directory containing PMAGIC_{VERSION}.SQFS.
netargs Additional arguments to mount.nfs command. Default arguments are: -o ro,nolock
Examples
netsrc=nfs neturl="<nfs_server>:/mnt/data/pmagic/pmodules" netargs=""
Boot-loader examples
PXELINUX
Download all files in boot-loader using TFTP
LABEL pmagic
MENU LABEL PartedMagic
LINUX /pmagic/bzImage
INITRD /pmagic/initrd.img,/pmagic/fu.img,/pmagic/m.img,/pmagic/files.cgz
APPEND edd=on vga=normal
Download main file using HTTP
LABEL pmagic
MENU LABEL PartedMagic
LINUX /pmagic/bzImage
INITRD /pmagic/initrd.img,/pmagic/fu.img,/pmagic/m.img
APPEND edd=on vga=normal netsrc=wget neturl="http://<http_server>/tftp/pmagic/pmodules/"
Download kernel and initrd with HTTP, main file using HTTP during boot (lpxelinux)
LABEL pmagic
MENU LABEL PartedMagic
LINUX http://<http_server>/tftp/pmagic/bzImage
INITRD http://<http_server>/tftp/pmagic/initrd.img,http://<http_server>/tftp/pmagic/fu.img,http://<http_server>/tftp/pmagic/m.img
APPEND edd=on vga=normal netsrc=wget neturl="http://<http_server>/tftp/pmagic/pmodules/"
GRUB
Download all files in boot-loader
menuentry "PartedMagic (RAM)"{
clear
echo "Loading kernel..."
linux /pmagic/bzImage edd=on vga=normal
echo "Loading initrd..."
initrd /pmagic/initrd.img /pmagic/fu.img /pmagic/m.img /pmagic/files.cgz
echo "Files loaded, booting..."
boot
}
Download using Wget
menuentry "PartedMagic (RAM)"{
clear
echo "Loading kernel..."
linux /pmagic/bzImage edd=on vga=normal netsrc=wget neturl="http://tftp-server/tftp/pmagic/pmodules/"
echo "Loading initrd..."
initrd /pmagic/initrd.img /pmagic/fu.img /pmagic/m.img
echo "Files loaded, booting..."
boot
}
iPXE
Download all files in boot-loader
#!ipxe
kernel http://${next-server}/tftp/pmagic/bzimage initrd=initrd.img initrd=fu.img initrd=m.img initrd=files.cgz edd=on vga=normal
initrd http://${next-server}/tftp/pmagic/initrd.img
initrd http://${next-server}/tftp/pmagic/fu.img
initrd http://${next-server}/tftp/pmagic/m.img
initrd http://${next-server}/tftp/pmagic/files.cgz
boot
Download using Wget
#!ipxe
kernel http://${next-server}/tftp/pmagic/bzimage initrd=initrd.img initrd=fu.img initrd=m.img edd=on vga=normal netsrc=wget neturl="http://${next-server}/tftp//pmagic/pmodules/" netargs="-U pmagicboot"
initrd http://${next-server}/tftp/pmagic/initrd.img
initrd http://${next-server}/tftp/pmagic/fu.img
initrd http://${next-server}/tftp/pmagic/m.img
boot
***Old Method Pre Parted Magic 2020_02_23 below***
The basics: PXELINUX
PXE: the “memdisk – boot the PM ISO” way
This method is the preferred way to implement PXE for Parted Magic.
Your pxelinux stanza is really simple:
DEFAULT pmagic
# Boot the entire ISO over PXE.
LABEL pmagic
LINUX pmagic/memdisk
INITRD pmagic/pmagic_20xx_xx_xx.iso
APPEND iso
The ISO is the Parted Magic one as distributed, with or without bundles and/or packages. The memdisk program comes from your distribution’s syslinux package (if none then try the memdisk program from the /boot/syslinux directory on the ISO.
See our Adding Programs page for details on bundles and packages.
PXE: the “classic” way
The biggest difference with the “memdisk” method as mentioned above is that whereas there the complete Parted Magic menu is available, here there is no user menu – all options are determined by the pxelinux.cfg file.
First you need to convert the Parted Magic ISO, with or without bundles and/or packages, to PXE format. Mount the ISO, run a script:
mkdir /tmp/cdrom
mount -oloop pmagic_20xx_xx_xx.iso /tmp/cdrom
sh /tmp/cdrom/boot/pxelinux/pm2pxe.sh
and follow the instructions as output on which files to copy to the PXE server and on how to edit the pxelinux.cfg file.
See our Adding Programs page for details on bundles and packages.
Starting with PartedMagic 2014_04_28 we already have run the above commands for you: untar the pmagic_pxe_20xx_xx_xx.tar.gz file on your PXE server.
Adding extra packages and/or bundles:
For details on packages and bundles refer to our Adding Programs page.
Adding packages and/or bundles by creating an additional cpio archive to be merged with the initrd.img used to boot the system is now deprecated. For backwards compatibility however things will remain supported for the time being:
1. Create a dummy directory called anything you wish. E.g. “mydir”.
mkdir -p mydir/{modules,scripts}
2. Download/locate the desired packages and/or bundles and place them in the newly-created “modules” folder. Add your scripts (if any) to “scripts”.
3. Create the cpio archive:
cd mydir
find | cpio -o -H newc | gzip -9 > ../modules.cgz
You can call the file anything that you choose. We just picked “modules.cgz” for this example. You can create multiple cpio archives if this is the way you prefer to do it. Just keep in mind, our directory structure needs to be used or this system will not work.
4. Add the cpio archive to the INITRD line in the pxelinux.cfg file:
INITRD …..,pmagic/modules.cgz
To amend an existing .cgz file replace step 1. above with e.g.:
mkdir mydir
cd mydir
gzip -cd ../modules.cgz | cpio -im
Workaround for tftp servers which cannot transfer files larger than 32 MB:
We know there are tftp servers out there that cannot transfer files larger than 32 MB. For such servers add “split” to the pm2pxe.sh invocations above, e.g.:
sh /tmp/cdrom/boot/pxelinux/pm2pxe.sh split
The resultant INITRD line may be too long for the tftp server. In such cases a workaround such as symlinking the “pmagic/” directory to e.g. “p/” and amending the pxelinux.cfg file accordingly often will succeed. In extreme cases even more aggressive symlinking may be necessary.
The Parted Magic PXE server:
The Parted Magic PXE client is designed such that any PXE server should be able to serve it. However the Parted Magic PXE server is optimized towards the Parted Magic PXE client:
– It is very lightweight;
– It is based on a DHCP proxy, such that it can be used even on crowded subnets;
– It transfers the files via HTTP, which should be faster than via TFTP.
Using the Parted Magic server is very simple:
— Place the Parted Magic ISO and/or the pm2pxe.sh outputs in the /srv/pxe/pmagic/ folder;
— Amend the /srv/pxe/pxelinux.cfg/default file;
— Start the PXE services (including the http server) by issuing pmagic_pxeserver in an xterm.
