# Install freebsd over linux



## MrJake (Oct 8, 2009)

I have recently inherited of a Dell 860 which does not have a crdom or refuses to boot from usb which is also running debian.

I want to install freebsd to learn freebsd on this server to eventually switch from linux completely. Now once upon a time I did a remote install of linux by disabling the swap and using it as a partition to install a minimal install of linux to then boot on that dist to then reinstall linux in the real partition and then reboot on that, format the swap and do a swapon.

now i was wondering is that something that can be done for freebsd? and If yes I cant find a howto 

So i would really love to be able to convert this poor server to freebsd to then convert myself which is so green with freebsd which looks so lovely and rock solid.

Thanks in adavance for whoever can help me with this pickle.

Oh ya here are some stats on the server and its current partitions. also i do have a KVM ip switch connected to the server. My problem like i said is to no be able to boot from anything but the hard drive:

CPU inter xeon dual core 3ghz
Ram 256mb (ya i know ouch ill upgrade that surely soon)
HD 80GB
/ = 73GB
swap = 1 GB


----------



## aragon (Oct 8, 2009)

It is possible, but tricky.

First off, are you able to create bsdlabels and file systems under linux?

Second, what boot manager are you currently using?


----------



## MrJake (Oct 8, 2009)

first what are bsd labels  and yes i can create file systems
second im using grub

Thanks


----------



## aragon (Oct 8, 2009)

Ok, grub should make things a bit easier.

BSD labels are a storage structure that group UFS file systems together.  Of particular value here is the boot loader in the first 512 bytes of the BSD label, something which is crucial to a bootable FreeBSD system.  I know linux is able to read BSD labels, but I suspect it lacks the tools to create them.

I think you should try and download the 8.0-RC1 memstick image.  It is just under 1 GB in size.  Disable swap and use linux's fdisk to set the swap partition type to 165 (0xA5).  Then dd the memstick image to that partition, and add an option to grub to chain load that partition.  Reboot and choose the boot option you created.  Hopefully the FreeBSD installer should start.


----------



## aragon (Oct 8, 2009)

If it works, don't go ahead and wipe out your linux install just yet.  You said the drive was 80 GB and only 74 GB allocated?  Rather install to a new partition first to make sure all works before overwriting your linux partition.


----------



## MrJake (Oct 8, 2009)

Thats sounds straight forward enough. Now can I sue the boot-only image or I need the memstick absolutely. Because this server is sitting behind a firewall so with operational networking I could get the rest of the packages i need to make it the server i want. 

Another thing is the swap itself. Freebsd must surely use a swap file like any other OS right? How do I regain that partition. Do i convert it aswell once done to a A5 partition type?

Thanks


----------



## phoenix (Oct 8, 2009)

Do a google search for "depenguinator".  That's a handy, automated method for replacing a Linux install with a FreeBSD install.


----------



## aragon (Oct 8, 2009)

MrJake said:
			
		

> Now can I sue the boot-only image or I need the memstick absolutely.


The other images are written with an optical disc boot loader, so don't think they'll work.



			
				MrJake said:
			
		

> Another thing is the swap itself. Freebsd must surely use a swap file like any other OS right? How do I regain that partition. Do i convert it aswell once done to a A5 partition type?


You could reuse the same partition as swap, and it can be any partition type I think.  Usually though, swap is a partition within the BSD label that you create during install.


----------



## MrJake (Oct 9, 2009)

ya i learned the hard way that you dont extract a iso to a ufs filesystem but instead to a type 96. anyways I bricked the install when I fubared grub. For some reason if you put an invalid root path in the first element in menu.1st then grub will act wierd. My KB isnt even responding in the grub menu. I tried to type c to get to console to then manually boot into my old linux to fix my poopoo.

Anyways tomorrow I will setup a PXE server on another server on the same lan and then attempt to install Freebsd from pxe instead just to make it more spicy. I believe after this I wont be a freebsd virgin as much as I am today hehe. But im loving the challenge. found this beautiful howto http://tomclegg.net/pxe
Pretty clear and simple. this will permit me to run freebsd from the network to then do whatever I want with this servers hard drive to then permanantly install it on the machine to then not have to depend on my network boot.

Gonna be fun fun 

Thanks anyways for the help. My advice is never attempt to install freebsd in your swap when its very late at night and your out of coffee.


----------



## dennylin93 (Oct 9, 2009)

How about temporarily plugging in an optical drive? It might work.


----------



## MrJake (Oct 9, 2009)

problem in that dell 860 is I have a IDE slot and even a cabel that goes to the empty slot but no power. The only available power is a 4pin floopy, or a sata power.

but PXE is gonan be fun. Im setting it up in one of my esx server sitting on the same lan. So I will only start the PXE when I need to install a distro in vmware or on a server. I guess a pxe server will serve usefull and at the same time very educational. Optical would make it to easy anyways 

But thanks for the suggestion


----------



## MrJake (Oct 9, 2009)

alrighty server is back to almost square one hehe. Unfortunately I was not able to install freebsd with PXE (i suck) but was able to reinstall debian with pxe since that was more comfortable for me. So now my main partition is 77gb my swap is 2.7gb. I did a swapoff -a and also disabled swap from fstab.

now what I would like to accomplish is to install in the swap partition the memstick version of freebsd example then setup grub to boot from it. then from that version i can attempt to reinstall freebsd but in my main partition to then reboot on that one to then format my swap partition to use with freebsd.
How is my question. I did dig a bit and found alot of ways to actually do it from a usb stick but no how to do it from HD. So i want to install freebsd from hard drive booting from grub 

If it fails it doesnt matter since my pxe install of debian is only 1ms away 

Thanks for the help in advance


----------



## sossego (Oct 9, 2009)

Is the swap a primary or extended partition?
2.7 gigs is going to be bare bones.


----------



## MrJake (Oct 9, 2009)

its ext and the point is to use that partition to install something to boot on to install freebsd on main partition. See this server has no optical drives and does not boot on usb.

it can bootp or PXE. but I dunno how to install freebsd with bootp or PXE and didnt find a good howto do it from a linux distro.

So my only other option is to install from HD and its currently partitioned 77gb / then ext with a swap of 2.7gb


----------



## sossego (Oct 9, 2009)

How's the setup? A main and an extended or the system has a few extended for /home /tmp /var?
If everything is on a main partition save swap, then use an external tool such as knoppix or gparted to resize the Debian install. You can then remove the extended and create a few primary partitions. Fstab can be edited to mount a new partition number and the swapon can initiate that.
You're going to need 4gigs to make a decent installation with desktop and whatnot.
I'd say make a 4g slice. mark it bootable.
Let grub stay with Debian- don't edit master boot record- and add the freebsd entry after reboot.
Make the partitions such as: everything in one section / and 256 to 512m swap. Fixed partition sizes in a limited space can cause trouble.


----------



## MrJake (Oct 9, 2009)

im just trying to make the swap partition the equivilant of a CD so i can copy a ISO content to it them point grub to boot from sad5 instead of sda1 so that then i can install freebsd in sda1 to then reformat sda5 to be a freebsd swap

is that possible?


----------



## sossego (Oct 10, 2009)

I'm not trying to pass a product here but only to ,facilitate the process. Are you keeping or removing Debian?

You can use unetbootin- make it simple if you are having trouble- and use the programs. You can download the image and boot from it- which is what you want, it seems. 

Do that and start installing.


----------



## aragon (Oct 10, 2009)

Since you can fall back to another PXE debian install if the FreeBSD install fails, this shouldn't be too difficult or risky.  Never tried this, but installing from a hard drive should be pretty much the same as installing from a memstick.

Anyhow, I'm guessing your partition layout is still the same - 1 big primary partition as your debian root, and one extended partition for your swap.

Use fdisk and change the extended partition to a FreeBSD one as indicated earlier, then dd the memstick image to it.

Next step is grub which I can't help with unfortunately.  I'm too indoctrinated with the elegant simplicity of the FreeBSD boot manager.


----------



## gcampton (Oct 10, 2009)

add a simple entry same as windows,


```
title FreeBSD
boot  /dev/sda3 
chainloader+1
```

that's pretty much it i think sorry if I'm wrong I'm going off memory.
I definitely know you don't need the kernel path, just a simple chainloader+1


----------



## sossego (Oct 10, 2009)

It's 

```
title FreeBSD
root (hd0,x)
chainloader +1
```


You can add the kernel path if you want.

The drive will be seen as /dev/ad4sx or similar to it in a  FBSD install.


----------



## MrJake (Oct 10, 2009)

k i am dl 8.0 memstick as we speak then will dd it to the a5 FS i converted my swap too then ill setup grub and see how she goes.

brb


----------



## MrJake (Oct 10, 2009)

alrighty this is how i copied the iso to the freebsd partition. nothing to fancy

[cmd=]dd if=8.0-RC1-i386-memstick.img of=/dev/sda2[/cmd]

setup grub and reooted and now im running freesd install 
so far so good


----------



## MrJake (Oct 10, 2009)

i think this will work hehe its installing from ftp atm. my other question is once im rebooted and running freebsd in my main partition, how do i reclaim my other 2.7gb partition to become a swap

Thanks


----------



## aragon (Oct 10, 2009)

MrJake said:
			
		

> my other question is once im rebooted and running freebsd in my main partition, how do i reclaim my other 2.7gb partition to become a swap


In your fstab, just specify that device for swap, and also see swapon(8).


----------



## MrJake (Oct 10, 2009)

pretty much like linux right? anyways im quite lost in the but the important thing is its installed and debian is gone hehe. Now I only feel I dropped back in time because I already miss apt-get or aptitude.

So to install stuff you do it like old school where you get the src code then 

```
./configure
make
make install
```

there is no packag manage but only packages u can add and remove with pkg_add right?
would there happen to be a gui made with curse or anything close from that or I have to stop being lazy hehe


----------



## MrJake (Oct 10, 2009)

gotta love this freebsd handbook. I see i can install and remove shit using sysinstall which is exactly what I need.

Thanks again for all your help guys. without you I would have had to get out a shovel and dig so much more.

Thanks many times


----------



## aragon (Oct 11, 2009)

Take a look at ports too.  It's in the handbook.

Well done with your unorthodox and successful install!


----------



## MrJake (Oct 11, 2009)

lol yes it was fun. Ya im quickly noticing that sysinstall is not the best way to go. Im having much more success in /usr/ports
make
make config
make install
But I also noticed that freebsd is not as lazy as debian and ubuntu. Like if you install via ports apache or mysql it wont even start the server for you lol
You need to setup rc.conf then launch it manually. Its not a bad thing since it forces me to check it over once more to be sure everything is up to par. But up to now Im really liking freebsd. These guys have travelled light years since 3.51 hehe

next im gonna make my kernel slimmer and see how much ram i can save it


----------



## Damien (Oct 11, 2009)

Hi

I've got quite the same problem as you, but I can't make it work...

In fact I don't know how to convert my free partition into a FreeBSD one, using Debian.

Can you help me, thx.


----------



## MrJake (Oct 11, 2009)

ok do this:
first u have to know what drive your partition is on. example /dev/hda or /dev/sda etc..
then call it with fdisk
[cmd=]fdisk /dev/sda[/cmd]

then the partition u want to convert chose p to list the partition and if its partition 5 xample the type t
then it will ask for partition number enter 5
then it will ask to chose a partition type enter a5
then if that partition was on same drive as your debian partition it wont be able to write the changes right away. to write changes just chose w i think it is. then reboot if needed.

once back download the iso of 8.0-RC1 memstick and dd it to new partition. example if your partition was /dev/sda5 you will type
[cmd=]dd if=/home/joeblow/8.0-RC1-i386-memstick.img of=/dev/sda5[/cmd]

that will it a nutshell make your freebsd partition the same as the content of that iso. then u need to configure grub to boot on that.

So what you do is enter this in your grub config
ass this to /boot/grub/menu.1st

```
title FreeBSD
root (hd0,4)
chainloader +1
```

this is always assuming your partition was sda5
remember in linux partition are counted from 1 but grub will count from 0
so /dev/sda3 = hd0,2
/dev/sdc6 = hd2,5
and so on.
Then reboot and you should chose freebsd from grub menu and if all went well you should be soon in the freebsd installer.

Keep us posted


----------



## Damien (Oct 13, 2009)

Well I'm afraid it didn't work...

In fact I want to install pfsense and I only have the iso of a livecd, and I can't boot on it...

If you know how I can do it I'm open to all solution available, so far, nothing worked...

thx


----------



## MrJake (Oct 13, 2009)

so you have an optical drive in that machine then. so you just need to boot on the freebsd cd1 and install from there


----------



## danger@ (Oct 13, 2009)

Here is a complete working howto that I wrote a while ago:
http://www.freebsd.org/doc/en/articles/remote-install/


----------



## tankist02 (Oct 13, 2009)

http://www.daemonology.net/blog/2008-01-29-depenguinator-2.0.html


----------



## danger@ (Oct 14, 2009)

as far as I know, depuinginator doesn't work with recent versions of FreeBSD and mfsBSD which is used in my howto has more features...


----------



## Damien (Oct 29, 2009)

Hi,

I'm sorry but it didn't worked...
The problem is that I want to install pfsense, a derivate from freebsd. The boot process is a litlle different and so both the solutions you told were inoperant. They can't build a botable image, I think it's because the files needed to boot are different from freeBSD, and I can't figure out what they are...

The only way to install this distrib is via the livecd but my cdrom drive is dead, and I can't replace it.

I'll try to install it via a virtual machine but I doesn't like the idea...

If you have any clue...

Thanks


----------



## astadtler (Oct 30, 2009)

ports > dpkg crap


----------

