# EXTENDED partitions for FreeBSD-11



## max21 (Sep 28, 2016)

*Desktops or Servers:*
For those who wonder.

Imagine that you installed three FreeBSD on a hard-drive for duel-booting, and that you use the last primary as MBR extended format for a bunch of EXT4, DOS and NTFS partitions for data, .vdi files and backups.  FreeBSD-11 standard install of your choice on primary-1.  This will be your desktop running Mate, Virtualbox and vnet or whatever.  And the other two are minimum installs, or whatever on one slice each.

The nice thing about this is that FreeBSD now can have its own extended partitions for jails, data pools or whatever and whenever you update the system nothing touch your FreeBSD extended partitions, ever.  If you loss it, just reinstall it, then load the desktop with all your shortcuts and two tiny scripts placed in its proper place.

It works is something like this.  Mount FreeBSD extended partitions at boot.  Mount all slice except (a) which is root for each.  This is where you must not have used default install or else you was your slices:

rc.conf = fsck_y_enable="YES"
/etc/rc.d/mount-at-boot. Sh

```
# mount -t ufs /dev/ada0s2a /mnt/root2	# bsd-on 2
mount -t ufs /dev/ada0s2d /mnt/d
mount -t ufs /dev/ada0s2e /mnt/e
mount -t ufs /dev/ada0s2f /mnt/f
mount -t ufs /dev/ada0s2g /mnt/g
mount -t ufs /dev/ada0s2h /mnt/h
# .................................
# mount -t ufs /dev/ada0s3a /mnt/root3	# bsd-on 3
mount -t ufs /dev/ada0s3d /mnt/i
mount -t ufs /dev/ada0s3e /mnt/j
mount -t ufs /dev/ada0s3f /mnt/k
mount -t ufs /dev/ada0s3g /mnt/l
mount -t ufs /dev/ada0s3h /mnt/m
# .................................
echo "m2 mounted"
echo "m3 mounted"
sleep 1
# .................................	no more dhcp messages after startup.
# .................................
/usr/bin/pkill dhclient
echo "dhclient off"
echo "......"
echo "DONE!!!"
sleep 1
```
Create your autostart file to mount your MBR partitions if any.  Google Gnome autostart for more information.

```
[Desktop Entry]
Name=mount_LOGIC
GenericName=Mount Logic
Comment=Mount partitions at GNOME start
Exec=/root/Desktop/top/SCRIPTS/mount_LOGIC.sh
Termial=true
Type=Application
X-GNOME-Autostart-enable=true
```
Before FreeBSD-11, the problem is if your system ever crash, you will have to fsck all three PRIMARIES.  You cannot do it under primary-1.  You have to duel-boot to each one individually and fsck each primary.

Now for the GREATEST thing ever IMO… With FreeBSD-11 you never have to do all of that again.  Don’t wait for a crash, simply pull the power plug and see for yourself…  At startup time you will have total recovery of your Desktop and your FreeBSD extended partitions, as well as the standard MBR extended partitions!

In addition, it is easy to switch [duel-boot] to each primary from within without the need of ARCH or GRUB but it would make it easy to get the MBR for all three primaries.  Afterwards you can use it or not.  It cost you nothing in size.  I keep it for creating my MBR extended partitions and dd’ing in case of disaster.  cfdisk is cool.

```
sda5    swap	1024mb		
sda6    Arch	1024mb
```
Now put this on the desktop.  You will realize the benefits of writing one properly for at least the first two primaries.  This is the way it should be done.  If I were you, do not trust any other way. This is the flip version.  I have done this hundreds of times since 10.2.

*If rebooting to FreeBSD on partition 2*

```
#!/xxx/sh
sysctl kern.geom.debugflags=0x10
sleep 3

dd if=/root/MBR-ada0s2 of=/dev/ada0 bs=32256 count=1
sleep 3

sysctl kern.geom.debugflags=16
sleep 3
```
*If rebooting back to FreeBSD on partition 1*

```
#!/xxx/sh
sysctl kern.geom.debugflags=0x10
sleep 3

dd if=/root/MBR-ada0s1 of=/dev/ada0 bs=32256 count=1
sleep 3

sysctl kern.geom.debugflags=16
sleep 3
```
Calling slices extended is logical.  Each can be backed up just like MBR primary or logical partitions.  Get yourself another hard-drive, wipe it and dd your original to it for backup, or simply be careful as you create.  You will realize it is the icing on the cake.  There’s nothing you can’t do or test anymore!  Good Luck

Thank you FreeBSD developers.  Total Recovery … I never even thought this could ever happen for FreeBSD extended-slices.  If it’s a bug, I’ll _NEVER_ give it up.


----------

