# x32 -> x64



## balanga (Jul 22, 2018)

I had this crazy idea of updating my FreeBSD installation from 11.1-i386 to 11.2-amd64 by doing the following:-

pkg info to get a list of installed pkgs
tar xSf of base.txz and kernel.txz to the root partition
pkg install from the list of pkgs installed

Is there any chance of this working?


----------



## Phishfry (Jul 22, 2018)

Since nothing is broke I would first bring it up to date for i386 with FreeBSD 11.2-RELEASE and then attempt the conversion by building from source, the entire universe as a 64bit cross compile. The cross compile will take additional steps not in the manual.
(Notably you must setup the amd64 compiling env)
https://www.freebsd.org/doc/handbook/makeworld.html

Something like this:

```
cd /usr/src
setenv MACHINE_ARCH=amd64
setenv MACHINE=amd64
setenv TARGET=amd64
setenv TARGET_ARCH=amd64
make buildworld TARGET=amd64
make buildkernel TARGET=amd64 KERNCONF=GENERIC
make installkernel TARGET=amd64 KERNCONF=GENERIC
shutdown -r now
cd /usr/src
make installworld TARGET=amd64
shutdown -r now
mergemaster -Ui
Rebuild/Re-Install all your Ports or Packages Now
shutdown -r now
Cleanup the old files by the above linked manual
```


----------



## Beastie (Jul 22, 2018)

If you want to do that on your live system, then yes it's crazy and won't work.

Otherwise, you'll need a working system during the whole extraction process. In other words, if you don't want to use external media, you'll need a second bootable FreeBSD system (on another partition of the same disk or another disk) to work from.

First you boot the second system. Running newfs(8) on every target partition will ensure you start with a clean slate. Then you mount the partitions and extract the distribution archives. Manually creating and populating */mnt*/etc/fstab will be necessary before you reboot into your new system.

Don't forget to make backups of all you need to keep (mostly configuration files).


----------



## balanga (Jul 22, 2018)

Beastie said:


> If you want to do that on your live system, then yes it's crazy and won't work.
> 
> Otherwise, you'll need a working system during the whole extraction process. In other words, if you don't want to use external media, you'll need a second bootable FreeBSD system (on another partition of the same disk or another disk) to work from.
> 
> ...



I was intending to boot off my network using mfsBSD over PXE, but since you advise that what I proposed is *crazy and won't work* , thought I'd better make a copy of the partition which I might need to restore if all goes tits up...

Now making a copy of a partition is something I struggle with... Can I just run `dd if=/dev/da0p3 of=/dev/da1p4` ? And restore flipping round if and of ?


----------



## Beastie (Jul 23, 2018)

balanga said:


> I was intending to boot off my network using mfsBSD over PXE


This counts as "using external media". So it should work fine, if you're careful enough.



balanga said:


> I'd better make a copy of the partition which I might need to restore if all goes tits up...


This is always recommended anyway, even if you're upgrading the regular way (from source or using freebsd-update(8)).



balanga said:


> Now making a copy of a partition is something I struggle with... Can I just run `dd if=/dev/da0p3 of=/dev/da1p4` ? And restore flipping round if and of ?


Use dump(8) and restore(8).


----------



## Phishfry (Jul 24, 2018)

I wasn't sure how that would work. That was simply my best guess. Glad we have Beastie to clarify.


----------



## balanga (Jul 28, 2018)

Beastie said:


> This counts as "using external media". So it should work fine, if you're careful enough.



One important factor I overlooked was the existence of schg flags which meant that my extract of base.tzx did not work properly.
Those need to be cleared before the extract. I haven't yet re-installed the pkgs, but I have a saved list to use.

But the essential thing is that I managed to boot up to FreeBSD 11.2 amd64 from a system which had 11.1 i386 running previously..


----------



## Beastie (Jul 28, 2018)

balanga said:


> One important factor I overlooked was the existence of schg flags which meant that my extract of base.tzx did not work properly.
> Those need to be cleared before the extract. I haven't yet re-installed the pkgs, but I have a saved list to use.
> 
> But the essential thing is that I managed to boot up to FreeBSD 11.2 amd64 from a system which had 11.1 i386 running previously..


That should've been taken care of by that part:


Beastie said:


> Running newfs(8) on every target partition will ensure you start with a clean slate.


----------

