Contributed by deanna on from the user-blog dept.
Using the dump(8) command on a running OpenBSD system, it is possible to dump a filesystem image to a remote machine via an NFS mount or by using SSH... This involves issuing:
# export RSH=/usr/bin/ssh
before the actual dump(8) command. However, when one needs to perform the restore after having booted from an i386 bsd.rd image, he/she will quickly realize that the ssh binary is not available in the ramdisk image, nor is the nfs_mount binary, which automatically precludes one from the possibility of performing a network restore via NFS.
In light of this, how can a network restore be performed if the only possiblity of running restore(8) is to first boot from an i386 bsd.rd image? Well, if the dumpfile(s) is/are available on an accessible server running an FTP or HTTP server the ftp(1) program can be used to retrieve these files from the server and feed them to restore(8).
Although ftp(1) will, by default, download a file to the current directory giving it the same name it had on the FTP or HTTP server, by using the -o option an alternate file/location can be specified, including stdout. So, by issuing:
# ftp -o - http://<SITE>/<path>/<to>/<file>
the downloaded file will be sent to stdout.
In complementary fashion, the restore(8) command can also read a dumpfile from stdin using this syntax:
# restore -rvf -
Therefore, by piping ftp(8)'s output to the restore(8) program it's possible to perform a restore from a dumpfile stored on a remote server.
Using this syntax:
# ftp -o - http://<SITE>/<path>/<to>/<dumpfile> | restore -rvf -
or this syntax:
# ftp -o - ftp://<username>:<password>@<SITE>/<path>/<to>/<dumpfile> | restore -rvf -
you can restore from a dumpfile located on a remote HTTP or FTP server.
NOTE: The version of ftp(1) included on the bsd.rd ramdisk does not support HTTPS.
One very important to take into account when restoring via a bsd.rd image is that because restore(8) uses temporary files located in the temporary directory, and considering that the ramdisk offers a rather limited-size temporary files directory, it will usually be necessary to specify an alternate location (i.e. on an accessible hard disk) to store temporary files when trying to restore large filesystems (such as /usr). This is discussed in more details in this post.
CREDIT: After I asked the question on the @misc list that spawned this mini-article, Michal Soltys was the one that suggested using ftp(1)'s -o option to pipe the output to restore(8), and Henning Brauer pointed out the lack of https support in the ramdisk's version of ftp.
(Comments are closed)