If you want to upgrade your disk or clone it for whatever reason (move to another machine, etc), you can do this easily with dump(8). Let's assume the old disk is wd0 and the new disk is wd1.
Cloning a disks is little more then doing a full system backup and restoring it to another disk.
Remember, you need to boot single user mode with "boot -s", fsck -p / && mount -uw / (repeat for /usr, etc) to make sure there are no problems with the level 0 dump (as OpenBSD dump does NOT support snapshots). If you have issues, just make sure everything is mounted properly (check with the "mount" command).
- Add the new disk, and check "dmesg".
- Initialize the MBR for the new disk:
# fdisk -i wd1
- Create a disklabel for the new disk:
# disklabel -e wd1
- Format the new disk:
# newfs /dev/wd1a
- Mount the disk:
# mount /dev/wda1 /mnt
- Change to the /mnt directory:
# cd /mnt
- Do a full system dump and restore to the /mnt mountpoint. If you have more filesystems, restore them to their respective mountpoints (/var goes to /mnt/var, etc).
# dump -0f - / | restore -rf -
- Change to the root directory:
# cd /
- Install bootblocks to make the second disk bootable:
# /usr/mdec/installboot -v /mnt/boot /usr/mdec/biosboot wd1
- Umount the new disk:
# umount /mnt
You can now remove the disk.
This dump can also be done over the network using ssh. Just replace the dump | restore commands with:
# /sbin/dump -0f- / | gzip -2 | ssh -c blowfish user@server dd of=/backup/disk.gzYou can now restore this image over the network at your own leisure. This will also serve as a full disk backup.
On a side note, be sure to read the manpage for newfs(8). Look at the -i option to chose the inode density. Depending on the server's role, you may run out of inodes before you run out of disk space. There's 2 ways to avoid this: larger disks / partitions = more inodes or chaning the inode density. This is especially important since you can't change it in the installer. So one way to avoid such problems is to create the data partition (for your web stuff or whatever) after you've installed the system. That, or dump / newfs -i 2048 / restore.