The Shœstring Foundation Weblog

The Shœstring Foundation Weblog, Miscellaneous Byproducts

Matthias Bauer
bauerm (at) shoestringfoundation · org
reop pubkey
Vignettes by George Herriman and a small program

Subscribe to a syndicated feed of my weblog, brought to you by the wonders of RSS.

Blosxom Logo

Tue, 04 Oct 2011

Transferring files over the net with OpenBSD's bsd.rd

OpenBSD's installation ramdisk does not contain useful tools to quickly transfer files from a remote machine. Specially the absence of netcat is painfully felt. The typical routine to transfer a set of files from Host A to the Host-to-be-installed B would normally be
A% tar cf - dir1 dir2 | nc -l 1234
B% nc hostA 1234 | tar xpf -
To transfer whole partitions, it would be
A% dump -a0f - /dev/sd0a | nc -l 1234
B% newfs /dev/rsd0a && mount /dev/sd0a /mnt && \
    nc hostA 1234 | (cd /mnt; restore -r -f -)
What is included in the ramdisk, is OpenBSD's FTP client, ftp, which implements a subset of HTTP. So the above procedure becomes:
A% (echo -e "HTTP/1.1 200 OK\n"; sudo dump -0af - /dev/wd0g) | nc -l 1234
B% ftp -o /dev/stdout http://hostA:1234/ | restore -r -f -
(Of course one could also set up a whole ftp or http server and put the dumpfiles there, but oneliners are the essence of doability in *NIX)

[/projects] permanent link

Deutsch für extrem weit Fortgetretene

Bewurstlosigkeit :
Like unconsciousness, but without the sausages.

[/unsorted] permanent link