Moving boot disk - does not seem easy?

Karl Denninger karl at
Thu Sep 12 22:01:10 UTC 2019

On 9/12/2019 16:26, james wrote:
> I had thought that this would be straightforward but it seems not.
> I have a freebsd 12 system, UFS boots /ada0p2.  Mounts some ZFS
> partitions and I'm away.
> I add a new PCIe card with a SATA SSD, and it grabs ada0.
> I want to move my boot to the SSD, not least because the boot priority
> now favours it as ada0, and I had to manually boot ada1p2.
> There's not much on ada1p2 now, but I want the new ada0p2 to be
> smaller, so dd is not attractive.
> What's the easiest way to set ata0 to be much like ada0p2 was (given
> that I booted from ada1p2)?
> Ideally I'd like boot and swap etc set up as well, which I kinda did
> already with sade.
> I already had the issue with freebsd-install/MANIFTEST missing and did
> a basic install to ada0, but it seems a bit naff to unmount all my ZFS
> mountpoints just to tar across all the rest of it.
> Any pointers?
I've done this many times and it's very easy.

Look at the old disk (e.g. "gpart ada1" and friends) so as to get the
proper partition settings (e.g. sizes, etc)

Use gpart to set up the NEW disk with the same basic configuration
(slice types, etc.) -- it is, of course, ok to change the sizes -- it's
just important that the data on the old disk fits.

Use gpart bootcode to write the bootcode to the NEW drive on the correct

Mount each boot-related partition temporarily (e.g. on /mnt on the
running system) and use whatever tool you prefer to copy it over since
it's UFS.  You can also use dump and restore in a pipeline to do this,
which will maintain files with holes in them without expanding the holes.

Fix etc/fstab on the new disk, and boot/loader.conf if required (e.g. if
the root is declared in there.)  Make sure you're doing this on the NEW
disk and not the currently-running one.

Boot the new drive, it should come up.

Do not use "dd" for this; that's a bad idea unless the two disks are
EXACTLY the same geometry and size -- and even then it's not a great
idea since you'll be copying empty blocks which is a waste of time.

Karl Denninger
karl at <mailto:karl at>
/The Market Ticker/
/[S/MIME encrypted email preferred]/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4897 bytes
Desc: S/MIME Cryptographic Signature
URL: <>

More information about the freebsd-questions mailing list