I have a FreeBSD machine for which I don't have original installation files, thus rebuilding the machine and reinstalling software from the ground up on new hardware could be a problem.
I have a few of avenues getting a suitable secondary machine up and running:
I didn't use the dump/restore commands as I don't have easy access to enough space for temporary
storage so I brute forced the scenario by copying data directly from the source machine partition
to the destination machine partition.
I was able to obtain almost identical hardware for the second machine so as not to have any
hardware compatibility issues. Drive sizes and memory are larger on the second machine.
FreeBSD has a FixIt feature, otherwise known as a live boot, which allows a machine to be booted and
analyzed from a cd. I could have used a recent version of FreeBSD to do this task, but instead,
I chose a version which was of the same major.minor version as that of the running system at the
old release archives.
Once booted off the cd, a number of tasks can be completed:
- create partitions on the disks
- label the partitions
- obtain network connectivity
- copy partitions from source machine to destination machine
- depending upon services started, protect the destination machine from the network
- reboot the destination machine
- log in and verify successful operation
- possibly change driver, service, partition, and network settings
On the source machine, with root privileges, use 'df' and 'df -h' to determine partition
labels and sizes. 'sysinstall' may need to be run to get a listing of all partitions and their sizes,
particularily for the swap partition. The command 'swapctl -l -k -s' will detail the swap device.
On a SCSI based system, drive devices are named in fashion to /dev/da0s1a, where
da0 is drive 0, s1 is slice 1, and a is the first labelled partition. a is typically / (the boot partition),
b is typically swap, c is a hidden device for accessing the full drive, and d and
subsequent drives are partition mappings. On this system I have d as /var,
e as /tmp, and f as /usr.
On the destination computer, I selected the Fixit menu item, then the 'CDROM/DVD' option,
which takes me to a prompt.
I then used 'sysinstall' to gain access to various utilities. The first one I use is FDisk
to allocate all space on the drive to FreeBSD and use 'w' to write the changes to disk.
On exiting, I select the option to 'Install the FreeBSD Boot Manager' onto the drive.
I then use the Label editor to create partitions. They are created in order of a, b, d, e, and f. Note
that c is skipped as part of the process. Write the changes with 'w' and quit.
Then use the Networking menu item, then the Interfaces menu item to set ip addresses for the
interface.
Upon exiting back to the prompt, an 'ipconfig' command should show the ip address as being set.
After confirming network access is available, partitions can be copied over:
- ssh source_ip "cat /dev/da0s1a" | cat > /dev/da0s1a
- ssh source_ip "cat /dev/da0s1b" | cat > /dev/da0s1b
- ssh source_ip "cat /dev/da0s1d" | cat > /dev/da0s1d
- ssh source_ip "cat /dev/da0s1e" | cat > /dev/da0s1e
- ssh source_ip "cat /dev/da0s1f" | cat > /dev/da0s1f
Once things are copied over, disconnect the network interfaces, exit the menus, and
restart the machine. The machine should boot as though it was the original. Watch
the boot messages carefully for any errors.
The utility of the above operation improves if a filesystem snapshot capability is available
incorporated, then a guaranteed 'instant in time' view is available.