And here it is: GParted via PXE
After some attempts I succeeded in booting GParted via PXE. Because I read that some of you wanted the same, I'll post my steps how I got it working.
For sure, we need GParted. I used the USB-Version (0.3.1.1). If the ISO works either and if the steps are similar, I don't know Then we will need the tool ext2resize. It is available at http://ext2resize.sf.net and also as Debian package. That's all
At first I'll explain a bit how the GParted image works. When we boot from the stick, a little linux image will be loaded from the initial ramdisk (initrd.gz). When it is starting up, it will check each USB-port if there is an stick attached which includes a file named "gparted" in its root directory. If such a port was found, the stick is mounted and the image and GParted will be loaded.
If we want to boot via PXE, we do not have any stick attached to the system, so that check will fail. We also do not want do deliver an additional file (gparted) via the PXE. The solution is to include that file into the initrd and modify the startup script.
Sounds quite easy, doesn't it? So, let's start.
First of all, we have to extract the zip archive. Then unzip the initial ramdisk:
# gunzip initrd.gz
The initrd has a proper size but it's to small to include the gparted file (it has a size of round about 23MB). So we have to enlarge the ramdisk. Before we can do that, we have to define the file sizes of initrd and gparted:
# du -m initrd
14 initrd
# du -m gparted
23 gparted
The initrd has a size of 14MB, gparted is 23MB. I've enlarged my initrd with 25MB, so there is enough free space.
Enlarging is done by
# dd if=/dev/zero of=initrd bs=1M seek=14 count=25
That means we'll find the point that is 14MB in the image and append 25MB from there on. The resulting image will have a size of 29MB. Then, we've to run ext2resize on that image to enlarge the file system either:
# ext2resize initrd
Now we will mount that image into the new subfolder image (using a loop-device) to be able to edit it:
# mkdir image
# mount initrd image/ -o loop
If we have a look into that folder, we will find there a complete folder structure as on every other linux system, too. Now, we can copy the gparted-file into the /tmp-folder of the image:
# cp gparted image/tmp
Then we have to edit the startup script of the initial ramdisk. It is named linuxrc and can be found in the image-folder.
In that file, there is a section that tests the USB devices. It starts with the line
USB_LIST=""
and ends in from of the line
if [ -f /dev/ramboot ]; then
I have simply deleted them all
After that line, the stick will be mounted to /tmp. But we have the gparted-file already there, so we do not need mounting it. Delete that line and the following one with the sleep command. The first line after
if [ -f /dev/ramboot ]; then
should be
losetup /dev/loop0 /tmp/gparted >/dev/null 2>&1
Some lines below, the stick will be mounted again, delete that line
mount -n -t msdos $GPARTED_USB_DEVICE /tmp
either.
Save the file.
Now we've modified everything, we just have to do some clean up.
Unmount the image and gzip the initrd:
# umount image
# gzip initrd
Serve the new initrd.gz with the provided linux-kernel. The other files in the folder are just needed if you boot from the stick, they provide a boot loader.
If you're using pxelinux, you have to do the following:
create a folder gparted in your tftp-root and copy the files in there:
# mkdir gparted
# cp /any/where/initrd.gz gparted
# cp /any/where/linux gparted
Add the following lines to the pxelinux-configuration-file (/tftproot/pxelinux.cfg/default by default)
LABEL gparted
MENU LABEL GParted
kernel /gparted/linux
append noapic initrd=/gparted/initrd.gz root=/dev/ram0 init=/linuxrc ramdisk_size=65000
If you want to use the "Low memory"-version of GParted, set the ramdisk_size to a smaller number, eg. 16384.
That's all. Enjoy GParting
Regards,
David