|
Guides All Guides and HOWTO's. |
|
Thread Tools | Display Modes |
|
|||
Makefile for Vermaden's FreeBSD ZFS root install adapted for 4K sector disks
Introduction
What does the Makefile do? The comments at the beginning of the file gives an explanation: Code:
# This BSD makefile merely automates Vermaden's "'ZFS madness / boot # environments" mirrored disk setup. # # For a complete description of this particular ZFS only setup see below. # # The ZFS configuration described by Vermaden does not align the # disk partitions for 'Avanced Format' 4K disks and also does not # instruct ZFS to use 4K blocks for the write and read operations. # # The procedure implemented here does align the EFI/gpt partitions # used on a 4K (8 x 512) # sector boundary. By using the 'gnop' trick # the FreeBSD ZFS implementation is coached to use an 'ashift' value # of 12 (2^12 = 4096) # This value makes ZFS read and write on 4K boundaries # # Credits for the ZFS install procedure: # # Slawomir Wojciech Wojtczak (vermaden) # http://forums.freebsd.org/showthread.php?t=31662 # http://www.daemonforums.org/showthread.php?t=7099 # # Sources and /credits for the 4K alignment issue and gnop hack: # # Warren Block (wblock@) for his numerous posts about partition alignment: # http://forums.freebsd.org (Installation and Storage sections) # http://www.wonkity.com/~wblock/docs/...w_standard_gpt # Ivan Voras for the gnop workaround: # http://ivoras.sharanet.org/blog/tree...or-drives.html # George Kontostanos (gkontos) for using gnop and a ZFS cache file: # http://forums.freebsd.org/showthread.php?t=23544 # http://www.aisecure.net/2012/01/16/rootzfs/
Overview of the Makefile targets The utility ones:
The pre-installation tasks can be performed individually or by using the pre_install target:
The actual installation:
The post-installation tasks done by target post_install:
For the really lazy ones among us there is a target 'all' that does it all: Code:
pre_install: trailer partition gnop4k pool4k export gnop_destroy import \ chk_ashift zfs_options zfs_fs zfs_swap install: trailer for THIS in ${INSTALL_SETS} ; do \ tar --unlink -xvpJf $${THIS} -C ${MOUNT} ;\ done ls -l ${MOUNT} zpool status ${POOL} zpool iostat ${POOL} zfs list post_install: trailer loader.conf fstab rc.conf zfs_boot zfs_umount mountpoint all: trailer pre_install install post_install By changing the makefile variables you can adapt the installation to your wishes. Code:
POOL = super ROOT_SET = ${POOL}/ROOT BOOT_SET = ${ROOT_SET}/default # --- installation file sets SETS = base.txz kernel.txz DIR = /usr/freebsd-dist # On FreeBSD liveCD/DVD/memstick .for X in ${SETS} INSTALL_SETS += ${DIR}/${X} .endfor Code:
DISKTYPE = ada DISKTYPE = md .if ${DISKTYPE} == "md" # --- memory disks see md(4) and mdconfig(8) # size of disk needs to be at least 64M else you encounter this error: # "cannot create 'pool': one or more devices is less than the minimum size (64M)" MD_SIZE = 2g SWAPSIZE = 256m DISK_1 = /dev/md1 DISK_2 = /dev/md2 DISKS = ${DISK_1} ${DISK_2} # --- gpt/EFI labels LABEL_ZFS = mdisk_ LABEL_BOOT = mdboot Code:
.else # --- real spinning rust disks DISK_1 = /dev/ada1 DISK_2 = /dev/ada2 DISKS = ${DISK_1} ${DISK_2} SWAPSIZE = 4G # --- gpt/EFI labels LABEL_ZFS = SYSTEM_ LABEL_BOOT = BOOT_ .endif Code:
TMP = /tmp CACHEFILE = ${TMP}/zpool.cache TEMPLATE_RC_CONF= ${TMP}/template_rc.conf MOUNT = /mnt RC_CONF = ${MOUNT}/etc/rc.conf LOADER_CONF = ${MOUNT}/boot/loader.conf FSTAB = ${MOUNT}/etc/fstab Code:
Code:
Checking for installation sets ... Set /usr/freebsd-dist/base.txz : found! Set /usr/freebsd-dist/kernel.txz : found! Code:
Checking for 'rc.conf' template ... /tmp/template_rc.conf not found exit 100 *** [show] Error code 100 Code:
----------- rc.conf template ---------- cat /tmp/template_rc.conf # ------ rc.conf #defaultrouter=192.168.222.10 hostname='althusser.utp.xnet' network_interfaces='bge0' ifconfig_bge0="SYNCDHCP" # --- daemons inetd_enable=NO sshd_enable=yes sendmail_enable=yes # --- time synchronization ntpd_enable=YES #openntpd_enable=YES
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump Last edited by J65nko; 8th August 2013 at 09:01 PM. |
Tags |
4k disk, 4k sector alignment, advanced format disks, freebsd, make, makefile, zfs, zfs madness, zfs root |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to remove boot sector viruses? | CyberJet | OpenBSD General | 8 | 15th July 2011 07:50 PM |
HOWTO: Modern FreeBSD Install (vermaden way) | vermaden | Guides | 10 | 11th July 2011 07:05 AM |
${REINPLACE_CMD} on Makefile | indiocolifa | FreeBSD Ports and Packages | 3 | 26th March 2009 11:16 PM |
Makefile Problem | BadWolf | Programming | 4 | 15th March 2009 01:58 PM |
ports config and makefile scripting | boincv | FreeBSD Ports and Packages | 6 | 1st October 2008 07:57 AM |