# FreeBSD multiple booting



## reivaj (Jan 17, 2013)

Hello,

I want to update my system (to 9 version) with the minor risk, for that I had to create a mirror slice to put there the original system, so in case of a possible fail during the update I should have the old system available.

I have 3 slices in the hard disc:

```
/dev/da0s1 -> DOS
/dev/da0s2 -> FreeBSD 8.0-RELEASE-p2
/dev/da0s3 -> Copy of FreeBSD system
```

These are the partitions in da0s2:

```
/dev/da0s2a            1.6G    708M    762M    48%    /      (this)
devfs                  1.0K    1.0K      0B   100%    /dev
/dev/da0s2f            195G    122G     57G    68%    /data
/dev/da0s2e            194G    168G     10G    94%    /home
/dev/da0s2h            1.4G     23M    1.3G     2%    /tmp
/dev/da0s2g             18G    7.3G    9.5G    43%    /usr   (this)
/dev/da0s2d             15G    2.7G     11G    20%    /var   (and this)
```

In this way the da0s3 slice contains the following backup copies (I did these with *cpdup*):

```
/dev/da0s3a            1.6G    708M    762M    48%    /raiz_   (backup copy of /)
/dev/da0s3b             15G    7.3G    6.0G    55%    /usr_    (backup copy of /usr)
/dev/da0s3d            8.7G    2.8G    5.2G    35%    /var_    (backup copy of /var)
```

What I want accomplish is that when selecting in the boot0 menu the da0s3 slice(F3) it can boot the backup copy of the system. But too that when selecting  da0s2(F2) can boot the original system:

```
F1 DOS
F2 FreeBSD  (this is my operating system,)
F3 (the copy that I want that be capable of boot too)

Default: F2
```

These are the gpart outs of each thing: 

-complete hard disc

```
$ gpart show da0
=>       63  976562055  da0  MBR  (466G)
         63     144522    1  !6  (71M)
     144585  922741470    2  freebsd  [active]  (440G)
  922886055   53673165    3  freebsd  (26G)
  976559220       2898       - free -  (1.4M)
```

-Slice with FreeBSD running (to update)

```
$ gpart show da0s2
=>        0  922741470  da0s2  BSD  (440G)
          0    3379200      1  freebsd-ufs  (1.6G)
    3379200    3072000      8  freebsd-ufs  (1.5G)
    6451200   39686144      7  freebsd-ufs  (19G)
   46137344    4194304      2  freebsd-swap  (2.0G)
   50331648   31457280      4  freebsd-ufs  (15G)
   81788928  419430400      5  freebsd-ufs  (200G)
  501219328  421522142      6  freebsd-ufs  (201G)
```
-Slice with the backup copies

```
$ gpart show da0s3
=>       0  53673165  da0s3  BSD  (26G)
         0   3379200      1  freebsd-ufs  (1.6G)
   3379200  31457280      2  freebsd-ufs  (15G)
  34836480  18836685      4  freebsd-ufs  (9.0G)
```

I did the copy but I don't sure how must proceed about the booting

I read in the handbook:


> "If you ever need to replace the installed boot1 and boot2 use bsdlabel(8):
> `# bsdlabel -B diskslice`


But I am worried that for do that, I could erase the other boot in da0s2 slice

Well this is the first time that I do something like this, and I want to be sure that I do the right things because I not want damage something

What I must do to accomplish with this?.

I appreciate much any help with this.  Thanks


----------



## SirDice (Jan 17, 2013)

There's no need to modify anything, the bootloader will automatically pick up the second FreeBSD install.


----------



## reivaj (Jan 17, 2013)

Ohh ok, Tkan you very much for your quick reply. 

Hey do you think that copy the system (/ /usr /var) with *cpdup* was a correct way to do it?

Thanks


----------



## wblock@ (Jan 17, 2013)

dump(8)/restore(8) are the preferred way to copy FreeBSD filesystems.  Other programs may not know the features of UFS filesystems.  Backup Options For FreeBSD shows examples of copying filesystems.


----------



## reivaj (Jan 17, 2013)

Thank you very much for the information. 

Only for curiosity, the command:
# bsdlabel -B da0s3

It must write the boot1 and boot2 in da0s3 but it (boot1, boot2) will continue in da0s2?

Thanks again


----------



## Beastie (Jan 18, 2013)

The bootstrap *boot* (/boot/boot1 + /boot/boot2) will be written at the beginning of *da0s3* and will run the rest of the boot chain within *da0s3*.

The four slices in the MBR are completely separate and do not overlap anywhere. Any bootable slice has its own boot chain.

*boot0* (or any other boot manager) reads the partition table in the MBR and loads the *boot1* of whatever slice you chose in *boot0* by pressing the function keys.


----------



## reivaj (Jan 23, 2013)

Then, this means that in this moment how the MBR is only in das0s2 (I did do not # bsdlabel -B da0s3), the boot0 is using that MBR (boot chain), even when I choose the F3 option that load the da0s3 slice (where is the copied system)?.

Thanks


----------

