7L
Networks has been donating dedicated server hosting to Parted Magic
since 2008. Their primary services are Toronto Server Colocation, dedicated servers, cloud
hosting, managed servers, and other Toronto data center services.
Parted Magic has a very simple, yet powerful system for booting from a PXE server. Download the pmagic-pxe-X.X.zip file and unzip it. Copy the “pmagic” folder from the extracted archive to the root of the PXE directory, and edit the pxelinux.cfg file to read something like:
DEFAULT pmagic
# Boot the kernel and initramfs over PXE.
LABEL pmagic
LINUX pmagic/bzImage
INITRD pmagic/initramfs
APPEND edd=off load_ramdisk=1 prompt_ramdisk=0 rw vga=normal loglevel=9 max_loop=256
Or alternatively you can convert a Parted Magic ISO to PXE format. Mount the ISO, run a script:
mkdir /tmp/cdrom
mount -oloop pmagic-X.X.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.
Both methods will download the entire 165 MB Parted Magic distribution to the target computer's memory and run from there. You will need some 320+ MB RAM to run comfortably.
To add packages, you have to create an additional cpio archive to merge with the initramfs used to boot the system.
1. Create a dummy directory called anything you wish. E.g. “mydir”.
mkdir -p mydir/{modules,scripts}
The optional “scripts” directory will hold any custom scripts to be run when the system boots. This can be useful to automate a repetitive function that you may use on a daily basis.
2. Download/locate the desired package(s) and place them in the newly-created “modules” folder. Add your scripts to “scripts” if you plan to use this function.
3. The cpio archive necessary to merge with the initramfs needs to be created.
You can call the file anything that you choose. I 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. Now we just have to make a simple addition to the INITRD line in the pxelinux.cfg:
DEFAULT pmagic
# Boot the kernel and initramfs over PXE.
LABEL pmagic
LINUX pmagic/bzImage
INITRD pmagic/initramfs,pmagic/modules.cgz
APPEND edd=off load_ramdisk=1 prompt_ramdisk=0 rw vga=normal loglevel=9 max_loop=256
Workaround for tftp servers which can't transfer files larger than 32MB:
Extract the Parted Magic PXE archive, run a script:
sh pmagic-pxe-X.X/boot/pxelinux/split-initramfs.sh
Or alternatively when converting a Parted Magic ISO to PXE format run:
sh /tmp/cdrom/boot/pxelinux/pm2pxe.sh split
In both cases follow the instructions as output on which files to copy to the PXE server and on how to edit the pxelinux.cfg file.
Note that the split-initramfs.sh script should be run as root, or if this is not possible, that your cpio program must support the –owner option. The pm2pxe.sh script does not have this requirement.
PXE: the "memdisk - boot the standard PM ISO" way
Provided that your PXE server does not have a filesize limitation the “memdisk - boot the standard PM ISO” method is a complete alternative for the “classic” method as described above. Your pxelinux stanza is really simple:
DEFAULT pmagic_iso
# Boot the entire ISO over PXE.
LABEL pmagic_iso
LINUX /pmagic/memdisk
INITRD /pmagic/pmagic-X.X.iso
APPEND iso
The ISO is the standard Parted Magic one as distributed, the memdisk program came from the /boot/syslinux directory on the ISO.
Whereas with the “classic” PXE method there is no user menu (the options are preset on the server), with the memdisk method the user can choose his/her options from the standard menu. Depending on the specific use case this may or may not be an advantage.