# FreeBSD 9.1+ restore FreeBSD 9.0 + howtoboot?



## cpalui (Jan 3, 2013)

Hello.  Desperate!
At the beginning : FreeBSD 9.0 on my first disk; I dumped 9.0 and deleted it to reorganize my first disk.  After : I install 9.1 (ok), and I create  a slice to restore 9.0.  Now I can boot on 9.1, but how can i boot on 9.0 ???  I looked at the handbook, forums and man (sysinstall, boot0cfg, gpart, ...), but I don't find/understand anything!  Some help? Please?

To make second slice for the restore of 9.0 I made

```
/sbin/gpart add -i 2 -t freebsd -s 30G ada0
/sbin/gpart set -a active -i 2 ada0
/sbin/gpart create -s BSD -n 20 ada0s2

/sbin/gpart add -t freebsd-ufs -s 2G ada0s2	for /
/sbin/gpart add -t freebsd-ufs -s 2G ada0s2	for /var
/sbin/gpart add -t freebsd-ufs -s 23G ada0s2 for /usr
/sbin/gpart add -t freebsd-swap -s 2G ada0s2 for swap

newfs /dev/ada0s2a b d e
mount ...
```

Then a restore of ada0s2a.dump (/), ada0s2b.dump (/var), ada0s2b.dump (/usr).
The restore looks okay.


----------



## wblock@ (Jan 3, 2013)

You want to multi-boot FreeBSD 9.1 and FreeBSD 9.0?  There really is not much point.  Still, if you really, really want it, boot into FreeBSD and install the multi-boot loader:
`# boot0cfg -B ada0`

Note that the names of your dump files suggest you backed up swap rather than /var and /usr.  Those may just be typos.


----------



## J65nko (Jan 4, 2013)

If you do this as the OP did:


```
/sbin/gpart add -t freebsd-ufs -s 2G ada0s2	for /
/sbin/gpart add -t freebsd-ufs -s 2G ada0s2	for /var
/sbin/gpart add -t freebsd-ufs -s 23G ada0s2 for /usr
/sbin/gpart add -t freebsd-swap -s 2G ada0s2 for swap
```

Then you create the following labels:

label 'a' for "/"
label "b" for "/var"
label "d" for "/usr"
label "e" for "swap"

gpart will automatically increment the label from 'a' to 'b', even if you do not specify 'freebsd-swap' as the second partition type. It will only automagically skip the "c" label. 

If your second filesystem is not a swap partition you must use the "*-i*" parameter to specify the label:

```
a=1
b=2
c=3 (unused)
d=4
e=5
```

To retain the order of those gpart commands and still have label "b" for the swap partition the OP should have done:  


```
/sbin/gpart add -t freebsd-ufs -s 2G ada0s2 for / (label a)
/sbin/gpart add -t freebsd-ufs -s 2G -i [color=blue]4[/color] ada0s2  for /var (label d)
/sbin/gpart add -t freebsd-ufs -s 23G -i [color=blue]5[/color] ada0s2 /user (label e)
/sbin/gpart add -t freebsd-swap -s 2G ada0s2 -i [color=blue]2[/color] for swap (label b)
```


----------



## cpalui (Jan 4, 2013)

Hello and thanks for your help and happy new year.

I explain from the beginning:

```
asus# df -h (9.0)
Filesystem      Size    Used   Avail Capacity  Mounted on
/dev/ada0s2a      2G    797M    1.0G    43%    /
devfs           1.0k    1.0k      0B   100%    /dev
/dev/ada0s2b      2G    177M    1.7G    10%    /var
/dev/ada0s2d     22G    6.1G     14G    29%    /usr

mount -t ext2fs /dev/ada1s5 /mnt/linux

dump -0Lauf /mnt/tmp/datas/bsd/ada0s2a.dump /dev/ada0s2a
dump -0Lauf /mnt/tmp/datas/bsd/ada0s2b.dump /dev/ada0s2b
dump -0Lauf /mnt/tmp/datas/bsd/ada0s2d.dump /dev/ada0s2d
```

And after the restore...

First I did
`# boot0cfg -B ada0`
on 9.1, then I have F1 then I can boot on 9.1.
F2 that only writes # on the screen.
I think that the 2nd slice where 9.0 is not bootable, and do not know how to make it bootable, I think that the restore should do that (or no?) 

After I think that dump(8)/restore(8) is correct because after restore I can find everything in ada0s2a (/) ada0s2b (/var) and ada0s2d (/usr).

J65nko, I'm new in FreeBSD and maybe I don't understand what you explain; I did what I told and show what I have:

fstab on 9.1 where I mounted 9.0 restored partitions /mnt/...

```
/dev/ada0s1a   2031132  1024167   808165    51%    /
/dev/ada0s1b   2031132    16956  1851688     1%    /var
/dev/ada0s1d  32487548  1149512 28739036     4%    /usr
/dev/ada0s2a   2031132   800260  1068384    43%    /mnt/rootfs
/dev/ada0s2b   2031132   165200  1703444    10%    /mnt/var
/dev/ada0s2d  23352284  6316720 15167384    29%    /mnt/usr

# gpart show ada0s1 where is 9.1
=>        0  167772150  ada0s1  BSD  (80G)
          0    4194304       1  freebsd-ufs  (2.0G)
    4194304    4194304       2  freebsd-ufs  (2.0G)
    8388608   67108864       4  freebsd-ufs  (32G)
   75497472    8388608       5  freebsd-swap  (4.0G)
   83886080   83886070          - free -  (40G)

root@asus:/root # gpart show ada0s2 where is the restore of 9.0
=>       0  62914509  ada0s2  BSD  (30G)
         0   4194304       1  freebsd-ufs  (2.0G)
   4194304   4194304       2  freebsd-ufs  (2.0G)
   8388608  48234496       4  freebsd-ufs  (23G)
  56623104   4194304       5  freebsd-swap  (2.0G)
  60817408   2097101          - free -  (1G)
```

I may be wrong but it looks ok. No?  gpart(8) uses -i to add a new slice in ada0, not to add partitions.


----------



## wblock@ (Jan 4, 2013)

A boot block is not part of a filesystem, and dump(8)/restore(8) only deal with filesystems.  Probably you need to install bootcode on the new slice.
See the second half of Disk Setup On FreeBSD.

-i in gpart(8) is used to specify a partition number, and can refer to a slice or a partition.


----------



## cpalui (Jan 4, 2013)

wbloc@ : I LOVE YOU !!!
i saw Disk Setup On FreeBSD but didn'find the soluce; the only thing to do was : gpart bootcode -b /boot/boot ada0s1
i write from my poor lovely 9.0 and she's so happy and tells me to thank you a lot
bye
i"m not sure how to do : [CMD="SOLVED"][/CMD]


----------

