Installing FreeBSD over existing installation

Is it possible to install FreeBSD without wiping the contents of an existing partition?

When running bsdinstall it formats the partition that FreeBSD is going to be installed on. This isn't what I want, I just want to rebuild an existing installation which has got screwed up.

Maybe I can do it manually just by extracting base.txz and kernel.txz...
 
Manually works. Please note that any customization (settings in configuration files etc.) most likely will be lost.
 
I was having the same trouble with my installation. The only option using the "out of box" installer is to use manual partition mode and be careful not to change anything on the partition you want to preserve. Easy to mess up that way. If you want to automate installation using the installer's built-in mechanism (installerconfig file), the partitioner operates in script mode where it insists on recreating all filesystems on the disk. In my case I wanted an automated installation, but also want to preserve a disk partition. Had to write my own install script for that, which turns out to be remarkably easy with free BSD.
 
Manually works. Please note that any customization (settings in configuration files etc.) most likely will be lost.

I'm guessing that any system customisation will only exist in /boot and /etc so if I rename those two directories, should I be OK?
 
I was having the same trouble with my installation. The only option using the "out of box" installer is to use manual partition mode and be careful not to change anything on the partition you want to preserve. Easy to mess up that way. If you want to automate installation using the installer's built-in mechanism (installerconfig file), the partitioner operates in script mode where it insists on recreating all filesystems on the disk. In my case I wanted an automated installation, but also want to preserve a disk partition. Had to write my own install script for that, which turns out to be remarkably easy with free BSD.

Any chance of sharing that install script ? :)

I wrote a fairly simplistic script containing just a few commands ie fetch & tar for base & kernel... not sure what needs to be added..
 
There's a thread here with step by step instructions on how to script the install from scratch, it's what I used; https://forums.freebsd.org/threads/63201/

I found the intsructions pretty straightforward, but if you have questions with it I can post my script. In my case I run newfs to erase only root partition and leave the rest intact. You could leave that out wholly if you want to preserve all partitions.
 
I already tried following that guide, but in my case I had a MBR partitioned disk with a couple of NTFS partitions and I wanted to install FreeBSD in the free space - around 150GB. I wasn't sure which partition types to create with gpart... gpart actually lists 6 different freebsd partition types so I'm still a bit confused. I'm stll not clear when to use a type of freebsd-boot. My understand is that I shoud create one of type freebsd and within that create freebsd-ufs and freebsd-swap but I'm not sure.

The other thing, given that I want to preserve the option of booting Windows, I'm not sure about installing the boot loader/manager...
 
You're getting into more complicated stuff with the partitioning. I can't provide much advice there. From my understanding (which could be way off) you'd have to use something like grub on the master boot record and and install the FreeBSD bootloader only on the partition. Should not be anything gpart can't handle in a script.

In my case I've always used a set of dedicated disks with a mobile rack on a desktop computer to run different operating systems. It makes things most simple. It's more convenient to use multi-boot or a hypervisor, but I avoid some headaches doing it the cassette way. SSDs make it more practical with the drives being physically like cassettes. Though I'm limited to a single disk root drive. I've never felt compelled to use RAID as a basic desktop user.
 
Understandably, partition types can get you confused, because it is not clear if you can use all partition types on all partition schemes. Hint: you can't! If you read gpart(8), it has a section on partition schemes which list MBR and GPT (which is the ones we're most interested in in this thread). Now, if you read the section on partition types, you will see that freebsd-boot, freebsd-swap, freebsd-ufs and freebsd-zfs can be used on GPT (also on APM and VTOC8 but that's not interesting for this discussion), but not on MBR. On the other hand, there is partition type freebsd which should not be used for GPT (or APM), but can be used for MBR.

The main problem with MBR is that it can only have four (4) primary partitions. One of these can be a logical partition (EBR), which can hold multiple partitions inside, but unfortunately there is no standard way to boot FreeBSD from a partition inside a logical partition, and from discussions here on the forums, it is very difficult to get it to work.

So, if your MBR disk has a at least one free primary partition, you can create a freebsd partition (this will hold all the slices the FreeBSD needs, including swap) and install FreeBSD on it. It is possible to boot FreeBSD from the Windows boot manager, but you should google for it.
 
Back
Top