# Procedure for manual installation



## balanga (Jan 28, 2018)

I tried install FreeBSD 11.1-RELEASE amd64 on some free space rescued from Windows yesterday but `bsdinstall` would not allow me to continue. I can't remember the specifics but was some problem related to using an MBR partitioning scheme which FreeBSD (bsdinstall) did not like, so I'd like to install it manually, but not sure how many partitions and what type I need to create...

Does anyone have a guide for installing 11.1 amd64 on mbr not using the entire disk? 

There is currently 170GB free space and two NTFS partitions.


----------



## ShelLuser (Jan 28, 2018)

Try this guide. Although this one deals with GPT and ZFS the installation procedure itself can easily be applied on other environments, especially if you don't plan on setting up an entire 'partition scheme' but only plan to use one partition. However: be sure to setup swap space as well.


----------



## balanga (Jan 28, 2018)

It looks like a useful guide, but I'm uncertain about which partitions types to select...gpart() has six types for FreeBSD, and I'm confused between freebsd and  freebsd-ufs, and don't really know if I need a freebsd-boot...[/MAN]


----------



## ShelLuser (Jan 28, 2018)

Good question. I'd have to experiment to be sure because it has been ages since I messed with MBR schemes. I do recall that it basically created one physical partition ("slice") in which several virtual partitions were being used.

Purely basing myself on gpart(8) I believe you need to use the freebsd type partition which will also serve as the boot partition, as long as it has been marked active:



> A BSD disklabel is usually created inside an MBR partition (slice) with
> type freebsd (see the PARTITION TYPES section).  It uses 8 KB size
> bootstrap code image /boot/boot, embedded into the partition table's
> metadata area.


The only thing which eludes me at this time is how you'd setup the virtual partitions (probably not even the right name for them). I'll see if I can fire up a virtuabox later today to see how this should work. Maybe I can even expand on my current guide for MBR schemes.


----------



## balanga (Jan 28, 2018)

Maybe this is what I'm looking for....


----------



## balanga (Jan 28, 2018)

Also... looking at http://www.wonkity.com/~wblock/docs/html/disksetup.html


```
# gpart add -t freebsd da0
# gpart set -a active -i 1 da0
# gpart create -s bsd da0s1
# gpart bootcode -b /boot/boot da0s1
```

I get an error msg saying geom 'da0s1':  File exists


----------



## ShelLuser (Jan 28, 2018)

Good old wblock@ to the rescue   Yes, that is a _very_ good source of information.

Be sure to run `# gpart list da0` to see what is on there. Without that all you can do is guess.


----------



## balanga (Jan 28, 2018)

The trouble is that it doesn't work as described...


> Create an MBR partition. FreeBSD calls these "slices". Set it active so the system will boot from it.
> 
> # gpart add -t freebsd da0
> # gpart set -a active -i 1 da0
> ...



This is what I get:-

```
root@Test:~ # gpart show da1
=>       63  488397105  da1  MBR  (233G)
         63       1985       - free -  (993K)
       2048     204800    1  ntfs  [active]  (100M)
     206848  129787904    2  ntfs  (62G)
  129994752  358402416       - free -  (171G)

root@Test:~ # gpart add -t freebsd da1
da1s3 added
root@Test:~ # gpart create -s bsd da1s3
gpart: geom 'da1s3': File exists
```

I am unable to partition the FreeBSD slice, and can't see what I'm doing wrong.


----------



## linux->bsd (Jan 29, 2018)

Execute `gpart show -p da1` again and show us the new layout. Then `gpart show -p da1s3` to see what exists inside the FreeBSD slice.

Try deleting the FreeBSD slice and starting it over again: `gpart delete -i 3 da1`.


----------



## balanga (Jan 29, 2018)

I've done this many times but always with the same result.


```
root@Test:~ # gpart show -p da1
=>       63  488397105    da1  MBR  (233G)
         63       1985         - free -  (993K)
       2048     204800  da1s1  ntfs  [active]  (100M)
     206848  129787904  da1s2  ntfs  (62G)
  129994752  358402408  da1s3  freebsd  (171G)
  488397160          8         - free -  (4.0K)

root@Test:~ # gpart show -p da1s3
=>        0  358402408  da1s3  BSD  (171G)
          0  358402408         - free -  (171G)

root@Test:~ # gpart delete -i 3 da1
da1s3 deleted
root@Test:~ # gpart add -t freebsd da1
da1s3 added
root@Test:~ # gpart show -p da1
=>       63  488397105    da1  MBR  (233G)
         63       1985         - free -  (993K)
       2048     204800  da1s1  ntfs  [active]  (100M)
     206848  129787904  da1s2  ntfs  (62G)
  129994752  358402408  da1s3  freebsd  (171G)
  488397160          8         - free -  (4.0K)

root@Test:~ # gpart show -p da1s3
=>        0  358402408  da1s3  BSD  (171G)
          0  358402408         - free -  (171G)

root@Test:~ # gpart create -s bsd da1s3
gpart: geom 'da1s3': File exists
root@Test:~ # gpart show -p da1s3
=>        0  358402408  da1s3  BSD  (171G)
          0  358402408         - free -  (171G)
```


----------



## swegen (Jan 29, 2018)

You'll have to clear the residue of the previously existed slice with
`gpart destroy -F da1s3`

Then you can create the new slice with
`gpart create -s BSD da1s3`

After that you can start adding partitions to the BSD slice with (for example)
`gpart add -t freebsd-ufs -s 100G da1s3`


----------



## balanga (Jan 29, 2018)

swegen - many thanks for the explanation, I now have:-

```
root@Test:~ # gpart show -p da1s3
=>        0  358402408   da1s3  BSD  (171G)
          0  350224384  da1s3a  freebsd-ufs  (167G)
  350224384    8178016  da1s3b  freebsd-swap  (3.9G)
  358402400          8          - free -  (4.0K)
```


----------



## balanga (Jan 30, 2018)

As I understand it, a manual install can be done with just a few steps once the system has booted up to a command prompt.

1. Create space on the disk.

2. Retrieve and extract two files (base.tgz and kernel.tgz) from freebsd.org

3. Install bootloader 

Is there anything else which is essential? Locale settings, passwords, users etc can be set after booting, so I don't think they are essential.


----------



## swegen (Jan 30, 2018)

The base system and kernel can be extracted directly from network to current working directory with
`fetch -o - ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/11.1-RELEASE/base.txz | tar xSf -
fetch -o - ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/11.1-RELEASE/kernel.txz | tar xSf -`

After installing bootloader the only essential file that must be configured is /etc/fstab to tell kernel the root partition and to set up swap etc. For example:

```
#dev         mnt   type  options     dump  pass
/dev/da1s3a  /     ufs   rw,noatime  0     1
/dev/da1s3b  none  swap  sw          0     0
```


----------



## balanga (Jan 30, 2018)

I want to PXE boot mfsBSD and perform a manual, or rather a personally scripted installation, so have most of the elements, but am not sure about how to manually install the bootloader...

Also, in an ideal world, I could have my script on the network, but mfsBSD does not include any means of mounting a remote filesystem, that I am aware of...
but I guess I could put something on my web server and use `fetch`.


----------



## balanga (Jan 30, 2018)

Just thought I'd mention that after creating the partitions I wanted, I PXE booted mfsBSD and ran `bsdinstall`, but decided to cancell the installation, however an extra partition appeared on my disk:-
	
	



```
[root@S06] ~# gpart show -p da0
=>       63  488397105    da0  MBR  (233G)
         63          1         - free -  (512B)
         64       1984  da0s4  freebsd  [active]  (992K)
       2048     204800  da0s1  ntfs  (100M)
     206848  129787904  da0s2  ntfs  (62G)
  129994752  358402408  da0s3  freebsd  (171G)
  488397160          8         - free -  (4.0K)
```

Can I just delete it using `gpart delete -i 4 da0`? - Seems I can because I just tried.
Does FreeBSD require this partition?


----------

