Migrating the primary hard drive in OpenBSD

My web server is running on an OpenBSD VM that had to be upgraded from 7.7 to 7.8, but it turned out that the default OpenBSD drive labels created with disklabel(8)’s -A option made the /usr partition on the 16GB big drive too small to automatically update with sysupgrade(8).

After having looked around a bit for some way to still do this, I first stumbled upon sysclean(8). While nice, it didn’t help as there were essentially no files I could delete from /usr without bricking the system, so I was looking for another solution.

Eventually I stumbled over the blog post Cloning and Migrating the Primary Hard Drive on an OpenBSD Install which gives instructions on how to clone the primary hard drive in OpenBSD.

After following the instructions, which guides you through partitioning of the new disk, setting up labels and copying the live distro with dump(8) and restore(8), I managed to get my system up and running with a bigger drive that allowed me to run sysupgrade(8), syspatch(8) and upgrade all the packages with pkg_add(1).

There was one instance where I deviated from the blog post, though. Instead of taking the old partitions from disklabel(8) and applying them to the new disk, I generated new partitions with disklabel -wA.

Just don’t do the same mistake I did: Don’t forget to write a default MBR to the disk with fdisk -i before doing anything else. OpenBSD will boot, but things will be broken.

Do you have a comment on one of my posts? Feel free to send me an E-Mail: witcher@wiredspace.de
To participate in a public discussion, use my public inbox: ~witcher/public-inbox@lists.sr.ht (Archive)
Please review the mail etiquette.

Posted on: May 09, 2026

Articles from blogs I read

Announcing Rust 1.96.1

The Rust team has published a new point release of Rust, 1.96.1. Rust is a programming language that is empowering everyone to build reliable and efficient software. If you have a previous version of Rust installed via rustup, getting Rust 1.96.1 is as eas…

via Rust Blog June 30, 2026

relayd(8) and httpd(8) TLS settings update.

Both relayd(8) and httpd(8) now have the "secure" list of allowed crypto methods for HTTPS, which include TLSv1.3 and the TLSv1.2 AEAD cipher suites. The previous list was "HIGH:!aNULL" which contain non-perfect-forward-security methods and this c…

via OpenBSD Journal June 29, 2026

Status update 2026-06

Pimsync v0.5.11 is out, with the following set of improvements. Incremental sync[permalink] When watching a storage (e.g.: watching a filesystem for real-time changes), instead of executing a full synchronisation, a more focused and granular synchronisation i…

via Hugo's weblog on WhyNotHugo (雨果) June 27, 2026

Generated by openring