# Get rid of TrueOS, go to base FreeBSD, keep zpools



## peterchris (Apr 15, 2019)

I'd like to get rid of TrueOS, start with base FreeBSD and configure from there. I've got two zpools which are replicated to another box on the network.  At this point I can:

1.  Install FreeBSD from the USB stick, completely reformatting the drives, set up new zpools, and copy the datasets over from the remote box.

or

2. Somehow install FreeBSD from the USB without nuking the drives?  I could not figure out how to do this from the installer.

Some info about the current two zpools.  
1. Both consist of two physical drives which are mirrored.
2. You probably inferred that one has data while the other has the OS and a few user home directories.  You would be correct.

Any advice on how to proceed?

I'm thinking if I install on one of the mirrored OS drives, I'll easily be able to add the data zpool and stuff from the other mirrored OS drive.  Pure fantasy?


----------



## mickey (Apr 15, 2019)

peterchris said:


> I'd like to get rid of TrueOS, start with base FreeBSD and configure from there. I've got two zpools which are replicated to another box on the network.  At this point I can:
> 
> 1.  Install FreeBSD from the USB stick, completely reformatting the drives, set up new zpools, and copy the datasets over from the remote box.
> 
> ...


or

3. Boot FreeBSD from USB, choose Live CD option and install FreeBSD manually in a boot environment compatible way.

Once you have the ZFS datasets set up, it's basically extract some tar files and create basic /boot/loader.conf, /etc/rc.conf, /etc/sysctl.conf and /etc/fstab files.


----------



## peterchris (Apr 15, 2019)

Cool.  I found a manual install thread here.


----------



## Spartrekus (Apr 15, 2019)

peterchris said:


> Cool.  I found a manual install thread here.



wtih that harmfull script you can override installation and bring alive a magic usb stick on size >= 16gb:


```
#.1
#.2
#.3
#.4
echo =========================
echo "** Expert use only"
echo "** Fast deployment, without security at all. no warranty "
echo "** Press Enter"
echo =========================
read abcd

echo "MD5 kernel.txz = 0d4ed395541dbeb6ae9001afc351561e"
echo "MD5 base.txz = 97216020220a816ab689b6ee25bbbd9e"
echo "MD5 mbr.bin = be7329a1dfff69930ae2c8b12f2a0b6f"

echo Copying mbr with dd...
wget https://raw.githubusercontent.com/spartrekus/deploy-FreeBSD/master/mbr.bin -O mbr.bin
md5 mbr.bin
dd if=mbr.bin of=/dev/da0

gpart list da0

echo =========================
echo Execute newfs on da0s1a
newfs /dev/da0s1a

cd /tmp
umount /target
mkdir /target
mount /dev/da0s1a  /target
cd /target


echo =========================
echo Fetching the kernel.txz file
wget "https://netix.dl.sourceforge.net/project/freebsd-12-r328126/r328126-freebsd-dist/usr/freebsd-dist/kernel.txz"    -O kernel.txz
echo Fetching the base.txz file
wget "https://netcologne.dl.sourceforge.net/project/freebsd-12-r328126/r328126-freebsd-dist/usr/freebsd-dist/base.txz"  -O base.txz


echo =========================
echo Uncompress kernel file
md5 kernel.txz
tar xpfz kernel.txz

echo =========================
echo Uncompress base file
md5 base.txz
tar xpfz base.txz

echo =========================
echo Create fstab
echo "/dev/da0s1a     /               ufs     rw      1       1" > /target/etc/fstab
echo "/dev/da0s1b     none            swap    sw      0       0" >> /target/etc/fstab



echo =========================
echo Create rc.conf and wifi wpa config using local etc directory
cp /etc/rc.conf /target/etc/rc.conf
cp /etc/wpa_supplicant.conf /target/etc/


echo =========================
echo Copy wrapper



echo =========================
echo Entropy fix wrapper for lib
cp /root/libcrypto.so.111  /target/root/
cp /root/libssl.so.111     /target/root/


echo =========================
echo Process Completed


echo Umount
cd /tmp
umount /target
umount /target
cd /tmp
mount

echo =========================
echo "Mission Completed."
echo "End of Transmission."
echo =========================
```


----------



## D-FENS (Apr 15, 2019)

If you indeed want to get rid of TrueOS, then just export the data ZFS pool, then install your FreeBSD directly into the ZFS pool where your TrueOS was installed. Then you can directly import the data ZFS pool.
This would be quite straight forward and least error prone in my opinion. Just make sure to select the right partitions when installing and you'll save yourself the hassle of restoring the data from the copy.

You could use boot environments but why bother if you want to get rid of TrueOS anyway?

One advice - before deleting the TrueOS datasets completely, I would make a copy of your /boot, /etc, /usr/local/etc. Just in case you need to see how you had tuned your system with TrueOS. Quite handy indeed!



peterchris said:


> I'd like to get rid of TrueOS, start with base FreeBSD and configure from there. I've got two zpools which are replicated to another box on the network.  At this point I can:
> 
> 1.  Install FreeBSD from the USB stick, completely reformatting the drives, set up new zpools, and copy the datasets over from the remote box.
> 
> ...


----------



## mickey (Apr 15, 2019)

peterchris said:


> Cool.  I found a manual install thread here.


I installed multiple machines manually (single or dual boot) more or less following this guide which also shows how to set up things in a boot environment compatible way. Boot environments are more than just nice to have, and now that the base system includes bectl(8) and a boot loader that is also aware of boot environments, things got even better.


----------



## peterchris (Apr 17, 2019)

Here's how the bootfs and disk is configured.  Hoping to get some more feedback on how to 


> Boot FreeBSD from USB, choose Live CD option and install FreeBSD manually in a boot environment compatible way




```
Geom name: ada0 (447G)
Providers: 
  * ada0p1 (100M), type efi
  * ada0p2 (431G), type freedbsd-zfs
  * ada0p3 (16G), type freebsd-swap

Geom name: ada1 (447G)
Providers: 
  * ada1p1 (100M), type freebsd-boot
  * ada1p2 (431G), type freedbsd-zfs
  (that's it, no swap)
```

These two disks have a dataset called "tank" set up as a mirror.  This has "tank/ROOT" which is where the current boot environments reside.


```
# beadm list
BE                              Active Mountpoint  Space Created
initial                         -      -            2.2G 2017-08-26 09:29
12.0-CURRENT-201708261445       -      -          213.7M 2017-08-26 09:45
12.0-CURRENT-up-20180120_174915 -      -            3.3G 2018-01-20 17:48
12.0-CURRENT-up-20180303_132500 -      -          408.2M 2018-03-03 13:24
12.0-CURRENT-up-20180401_141855 -      -          695.8M 2018-04-01 14:17
12.0-CURRENT-up-20180914_164204 -      -          960.8M 2018-09-14 16:41
12.0-CURRENT-up-20190309_213623 NR     /           58.1G 2019-03-09 21:36
```

It appears I have `beadm` but not `bectl`.

I'm not sure how I would have to modify this instructions in this guide, which is creating some new partitions.


----------

