iPXE discussion forum
RAW Read and Write to DISK - Printable Version

+- iPXE discussion forum (https://forum.ipxe.org)
+-- Forum: iPXE user forums (/forumdisplay.php?fid=1)
+--- Forum: General (/forumdisplay.php?fid=2)
+--- Thread: RAW Read and Write to DISK (/showthread.php?tid=7777)



RAW Read and Write to DISK - jrsmile - 2015-07-18 11:08

does someone know a way to use ipxe to download a img file and save it to the local disk? or reading the disk and uploading it to a http server?


RE: RAW Read and Write to DISK - NiKiZe - 2015-07-19 00:44

iPXE does "not" have any disk support.
The exception being the ability to log data to an specific partition type that can be used in case no other log facility is available, commit: https://git.ipxe.org/ipxe.git/commit/3ec8b67818c146064bbc830490c1fa4454ba1513

Other then disk access, iPXE is also missing any kind of filesystem support, maybe you could chain to grub to do this, but I don't think grub has any kind of fs write support eighter?


RE: RAW Read and Write to DISK - jrsmile - 2015-07-19 10:52

it is not necessary to have filesystem support.
what i would like to do is
imgfetch http://server/image.img
imgverify image.img http://server/image.sig
imgwrite /dev/sda image.img
which would write the img file to disk (including the mbr/gpt in the img file)

this way one could build a rescue system without anything but ipxe.


RE: RAW Read and Write to DISK - icb - 2015-08-19 15:16

What's driving your desire for iPXE-only? I would do this by booting into a minimal Linux initrd. Gentoo have a decent guide.

You would give iPXE something like:
Code:
#!ipxe
dhcp
kernel disk-write/kernel
imgfetch disk-write/initrd
imgfetch disk-write/sda.img /sda.img
boot

The image fetched to /sda.img will appear in that location once you've booted.

The /init in your initrd could then be something like:
Code:
#!/bin/busybox sh

dd if=/sda.img of=/dev/sda
echo Completed.
sleep 10
shutdown -r now