# Samsung ATIV BOOK 2. Dual boot FreeBSD - Windows 8



## emmex (Dec 27, 2013)

In this post I will explain how I have set up an ATIV BOOK 2 model NP270E5E-K02IT  equipped with Windows 8, to dual-boot Windows and FreeBSD 10-STABLE. The disk is partitioned with UEFI and I have maintained the GPT partition scheme.

After the FreeBSD installation the dual boot process will be possible modifying the BIOS parameters: power on the laptop while pressing *F2*, in the BIOS menu *Boot* - *Secure Boot* select *Disabled*, if *OS Mode Selection* is *CSM OS* will starts FreeBSD otherwise if *UEFI OS* is selected, Windows will boots.

On my laptop I want to install sysutils/beadm, an utility to manage Boot Environments with ZFS. This permits me the switch between FreeBSD 11-CURRENT and 10-STABLE easily, but In this post I don’t speak about this. 

Before of all *make a full backup copy of your HDD*. You need a backup program that understand UEFI. If you don’t know what to use, try CloneZilla Live CD.

1. Shrink the Windows Partition.

You need some disk space for FreeBSD.  I have done this job in Windows with Disk Management, but there are dozens of other methods available. I have leaved 211 GiB for Windows and 230 GiB for FreeBSD, the space must be *Unallocated*. If you need a guide you can read How to Dual Boot Windows 8 with Windows 7, up to point 3) “Shrink the Windows 8 partition to create unallocated space for use when installing Windows 7”.
A note about *Windows 8 Fast Boot*, in the link above it will be disabled but you can leave it enabled or disabled as you like.

2. The FreeBSD 10-STABLE installation.

The laptop Wi-Fi chipset needs a recent FreeBSD 10 for working, I have used this ISO image:  FreeBSD-10.0-BETA4-amd64-disc1.iso downloaded from ftp://ftp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/10.0/ or you can download an usually more recent amd64 RELENG_10 image from https://pub.allbsd.org/FreeBSD-snapshots.

For using beadm is not possible to use the FreeBSD installer, the installation is done by typing a lots of commands at console. For more info look at the original post about beadm: Thread 31662. I have modified the procedure for *Server with One Disk*.

Insert the FreeBSD CD in the DVD tray and power off the PC.  Power on the laptop with *F10* pressed to select the CD as boot device. 


```
1. Boot from the FreeBSD CD
2. Select ‘Live CD’ option
3. login: root
4. # sh
Select your keyboard layout, this is not necessary with US keyboard.
5. # kbdmap
6. # gpart add -t freebsd-boot -l bootcode0 -s 128k -i 10 ada0
7. # gpart add -t freebsd-zfs -l sys0 -i 11 ada0
8. # gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 10 ada0
9. # zpool create -f -o cachefile=/tmp/zpool.cache sys /dev/gpt/sys0
Ignore the warning: “Cannot mount ‘sys’: no such file or directory”
10. # zfs set mountpoint=none sys
11. # zfs set checksum=fletcher4 sys
12. # zfs set atime=off sys
Optional: enable compression.
13 # zfs set compression=lz4 sys
14. # zfs create sys/ROOT
15. # zfs create -o mountpoint=/mnt sys/ROOT/default
16. # zpool set bootfs=sys/ROOT/default sys
17. # cd /usr/freebsd-dist/
18. # for I in base.txz kernel.txz src.txz; do
> tar --unlink -xvpJf ${I} -C /mnt
> done
19. # cp /tmp/zpool.cache /mnt/boot/zfs/
20. # cat << EOF >> /mnt/boot/loader.conf
> zfs_load=YES
> vfs.root.mountfrom="zfs:sys/ROOT/default"
> EOF
21. # cat << EOF >> /mnt/etc/rc.conf
> zfs_enable=YES
> EOF
22. # :> /mnt/etc/fstab
23. # zfs umount -a
24. # zfs set mountpoint=legacy sys/ROOT/default
25. # reboot
```

A note about compression. I always enable compression on my ZFS pools, in this moment this give me a free 33% of disk space on my laptop.

3. Basic Setup after Install
Follow the “4. Basic setup after install” in the original beadm post Thread 31662 ignoring the part about the _Road Warrior Laptop_.

4. Network
You need the internet connection for installing beadm. The FreeBSD documentation is 30.3 Wireless Networking.

My *Wireless Security Option* is *WPA-PSK (TPIK)* and my SSID name is *Router Netgear* and suppose that  the passfrase is *my_password*.

In /boot/loader.conf I added

```
# Wi-Fi
if_ath_load="YES"
wlan_wep_load="YES"
wlan_ccmp_load="YES"
wlan_tkip_load="YES"
```

In /etc/rc.conf

```
# LAN & Wi-Fi
ifconfig_re0="DHCP"
wlans_ath0="wlan0"
ifconfig_wlan0="WPA DHCP"
```

I have created the file /etc/wpa_supplicant.conf

```
network={
    ssid="Router Netgear"
    psk="my_password"
}
```

Reboot or issue the command `# service netif start` and you should have the internet connection.  

5. Enable the Boot Environments
Install the beadm utility from the FreeBSD packages collections with the command
`# pkg install beadm`

If all is correct the `beadm list` should give an output similar to:

```
# beadm list
BE              Active Mountpoint  Space Created
default         NR      /          722.2M 2013-12-05 12:38
```

6. Create New Boot Environmnent Before Upgrade 
Follow the “6.1. Create New Boot Environmnent Before Upgrade” in the original post Thread 31662

Now the `beadm list` command should give:

```
# beadm list
BE              Active Mountpoint  Space Created
default         -      -          212.2K  2013-12-05 12:38
upgrade         NR      /          722.3M 2013-12-05 13:51
```

"You are now free to do anything You like for the upgrade process, but even if You break everything, You still have a working *default* working environment."
As @vermaden says. Thank You.


----------

