dd to the rescue!
How to rescue a remote, headless FreeBSD system from a Linux rescue image
which cannot mount ufs2 read-write? Impossible, you think? I just did it. :-)
We’re running (amongst others) a FreeBSD 7.0-RC1 installation as a web and mail
server. On a sad sad day, I rebooted the machine and ping told me it came up
just fine, but nmap told me that there was no way in any more. Hmm..
Our hosting provider has this service which
allows us to reboot our servers into a debian rescue image by sending an
properly formatted email to a special email address. Of course, from that
image, I couldn’t do much to fix the FreeBSD installation on the disk. This is
what I did:
- make an image of the first 100MB of the primary master hard
disk - copy that image to another server, or your local computer
- now place a FreeBSD image on the first 100MB of that hard disk (I
prepared one with
The Depenguinator, version 2.0) - reboot
- log in to the FreeBSD image, which is loaded into memory
- get back those 100MB you just copied over to a safe place and cat
them onto the same hard disk (different device name now of
course) - mount your FreeBSD installation’s file system hierarchy and try to
fix stuff - reboot
- repeat if necessary…
I must say I was a bit nervous and had to concentrate not to accidentally
mistype anything or cat or dd stuff onto the wrong place. But hey! It worked
out just fine in the end.
I’ve got my BSD machine back. /me happy!