diff options
author | Sven Gothel <[email protected]> | 2021-07-19 07:43:26 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-07-19 07:43:26 +0200 |
commit | f854cd2a1d173e9e08b54b105e901be934161f8d (patch) | |
tree | 4f2f5d596d881fd272560544206eb31395286c7b /stage_rescuezfs | |
parent | e89e19c0b6a6b3d687aabf1ec5ee289d6e25941d (diff) |
Adding Debian ZFS Bootstrap <stage_rescuezfs/00-install-zfs/files/zfs/bootstrap>: Setup new machine from this rescuezfs
Tested via qemu and 3 virtual sata-disks, booted from the rescurezfs image.
Diffstat (limited to 'stage_rescuezfs')
29 files changed, 902 insertions, 0 deletions
diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/LICENSE.txt b/stage_rescuezfs/00-install-zfs/files/zfs/LICENSE.txt new file mode 100644 index 0000000..aa16892 --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/LICENSE.txt @@ -0,0 +1,70 @@ +Debian ZFS Bootstrap is licensed under the 'New BSD 2-Clause License': + +Location: <stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/> + +/** + * Copyright 2019 Gothel Software e.K. All rights reserved. + * Copyright 2021 Gothel Software e.K. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY Gothel Software e.K. ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Gothel Software e.K. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of Gothel Software e.K. + */ + ++++ + +ZFS On Linux parts: 'zfs-linux-x.y.z-*' + +The majority of the code in the ZFS on Linux port comes from OpenSolaris +which has been released under the terms of the CDDL open source license. +This includes the core ZFS code, libavl, libnvpair, libefi, libunicode, +and libutil. The original OpenSolaris source can be downloaded from: + +http://dlc.sun.com/osol/on/downloads/b121/on-src.tar.bz2 + +Files which do not originate from OpenSolaris are noted in the file header +and attributed properly. These exceptions include, but are not limited +to, the vdev_disk.c and zvol.c implementation which are licensed under +the CDDL. + +The zpios test code is originally derived from the Lustre pios test code +which is licensed under the GPLv2. As such the heavily modified zpios +kernel test code also remains licensed under the GPLv2. + +The latest stable and development versions of this port can be downloaded +from the official ZFS on Linux site located at: + +http://zfsonlinux.org/ + +This ZFS on Linux port was produced at the Lawrence Livermore National +Laboratory (LLNL) under Contract No. DE-AC52-07NA27344 (Contract 44) +between the U.S. Department of Energy (DOE) and Lawrence Livermore +National Security, LLC (LLNS) for the operation of LLNL. It has been +approved for release under LLNL-CODE-403049. + +Unless otherwise noted, all files in this distribution are released +under the Common Development and Distribution License (CDDL). +Exceptions are noted within the associated source files. See the file +OPENSOLARIS.LICENSE for more information. + +Refer to the git commit log for authoritative copyright attribution. diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/acl-setup.sh b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/acl-setup.sh new file mode 100644 index 0000000..9abc25f --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/acl-setup.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +#zfs set aclinherit=passthrough $POOL +#zfs set acltype=posixacl $POOL +#zfs set xattr=sa $POOL + +setfacl -d --set u::rwx,g::rwx,o::r-x /data +setfacl -d --set u::rwx,g::r-x,o::r-x /usr/local/projects +setfacl -d --set u::rwx,g::rwx,o::r-x /srv +setfacl -d --set u::rwx,g::r-x,o::--- /backup +setfacl -d --set u::rwx,g::r-x,o::--- /home +setfacl -d --set u::rwx,g::r-x,o::--- /root + diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/check-io_scheduler.sh b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/check-io_scheduler.sh new file mode 100644 index 0000000..a63fa79 --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/check-io_scheduler.sh @@ -0,0 +1,3 @@ +#! /bin/sh + +for i in /sys/block/* ; do echo $i ; cat $i//queue/scheduler ; done diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/common.sh b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/common.sh new file mode 100644 index 0000000..7771c91 --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/common.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +log (){ + date +"[%T] $*" | tee -a "${LOG_FILE}" +} +export -f log + +bootstrap(){ + local BOOTSTRAP_CMD=debootstrap + local BOOTSTRAP_ARGS=() + + #export http_proxy=${APT_PROXY} + + # qemu-debootstrap is deprecated. Please use regular debootstrap directly + # + # if [ "$(dpkg --print-architecture)" != "armhf" ] && [ "$(dpkg --print-architecture)" != "arm64" ]; then + # BOOTSTRAP_CMD=qemu-debootstrap + # fi + + BOOTSTRAP_ARGS+=(--arch ${TARGET_ARCH}) + BOOTSTRAP_ARGS+=(--include gnupg) + BOOTSTRAP_ARGS+=(--components "main,contrib,non-free") + BOOTSTRAP_ARGS+=("$@") + printf -v BOOTSTRAP_STR '%q ' "${BOOTSTRAP_ARGS[@]}" + + capsh --drop=cap_setfcap -- -c "'${BOOTSTRAP_CMD}' $BOOTSTRAP_STR" || true + + if [ -d "$2/debootstrap" ] && ! rmdir "$2/debootstrap"; then + cp "$2/debootstrap/debootstrap.log" "${STAGE_WORK_DIR}" + log "bootstrap failed: please check ${STAGE_WORK_DIR}/debootstrap.log" + return 1 + fi +} +export -f bootstrap + +apt_install() { + DEBIAN_FRONTEND=noninteractive + local APT_GET_INSTALL_OPTS='-o APT::Acquire::Retries=3' + + apt-get ${APT_GET_INSTALL_OPTS} install --no-install-recommends -y "$@" +} +export -f apt_install + +apt_install_confdefold() { + DEBIAN_FRONTEND=noninteractive + local APT_GET_INSTALL_OPTS='-o APT::Acquire::Retries=3 -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"' + + apt-get ${APT_GET_INSTALL_OPTS} install --no-install-recommends -y "$@" +} +export -f apt_install + +on_chroot() { + if ! mount | grep -q "$(realpath "${ROOTFS_DIR}"/proc)"; then + mount -t proc proc "${ROOTFS_DIR}/proc" + fi + + if ! mount | grep -q "$(realpath "${ROOTFS_DIR}"/dev)"; then + mount --bind /dev "${ROOTFS_DIR}/dev" + fi + + if ! mount | grep -q "$(realpath "${ROOTFS_DIR}"/dev/pts)"; then + mount --bind /dev/pts "${ROOTFS_DIR}/dev/pts" + fi + + if ! mount | grep -q "$(realpath "${ROOTFS_DIR}"/sys)"; then + mount --bind /sys "${ROOTFS_DIR}/sys" + fi + + # run as root 'dpkg-reconfigure locales' enable 'en_US.UTF-8' + # perhaps run as root 'update-locale LC_MEASUREMENT=en_US.UTF-8 LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8' + export LC_MEASUREMENT=en_US.UTF-8 + export LC_ALL=en_US.UTF-8 + export LANG=en_US.UTF-8 + + setarch linux32 capsh --drop=cap_setfcap "--chroot=${ROOTFS_DIR}/" -- -e "$@" +} +export -f on_chroot + diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/51cache b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/51cache new file mode 100644 index 0000000..a8920a9 --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/51cache @@ -0,0 +1 @@ +Acquire::http { Proxy "APT_PROXY"; }; diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/apt-preferences.d-local-pin-init b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/apt-preferences.d-local-pin-init new file mode 100644 index 0000000..d964b02 --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/apt-preferences.d-local-pin-init @@ -0,0 +1,8 @@ +Package: zfs-zed zfsutils-linux libzfs2linux libzpool2linux libuutil1linux libnvpair1linux spl spl-dkms +Pin: version * +Pin-Priority: -1 + +Package: libzfs2-devel zfs-initramfs zfs zfs-dkms libzfs2 libzfs4 libzpool2 libzpool4 libuutil1 libuutil3 libnvpair1 libnvpair3 zfs-dracut zfs-test +Pin: version * +Pin-Priority: -1 + diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/console-debconf b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/console-debconf new file mode 100644 index 0000000..c13e3b1 --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/console-debconf @@ -0,0 +1,26 @@ +# Encoding to use on the console: +# Choices: ARMSCII-8, CP1251, CP1255, CP1256, GEORGIAN-ACADEMY, GEORGIAN-PS, IBM1133, ISIRI-3342, ISO-8859-1, ISO-8859-10, ISO-8859-11, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16, ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-9, KOI8-R, KOI8-U, TIS-620, UTF-8, VISCII +console-setup console-setup/charmap47 select UTF-8 +# Character set to support: +# Choices: . Arabic, # Armenian, # Cyrillic - KOI8-R and KOI8-U, # Cyrillic - non-Slavic languages, # Cyrillic - Slavic languages (also Bosnian and Serbian Latin), . Ethiopic, # Georgian, # Greek, # Hebrew, # Lao, # Latin1 and Latin5 - western Europe and Turkic languages, # Latin2 - central Europe and Romanian, # Latin3 and Latin8 - Chichewa; Esperanto; Irish; Maltese and Welsh, # Latin7 - Lithuanian; Latvian; Maori and Marshallese, . Latin - Vietnamese, # Thai, . Combined - Latin; Slavic Cyrillic; Hebrew; basic Arabic, . Combined - Latin; Slavic Cyrillic; Greek, . Combined - Latin; Slavic and non-Slavic Cyrillic, Guess optimal character set +console-setup console-setup/codeset47 select Guess optimal character set +# Font for the console: +# Choices: Fixed, Goha, GohaClassic, Terminus, TerminusBold, TerminusBoldVGA, VGA, Do not change the boot/kernel font, Let the system select a suitable font +console-setup console-setup/fontface47 select Do not change the boot/kernel font +# Key to function as AltGr: +# Choices: The default for the keyboard layout, No AltGr key, Right Alt (AltGr), Right Control, Right Logo key, Menu key, Left Alt, Left Logo key, Keypad Enter key, Both Logo keys, Both Alt keys +keyboard-configuration keyboard-configuration/altgr select The default for the keyboard layout +# Keyboard model: +# Choices: A4Tech KB-21, A4Tech KBS-8, A4Tech Wireless Desktop RFKB-23, Acer AirKey V, Acer C300, Acer Ferrari 4000, Acer Laptop, Advance Scorpius KI, Amiga, Apple, Apple Aluminium Keyboard (ANSI), Apple Aluminium Keyboard (ISO), Apple Aluminium Keyboard (JIS), Apple Laptop, Asus Laptop, Atari TT, Azona RF2300 wireless Internet Keyboard, BTC 5090, BTC 5113RF Multimedia, BTC 5126T, BTC 6301URF, BTC 9000, BTC 9000A, BTC 9001AH, BTC 9019U, BTC 9116U Mini Wireless Internet and Gaming, BenQ X-Touch, BenQ X-Touch 730, BenQ X-Touch 800, Brother Internet Keyboard, Cherry B.UNLIMITED, Cherry Blue Line CyBo@rd, Cherry Blue Line CyBo@rd (alternate option), Cherry CyBo@rd USB-Hub, Cherry CyMotion Expert, Cherry CyMotion Master Linux, Cherry CyMotion Master XPress, Chicony Internet Keyboard, Chicony KB-9885, Chicony KU-0108, Chicony KU-0420, Classmate PC, Compaq Easy Access Keyboard, Compaq Internet Keyboard (13 keys), Compaq Internet Keyboard (18 keys), Compaq Internet Keyboard (7 keys), Compaq iPaq Keyboard, Creative Desktop Wireless 7000, DTK2000, Dell, Dell 101-key PC, Dell Laptop/notebook Inspiron 6xxx/8xxx, Dell Laptop/notebook Precision M series, Dell Latitude series laptop, Dell Precision M65, Dell SK-8125, Dell SK-8135, Dell USB Multimedia Keyboard, Dexxa Wireless Desktop Keyboard, Diamond 9801 / 9802 series, Ennyah DKB-1008, Everex STEPnote, FL90, Fujitsu-Siemens Computers AMILO laptop, Generic 101-key PC, Generic 102-key (Intl) PC, Generic 104-key PC, Generic 105-key (Intl) PC, Genius Comfy KB-12e, Genius Comfy KB-16M / Genius MM Keyboard KWD-910, Genius Comfy KB-21e-Scroll, Genius KB-19e NB, Genius KKB-2050HS, Gyration, HTC Dream, Happy Hacking Keyboard, Happy Hacking Keyboard for Mac, Hewlett-Packard Internet Keyboard, Hewlett-Packard Mini 110 Notebook, Hewlett-Packard Omnibook 500 FA, Hewlett-Packard Omnibook 5xx, Hewlett-Packard Omnibook 6000/6100, Hewlett-Packard Omnibook XE3 GC, Hewlett-Packard Omnibook XE3 GF, Hewlett-Packard Omnibook XT1000, Hewlett-Packard Pavilion ZT11xx, Hewlett-Packard Pavilion dv5, Hewlett-Packard SK-250x Multimedia Keyboard, Hewlett-Packard nx9020, Honeywell Euroboard, Htc Dream phone, IBM Rapid Access, IBM Rapid Access II, IBM Space Saver, IBM ThinkPad 560Z/600/600E/A22E, IBM ThinkPad R60/T60/R61/T61, IBM ThinkPad Z60m/Z60t/Z61m/Z61t, Keytronic FlexPro, Kinesis, Laptop/notebook Compaq (eg. Armada) Laptop Keyboard, Laptop/notebook Compaq (eg. Presario) Internet Keyboard, Laptop/notebook eMachines m68xx, Logitech Access Keyboard, Logitech Cordless Desktop, Logitech Cordless Desktop (alternate option), Logitech Cordless Desktop EX110, Logitech Cordless Desktop LX-300, Logitech Cordless Desktop Navigator, Logitech Cordless Desktop Optical, Logitech Cordless Desktop Pro (alternate option 2), Logitech Cordless Desktop iTouch, Logitech Cordless Freedom/Desktop Navigator, Logitech G15 extra keys via G15daemon, Logitech Generic Keyboard, Logitech Internet 350 Keyboard, Logitech Internet Keyboard, Logitech Internet Navigator Keyboard, Logitech Media Elite Keyboard, Logitech Ultra-X Cordless Media Desktop Keyboard, Logitech Ultra-X Keyboard, Logitech diNovo Edge Keyboard, Logitech diNovo Keyboard, Logitech iTouch, Logitech iTouch Cordless Keyboard (model Y-RB6), Logitech iTouch Internet Navigator Keyboard SE, Logitech iTouch Internet Navigator Keyboard SE (USB), MacBook/MacBook Pro, MacBook/MacBook Pro (Intl), Macintosh, Macintosh Old, Memorex MX1998, Memorex MX2500 EZ-Access Keyboard, Memorex MX2750, Microsoft Comfort Curve Keyboard 2000, Microsoft Internet Keyboard, Microsoft Internet Keyboard Pro\, Swedish, Microsoft Natural, Microsoft Natural Keyboard Elite, Microsoft Natural Keyboard Pro / Microsoft Internet Keyboard Pro, Microsoft Natural Keyboard Pro OEM, Microsoft Natural Keyboard Pro USB / Microsoft Internet Keyboard Pro, Microsoft Natural Wireless Ergonomic Keyboard 4000, Microsoft Natural Wireless Ergonomic Keyboard 7000, Microsoft Office Keyboard, Microsoft Wireless Multimedia Keyboard 1.0A, Northgate OmniKey 101, OLPC, Ortek MCK-800 MM/Internet keyboard, PC-98xx Series, Propeller Voyager (KTEZ-1000), QTronix Scorpius 98N+, SILVERCREST Multimedia Wireless Keyboard, SK-1300, SK-2500, SK-6200, SK-7100, SVEN Ergonomic 2500, SVEN Slim 303, Samsung SDM 4500P, Samsung SDM 4510P, Sanwa Supply SKB-KG3, Sun Type 4, Sun Type 5, Sun Type 6 (Japanese layout), Sun Type 6 USB (Japanese layout), Sun Type 6 USB (Unix layout), Sun Type 6/7 USB, Sun Type 6/7 USB (European layout), Sun Type 7 USB, Sun Type 7 USB (European layout), Sun Type 7 USB (Japanese layout) / Japanese 106-key, Sun Type 7 USB (Unix layout), Super Power Multimedia Keyboard, Symplon PaceBook (tablet PC), Targa Visionary 811, Toshiba Satellite S3000, Trust Direct Access Keyboard, Trust Slimline, Trust Wireless Keyboard Classic, TypeMatrix EZ-Reach 2020, TypeMatrix EZ-Reach 2030 PS2, TypeMatrix EZ-Reach 2030 USB, TypeMatrix EZ-Reach 2030 USB (102/105:EU mode), TypeMatrix EZ-Reach 2030 USB (106:JP mode), Unitek KB-1925, ViewSonic KU-306 Internet Keyboard, Winbook Model XP5, Yahoo! Internet Keyboard +keyboard-configuration keyboard-configuration/model select Generic 105-key (Intl) PC +# Keymap to use: +# Choices: American English, Albanian, Arabic, Asturian, Bangladesh, Belarusian, Bengali, Belgian, Bosnian, Brazilian, British English, Bulgarian, Bulgarian (phonetic layout), Burmese, Canadian French, Canadian Multilingual, Catalan, Chinese, Croatian, Czech, Danish, Dutch, Dvorak, Dzongkha, Esperanto, Estonian, Ethiopian, Finnish, French, Georgian, German, Greek, Gujarati, Gurmukhi, Hebrew, Hindi, Hungarian, Icelandic, Irish, Italian, Japanese, Kannada, Kazakh, Khmer, Kirghiz, Korean, Kurdish (F layout), Kurdish (Q layout), Lao, Latin American, Latvian, Lithuanian, Macedonian, Malayalam, Nepali, Northern Sami, Norwegian, Persian, Philippines, Polish, Portuguese, Punjabi, Romanian, Russian, Serbian (Cyrillic), Sindhi, Sinhala, Slovak, Slovenian, Spanish, Swedish, Swiss French, Swiss German, Tajik, Tamil, Telugu, Thai, Tibetan, Turkish (F layout), Turkish (Q layout), Ukrainian, Uyghur, Vietnamese +keyboard-configuration keyboard-configuration/xkb-keymap select ${KEYBOARD_KEYMAP} +# Compose key: +# Choices: No compose key, Right Alt (AltGr), Right Control, Right Logo key, Menu key, Left Logo key, Caps Lock +keyboard-configuration keyboard-configuration/compose select No compose key +# Use Control+Alt+Backspace to terminate the X server? +keyboard-configuration keyboard-configuration/ctrl_alt_bksp boolean true +# Keyboard layout: +# Choices: English (UK), English (UK) - English (UK\, Colemak), English (UK) - English (UK\, Dvorak with UK punctuation), English (UK) - English (UK\, Dvorak), English (UK) - English (UK\, Macintosh international), English (UK) - English (UK\, Macintosh), English (UK) - English (UK\, extended WinKeys), English (UK) - English (UK\, international with dead keys), Other +keyboard-configuration keyboard-configuration/variant select ${KEYBOARD_LAYOUT} diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/fstab b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/fstab new file mode 100644 index 0000000..4f37cd7 --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/fstab @@ -0,0 +1,3 @@ +proc /proc proc defaults 0 0 + +# ROOTDEV / zfs defaults,noatime 0 1 diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/locale-debconf b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/locale-debconf new file mode 100644 index 0000000..b0ad3e4 --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/locale-debconf @@ -0,0 +1,6 @@ +# Locales to be generated: +# Choices: All locales, aa_DJ ISO-8859-1, aa_DJ.UTF-8 UTF-8, aa_ER UTF-8, aa_ER@saaho UTF-8, aa_ET UTF-8, af_ZA ISO-8859-1, af_ZA.UTF-8 UTF-8, ak_GH UTF-8, am_ET UTF-8, an_ES ISO-8859-15, an_ES.UTF-8 UTF-8, anp_IN UTF-8, ar_AE ISO-8859-6, ar_AE.UTF-8 UTF-8, ar_BH ISO-8859-6, ar_BH.UTF-8 UTF-8, ar_DZ ISO-8859-6, ar_DZ.UTF-8 UTF-8, ar_EG ISO-8859-6, ar_EG.UTF-8 UTF-8, ar_IN UTF-8, ar_IQ ISO-8859-6, ar_IQ.UTF-8 UTF-8, ar_JO ISO-8859-6, ar_JO.UTF-8 UTF-8, ar_KW ISO-8859-6, ar_KW.UTF-8 UTF-8, ar_LB ISO-8859-6, ar_LB.UTF-8 UTF-8, ar_LY ISO-8859-6, ar_LY.UTF-8 UTF-8, ar_MA ISO-8859-6, ar_MA.UTF-8 UTF-8, ar_OM ISO-8859-6, ar_OM.UTF-8 UTF-8, ar_QA ISO-8859-6, ar_QA.UTF-8 UTF-8, ar_SA ISO-8859-6, ar_SA.UTF-8 UTF-8, ar_SD ISO-8859-6, ar_SD.UTF-8 UTF-8, ar_SS UTF-8, ar_SY ISO-8859-6, ar_SY.UTF-8 UTF-8, ar_TN ISO-8859-6, ar_TN.UTF-8 UTF-8, ar_YE ISO-8859-6, ar_YE.UTF-8 UTF-8, as_IN UTF-8, ast_ES ISO-8859-15, ast_ES.UTF-8 UTF-8, ayc_PE UTF-8, az_AZ UTF-8, be_BY CP1251, be_BY.UTF-8 UTF-8, be_BY@latin UTF-8, bem_ZM UTF-8, ber_DZ UTF-8, ber_MA UTF-8, bg_BG CP1251, bg_BG.UTF-8 UTF-8, bho_IN UTF-8, bn_BD UTF-8, bn_IN UTF-8, bo_CN UTF-8, bo_IN UTF-8, br_FR ISO-8859-1, br_FR.UTF-8 UTF-8, br_FR@euro ISO-8859-15, brx_IN UTF-8, bs_BA ISO-8859-2, bs_BA.UTF-8 UTF-8, byn_ER UTF-8, ca_AD ISO-8859-15, ca_AD.UTF-8 UTF-8, ca_ES ISO-8859-1, ca_ES.UTF-8 UTF-8, ca_ES.UTF-8@valencia UTF-8, ca_ES@euro ISO-8859-15, ca_ES@valencia ISO-8859-15, ca_FR ISO-8859-15, ca_FR.UTF-8 UTF-8, ca_IT ISO-8859-15, ca_IT.UTF-8 UTF-8, cmn_TW UTF-8, crh_UA UTF-8, cs_CZ ISO-8859-2, cs_CZ.UTF-8 UTF-8, csb_PL UTF-8, cv_RU UTF-8, cy_GB ISO-8859-14, cy_GB.UTF-8 UTF-8, da_DK ISO-8859-1, da_DK.UTF-8 UTF-8, de_AT ISO-8859-1, de_AT.UTF-8 UTF-8, de_AT@euro ISO-8859-15, de_BE ISO-8859-1, de_BE.UTF-8 UTF-8, de_BE@euro ISO-8859-15, de_CH ISO-8859-1, de_CH.UTF-8 UTF-8, de_DE ISO-8859-1, de_DE.UTF-8 UTF-8, de_DE@euro ISO-8859-15, de_LI.UTF-8 UTF-8, de_LU ISO-8859-1, de_LU.UTF-8 UTF-8, de_LU@euro ISO-8859-15, doi_IN UTF-8, dv_MV UTF-8, dz_BT UTF-8, el_CY ISO-8859-7, el_CY.UTF-8 UTF-8, el_GR ISO-8859-7, el_GR.UTF-8 UTF-8, en_AG UTF-8, en_AU ISO-8859-1, en_AU.UTF-8 UTF-8, en_BW ISO-8859-1, en_BW.UTF-8 UTF-8, en_CA ISO-8859-1, en_CA.UTF-8 UTF-8, en_DK ISO-8859-1, en_DK.ISO-8859-15 ISO-8859-15, en_DK.UTF-8 UTF-8, en_GB ISO-8859-1, en_GB.ISO-8859-15 ISO-8859-15, en_GB.UTF-8 UTF-8, en_HK ISO-8859-1, en_HK.UTF-8 UTF-8, en_IE ISO-8859-1, en_IE.UTF-8 UTF-8, en_IE@euro ISO-8859-15, en_IN UTF-8, en_NG UTF-8, en_NZ ISO-8859-1, en_NZ.UTF-8 UTF-8, en_PH ISO-8859-1, en_PH.UTF-8 UTF-8, en_SG ISO-8859-1, en_SG.UTF-8 UTF-8, en_US ISO-8859-1, en_US.ISO-8859-15 ISO-8859-15, en_US.UTF-8 UTF-8, en_ZA ISO-8859-1, en_ZA.UTF-8 UTF-8, en_ZM UTF-8, en_ZW ISO-8859-1, en_ZW.UTF-8 UTF-8, eo ISO-8859-3, eo.UTF-8 UTF-8, es_AR ISO-8859-1, es_AR.UTF-8 UTF-8, es_BO ISO-8859-1, es_BO.UTF-8 UTF-8, es_CL ISO-8859-1, es_CL.UTF-8 UTF-8, es_CO ISO-8859-1, es_CO.UTF-8 UTF-8, es_CR ISO-8859-1, es_CR.UTF-8 UTF-8, es_CU UTF-8, es_DO ISO-8859-1, es_DO.UTF-8 UTF-8, es_EC ISO-8859-1, es_EC.UTF-8 UTF-8, es_ES ISO-8859-1, es_ES.UTF-8 UTF-8, es_ES@euro ISO-8859-15, es_GT ISO-8859-1, es_GT.UTF-8 UTF-8, es_HN ISO-8859-1, es_HN.UTF-8 UTF-8, es_MX ISO-8859-1, es_MX.UTF-8 UTF-8, es_NI ISO-8859-1, es_NI.UTF-8 UTF-8, es_PA ISO-8859-1, es_PA.UTF-8 UTF-8, es_PE ISO-8859-1, es_PE.UTF-8 UTF-8, es_PR ISO-8859-1, es_PR.UTF-8 UTF-8, es_PY ISO-8859-1, es_PY.UTF-8 UTF-8, es_SV ISO-8859-1, es_SV.UTF-8 UTF-8, es_US ISO-8859-1, es_US.UTF-8 UTF-8, es_UY ISO-8859-1, es_UY.UTF-8 UTF-8, es_VE ISO-8859-1, es_VE.UTF-8 UTF-8, et_EE ISO-8859-1, et_EE.ISO-8859-15 ISO-8859-15, et_EE.UTF-8 UTF-8, eu_ES ISO-8859-1, eu_ES.UTF-8 UTF-8, eu_ES@euro ISO-8859-15, eu_FR ISO-8859-1, eu_FR.UTF-8 UTF-8, eu_FR@euro ISO-8859-15, fa_IR UTF-8, ff_SN UTF-8, fi_FI ISO-8859-1, fi_FI.UTF-8 UTF-8, fi_FI@euro ISO-8859-15, fil_PH UTF-8, fo_FO ISO-8859-1, fo_FO.UTF-8 UTF-8, fr_BE ISO-8859-1, fr_BE.UTF-8 UTF-8, fr_BE@euro ISO-8859-15, fr_CA ISO-8859-1, fr_CA.UTF-8 UTF-8, fr_CH ISO-8859-1, fr_CH.UTF-8 UTF-8, fr_FR ISO-8859-1, fr_FR.UTF-8 UTF-8, fr_FR@euro ISO-8859-15, fr_LU ISO-8859-1, fr_LU.UTF-8 UTF-8, fr_LU@euro ISO-8859-15, fur_IT UTF-8, fy_DE UTF-8, fy_NL UTF-8, ga_IE ISO-8859-1, ga_IE.UTF-8 UTF-8, ga_IE@euro ISO-8859-15, gd_GB ISO-8859-15, gd_GB.UTF-8 UTF-8, gez_ER UTF-8, gez_ER@abegede UTF-8, gez_ET UTF-8, gez_ET@abegede UTF-8, gl_ES ISO-8859-1, gl_ES.UTF-8 UTF-8, gl_ES@euro ISO-8859-15, gu_IN UTF-8, gv_GB ISO-8859-1, gv_GB.UTF-8 UTF-8, ha_NG UTF-8, hak_TW UTF-8, he_IL ISO-8859-8, he_IL.UTF-8 UTF-8, hi_IN UTF-8, hne_IN UTF-8, hr_HR ISO-8859-2, hr_HR.UTF-8 UTF-8, hsb_DE ISO-8859-2, hsb_DE.UTF-8 UTF-8, ht_HT UTF-8, hu_HU ISO-8859-2, hu_HU.UTF-8 UTF-8, hy_AM UTF-8, hy_AM.ARMSCII-8 ARMSCII-8, ia_FR UTF-8, id_ID ISO-8859-1, id_ID.UTF-8 UTF-8, ig_NG UTF-8, ik_CA UTF-8, is_IS ISO-8859-1, is_IS.UTF-8 UTF-8, it_CH ISO-8859-1, it_CH.UTF-8 UTF-8, it_IT ISO-8859-1, it_IT.UTF-8 UTF-8, it_IT@euro ISO-8859-15, iu_CA UTF-8, iw_IL ISO-8859-8, iw_IL.UTF-8 UTF-8, ja_JP.EUC-JP EUC-JP, ja_JP.UTF-8 UTF-8, ka_GE GEORGIAN-PS, ka_GE.UTF-8 UTF-8, kk_KZ PT154, kk_KZ RK1048, kk_KZ.UTF-8 UTF-8, kl_GL ISO-8859-1, kl_GL.UTF-8 UTF-8, km_KH UTF-8, kn_IN UTF-8, ko_KR.EUC-KR EUC-KR, ko_KR.UTF-8 UTF-8, kok_IN UTF-8, ks_IN UTF-8, ks_IN@devanagari UTF-8, ku_TR ISO-8859-9, ku_TR.UTF-8 UTF-8, kw_GB ISO-8859-1, kw_GB.UTF-8 UTF-8, ky_KG UTF-8, lb_LU UTF-8, lg_UG ISO-8859-10, lg_UG.UTF-8 UTF-8, li_BE UTF-8, li_NL UTF-8, lij_IT UTF-8, lo_LA UTF-8, lt_LT ISO-8859-13, lt_LT.UTF-8 UTF-8, lv_LV ISO-8859-13, lv_LV.UTF-8 UTF-8, lzh_TW UTF-8, mag_IN UTF-8, mai_IN UTF-8, mg_MG ISO-8859-15, mg_MG.UTF-8 UTF-8, mhr_RU UTF-8, mi_NZ ISO-8859-13, mi_NZ.UTF-8 UTF-8, mk_MK ISO-8859-5, mk_MK.UTF-8 UTF-8, ml_IN UTF-8, mn_MN UTF-8, mni_IN UTF-8, mr_IN UTF-8, ms_MY ISO-8859-1, ms_MY.UTF-8 UTF-8, mt_MT ISO-8859-3, mt_MT.UTF-8 UTF-8, my_MM UTF-8, nan_TW UTF-8, nan_TW@latin UTF-8, nb_NO ISO-8859-1, nb_NO.UTF-8 UTF-8, nds_DE UTF-8, nds_NL UTF-8, ne_NP UTF-8, nhn_MX UTF-8, niu_NU UTF-8, niu_NZ UTF-8, nl_AW UTF-8, nl_BE ISO-8859-1, nl_BE.UTF-8 UTF-8, nl_BE@euro ISO-8859-15, nl_NL ISO-8859-1, nl_NL.UTF-8 UTF-8, nl_NL@euro ISO-8859-15, nn_NO ISO-8859-1, nn_NO.UTF-8 UTF-8, nr_ZA UTF-8, nso_ZA UTF-8, oc_FR ISO-8859-1, oc_FR.UTF-8 UTF-8, om_ET UTF-8, om_KE ISO-8859-1, om_KE.UTF-8 UTF-8, or_IN UTF-8, os_RU UTF-8, pa_IN UTF-8, pa_PK UTF-8, pap_AN UTF-8, pap_AW UTF-8, pap_CW UTF-8, pl_PL ISO-8859-2, pl_PL.UTF-8 UTF-8, ps_AF UTF-8, pt_BR ISO-8859-1, pt_BR.UTF-8 UTF-8, pt_PT ISO-8859-1, pt_PT.UTF-8 UTF-8, pt_PT@euro ISO-8859-15, quz_PE UTF-8, ro_RO ISO-8859-2, ro_RO.UTF-8 UTF-8, ru_RU ISO-8859-5, ru_RU.CP1251 CP1251, ru_RU.KOI8-R KOI8-R, ru_RU.UTF-8 UTF-8, ru_UA KOI8-U, ru_UA.UTF-8 UTF-8, rw_RW UTF-8, sa_IN UTF-8, sat_IN UTF-8, sc_IT UTF-8, sd_IN UTF-8, sd_IN@devanagari UTF-8, se_NO UTF-8, shs_CA UTF-8, si_LK UTF-8, sid_ET UTF-8, sk_SK ISO-8859-2, sk_SK.UTF-8 UTF-8, sl_SI ISO-8859-2, sl_SI.UTF-8 UTF-8, so_DJ ISO-8859-1, so_DJ.UTF-8 UTF-8, so_ET UTF-8, so_KE ISO-8859-1, so_KE.UTF-8 UTF-8, so_SO ISO-8859-1, so_SO.UTF-8 UTF-8, sq_AL ISO-8859-1, sq_AL.UTF-8 UTF-8, sq_MK UTF-8, sr_ME UTF-8, sr_RS UTF-8, sr_RS@latin UTF-8, ss_ZA UTF-8, st_ZA ISO-8859-1, st_ZA.UTF-8 UTF-8, sv_FI ISO-8859-1, sv_FI.UTF-8 UTF-8, sv_FI@euro ISO-8859-15, sv_SE ISO-8859-1, sv_SE.ISO-8859-15 ISO-8859-15, sv_SE.UTF-8 UTF-8, sw_KE UTF-8, sw_TZ UTF-8, szl_PL UTF-8, ta_IN UTF-8, ta_LK UTF-8, te_IN UTF-8, tg_TJ KOI8-T, tg_TJ.UTF-8 UTF-8, th_TH TIS-620, th_TH.UTF-8 UTF-8, the_NP UTF-8, ti_ER UTF-8, ti_ET UTF-8, tig_ER UTF-8, tk_TM UTF-8, tl_PH ISO-8859-1, tl_PH.UTF-8 UTF-8, tn_ZA UTF-8, tr_CY ISO-8859-9, tr_CY.UTF-8 UTF-8, tr_TR ISO-8859-9, tr_TR.UTF-8 UTF-8, ts_ZA UTF-8, tt_RU UTF-8, tt_RU@iqtelif UTF-8, ug_CN UTF-8, uk_UA KOI8-U, uk_UA.UTF-8 UTF-8, unm_US UTF-8, ur_IN UTF-8, ur_PK UTF-8, uz_UZ ISO-8859-1, uz_UZ.UTF-8 UTF-8, uz_UZ@cyrillic UTF-8, ve_ZA UTF-8, vi_VN UTF-8, wa_BE ISO-8859-1, wa_BE.UTF-8 UTF-8, wa_BE@euro ISO-8859-15, wae_CH UTF-8, wal_ET UTF-8, wo_SN UTF-8, xh_ZA ISO-8859-1, xh_ZA.UTF-8 UTF-8, yi_US CP1255, yi_US.UTF-8 UTF-8, yo_NG UTF-8, yue_HK UTF-8, zh_CN GB2312, zh_CN.GB18030 GB18030, zh_CN.GBK GBK, zh_CN.UTF-8 UTF-8, zh_HK BIG5-HKSCS, zh_HK.UTF-8 UTF-8, zh_SG GB2312, zh_SG.GBK GBK, zh_SG.UTF-8 UTF-8, zh_TW BIG5, zh_TW.EUC-TW EUC-TW, zh_TW.UTF-8 UTF-8, zu_ZA ISO-8859-1, zu_ZA.UTF-8 UTF-8 +locales locales/locales_to_be_generated multiselect ${LOCALE_DEFAULT} UTF-8 +# Default locale for the system environment: +# Choices: None, C.UTF-8, en_GB.UTF-8 +locales locales/default_environment_locale select ${LOCALE_DEFAULT} diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/network/enN b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/network/enN new file mode 100644 index 0000000..69e55d0 --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/network/enN @@ -0,0 +1,3 @@ +auto /en*=enp +allow-hotplug enp +iface enp inet dhcp diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/network/ethN b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/network/ethN new file mode 100644 index 0000000..cd4946c --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/network/ethN @@ -0,0 +1,3 @@ +auto /eth*=eth +allow-hotplug eth +iface eth inet dhcp diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/sources-stable.list b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/sources-stable.list new file mode 100644 index 0000000..0332f89 --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/sources-stable.list @@ -0,0 +1,7 @@ +deb http://deb.debian.org/debian RELEASE main contrib non-free +deb http://deb.debian.org/debian-security/ RELEASE/updates main contrib non-free +deb http://deb.debian.org/debian RELEASE-updates main contrib non-free +# Uncomment deb-src lines below then 'apt-get update' to enable 'apt-get source' +#deb-src http://deb.debian.org/debian RELEASE main contrib non-free +#deb-src http://deb.debian.org/debian-security/ RELEASE/updates main contrib non-free +#deb-src http://deb.debian.org/debian RELEASE-updates main contrib non-free diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/sources-testing.list b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/sources-testing.list new file mode 100644 index 0000000..db9d633 --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/sources-testing.list @@ -0,0 +1,7 @@ +deb http://deb.debian.org/debian RELEASE main contrib non-free +# deb http://deb.debian.org/debian-security/ RELEASE/updates main contrib non-free +# deb http://deb.debian.org/debian RELEASE-updates main contrib non-free +# Uncomment deb-src lines below then 'apt-get update' to enable 'apt-get source' +#deb-src http://deb.debian.org/debian RELEASE main contrib non-free +#deb-src http://deb.debian.org/debian-security/ RELEASE/updates main contrib non-free +#deb-src http://deb.debian.org/debian RELEASE-updates main contrib non-free diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/ttyoutput.conf b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/ttyoutput.conf new file mode 100644 index 0000000..6a396a4 --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/ttyoutput.conf @@ -0,0 +1,2 @@ +[Service] +StandardOutput=tty diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/wpa_supplicant.conf b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/wpa_supplicant.conf new file mode 100644 index 0000000..0fc335e --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/files/wpa_supplicant.conf @@ -0,0 +1,2 @@ +ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev +update_config=1 diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install-jau.cfg b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install-jau.cfg new file mode 100644 index 0000000..f35549d --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install-jau.cfg @@ -0,0 +1,37 @@ +#! /bin/sh + +export ROOTFS_DIR="/mnt" +export APT_PROXY=http://jordan:3142 + +export TARGET_ARCH="amd64" + +export RELEASE="bullseye" +export IS_TESTING="1" + +export TARGET_HOSTNAME=deb11amd64 + +export LOCALE_DEFAULT=en_US.UTF-8 +export KEYBOARD_KEYMAP=us +export KEYBOARD_LAYOUT="English (US)" +export TIMEZONE_DEFAULT="Europe/Berlin" + +export FIRST_USER_NAME="test01" +export FIRST_USER_PASS="test01" + +export ENABLE_SSH=1 +export PUBKEY_SSH_FIRST_USER="ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEAm2qfo3uiWT9V7E/sH6unVO6XhGHeNnGUswxuADwFAKyflJq2yCALWIX7+DzEhBc7O9HxVztZAHLA+lfEpctQkA7KPgX98rjLHJlrm1lQXCPjwWjTZBrGNCmjWpYkc8jew/BzngmiwDlshYqzp0rWKNvQbkGJaVctqaraJAzE3F2wa+KkSBQuw2rAhiarbiO4MtO1AIw25EnSXHhP9EpeTKhAniKm73q977m5wpzaU+uwoGPCIyVl+BeaGLbPPIF35PJbg4tIqG6WLy3a8++Mf5Ml8lETcYYfjh4er3CvqFLhAYcaCLPNOwkK/YT4UnYZoZ4nt0Z+JWjxeNhIuJf64neysBdgB5E5FEYP2iYH+EUjcYp7YCrl/3/ag4Z2KAsF2qEa6/+s90Clm0r2mqRcQyLYQ6Co1YlYa1/jq7qsiuNgWvn5Mg8Pt4+L/C0KoycvUr4HhTS8EBJx+774p2uBa3mB65Vg2llKb8DdtQwR1bh0Ot9cjKTJY0pDyPiFbemZh2q7qD958bsOZCly43WYRd6E0Df68Q2MTz6ZC1y+z103gsEiK8bXmZp42ghDa96Ik2JO6pWCEUjBJ/9+rdudRHcfDlBqoS6+wg/z+WvtRtEyvVO4LSTrsX5xHWzVloSZeAGowmLbxGWHGWfl5oCcNfUzXo0lXDP0bzyy5NxWkpE= sven@phalanx" +export PUBKEY2_SSH_FIRST_USER="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC+pMJr432NOaDKnVN9+KDARU3XPDCMcwlsDdFHAEuVIGiNE2yxsC+UVKqu2+ZWKIlNET0zW8b87WsWVwiTa58lkxVre3g9DYAXpV7HPsf0bpTmzKqfPUC2z52aISluH/+Mf5FlytqFgpzx1VxREjvAw2H0GFE2K7+GsVcDFxjd5hv81FVAO9KISFnVVP9i+mSR7P4QOUYmXMw7Zq1z6hjXAGxXupEx8p/6KCqgo1tdVQBefJNOJpCABDI0yHgRsXnm7CUv1a/vM7QfCsn1hugcEGilacBLBcQp6EhXvleavX3ixffNV9RmOO0X06/EVwBtgal9aH375XABWihUi3EkRvfRqo07eieWzTIj6gO+AhZmuu4X/o53W5BG+cgMRV/+VGsLijH6jdvVv9W+motjX16TSHbSBHFaiwFyreAFi/A7WiUqdcbe12nnUsHlumhJSAIynCHKy6hgFEuGQFdENcudCgNMF7SDQEB52TwiO6BZuP6VHw4nNqxm+sbmKjgKi5vTrzIe7JkuRX+eIZLFZifFS7kfIRfQY67sCerTYsnC0Y0muX+VixKG3FIL6iSlF3KLOd41LPVNmBbpZK7oC62qrXBhvgA2d9D92o5rzqFCA6obEYiEDgyN6liASJD6VFNey366FyZzsf2U2dUeHFkyUxY0EEEFNeoOPhF5SQ== [email protected]" +export PUBKEY_ONLY_SSH=1 + +# +# For ZFS System Installation +# +export POOL=tpool +export DISK1=ata-QEMU_HARDDISK_QM00005 +export DISK2=ata-QEMU_HARDDISK_QM00007 +export DISK3=ata-QEMU_HARDDISK_QM00009 +export MYSWAPSIZE=1G +# Warning: zstd may not yet been supported with zstd +# lz4 is our default +# export ZFS_COMPRESSION_METHOD=lz4 + diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install.cfg b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install.cfg new file mode 100644 index 0000000..1b09a13 --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install.cfg @@ -0,0 +1,37 @@ +#! /bin/sh + +export ROOTFS_DIR="/mnt" +# export APT_PROXY=http://jordan:3142 + +export TARGET_ARCH="amd64" + +export RELEASE="bullseye" +export IS_TESTING="1" + +export TARGET_HOSTNAME=deb11amd64 + +export LOCALE_DEFAULT=en_US.UTF-8 +export KEYBOARD_KEYMAP=us +export KEYBOARD_LAYOUT="English (US)" +export TIMEZONE_DEFAULT="Europe/Berlin" + +export FIRST_USER_NAME="test01" +export FIRST_USER_PASS="test01" + +export ENABLE_SSH=1 +export PUBKEY_SSH_FIRST_USER="ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEAm2qfo3uiWT9V7E/sH6unVO6XhGHeNnGUswxuADwFAKyflJq2yCALWIX7+DzEhBc7O9HxVztZAHLA+lfEpctQkA7KPgX98rjLHJlrm1lQXCPjwWjTZBrGNCmjWpYkc8jew/BzngmiwDlshYqzp0rWKNvQbkGJaVctqaraJAzE3F2wa+KkSBQuw2rAhiarbiO4MtO1AIw25EnSXHhP9EpeTKhAniKm73q977m5wpzaU+uwoGPCIyVl+BeaGLbPPIF35PJbg4tIqG6WLy3a8++Mf5Ml8lETcYYfjh4er3CvqFLhAYcaCLPNOwkK/YT4UnYZoZ4nt0Z+JWjxeNhIuJf64neysBdgB5E5FEYP2iYH+EUjcYp7YCrl/3/ag4Z2KAsF2qEa6/+s90Clm0r2mqRcQyLYQ6Co1YlYa1/jq7qsiuNgWvn5Mg8Pt4+L/C0KoycvUr4HhTS8EBJx+774p2uBa3mB65Vg2llKb8DdtQwR1bh0Ot9cjKTJY0pDyPiFbemZh2q7qD958bsOZCly43WYRd6E0Df68Q2MTz6ZC1y+z103gsEiK8bXmZp42ghDa96Ik2JO6pWCEUjBJ/9+rdudRHcfDlBqoS6+wg/z+WvtRtEyvVO4LSTrsX5xHWzVloSZeAGowmLbxGWHGWfl5oCcNfUzXo0lXDP0bzyy5NxWkpE= sven@phalanx" +export PUBKEY2_SSH_FIRST_USER="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC+pMJr432NOaDKnVN9+KDARU3XPDCMcwlsDdFHAEuVIGiNE2yxsC+UVKqu2+ZWKIlNET0zW8b87WsWVwiTa58lkxVre3g9DYAXpV7HPsf0bpTmzKqfPUC2z52aISluH/+Mf5FlytqFgpzx1VxREjvAw2H0GFE2K7+GsVcDFxjd5hv81FVAO9KISFnVVP9i+mSR7P4QOUYmXMw7Zq1z6hjXAGxXupEx8p/6KCqgo1tdVQBefJNOJpCABDI0yHgRsXnm7CUv1a/vM7QfCsn1hugcEGilacBLBcQp6EhXvleavX3ixffNV9RmOO0X06/EVwBtgal9aH375XABWihUi3EkRvfRqo07eieWzTIj6gO+AhZmuu4X/o53W5BG+cgMRV/+VGsLijH6jdvVv9W+motjX16TSHbSBHFaiwFyreAFi/A7WiUqdcbe12nnUsHlumhJSAIynCHKy6hgFEuGQFdENcudCgNMF7SDQEB52TwiO6BZuP6VHw4nNqxm+sbmKjgKi5vTrzIe7JkuRX+eIZLFZifFS7kfIRfQY67sCerTYsnC0Y0muX+VixKG3FIL6iSlF3KLOd41LPVNmBbpZK7oC62qrXBhvgA2d9D92o5rzqFCA6obEYiEDgyN6liASJD6VFNey366FyZzsf2U2dUeHFkyUxY0EEEFNeoOPhF5SQ== [email protected]" +export PUBKEY_ONLY_SSH=1 + +# +# For ZFS System Installation +# +export POOL=tpool +export DISK1=ata-WDC_WD2003FYYS-02W0B1_WD-WCAY00187731 +export DISK2=ata-WDC_WD2002FYPS-02W3B0_WD-WCAVY7137063 +export DISK3=ata-WDC_WD30EFRX-68EUZN0_WD-WCC4N2STURAK +export MYSWAPSIZE=33G +# Warning: zstd may not yet been supported with zstd +# lz4 is our default +# export ZFS_COMPRESSION_METHOD=lz4 + diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install.sh b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install.sh new file mode 100755 index 0000000..c1ce2f4 --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install.sh @@ -0,0 +1,8 @@ +#! /bin/bash -e + +export BASE_DIR=`dirname $(readlink -f "${BASH_SOURCE[0]}")` + +${BASE_DIR}/install_d0.sh && \ +${BASE_DIR}/install_s0.sh && \ +${BASE_DIR}/install_s1.sh && \ +${BASE_DIR}/install_s2.sh diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install_d0.sh b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install_d0.sh new file mode 100755 index 0000000..10315b7 --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install_d0.sh @@ -0,0 +1,121 @@ +#! /bin/bash -e + +# +# Setup ZFS pool +# + +export BASE_DIR=`dirname $(readlink -f "${BASH_SOURCE[0]}")` + +source "${BASE_DIR}/install.cfg" + +source "${BASE_DIR}/common.sh" + +export ZFS_COMPRESSION_METHOD=${ZFS_COMPRESSION_METHOD:-lz4} + +modprobe zfs + +# If you are re-using a MDADM disk, clear it as necessary: +# +# If the disk was previously used in an MD array, zero the superblock: +#apt install --yes mdadm +#mdadm --zero-superblock --force /dev/disk/by-id/$DISK1 +#mdadm --zero-superblock --force /dev/disk/by-id/$DISK2 +#mdadm --zero-superblock --force /dev/disk/by-id/$DISK3 + +# Clear the partition table: +sgdisk --zap-all /dev/disk/by-id/$DISK1 +sgdisk --zap-all /dev/disk/by-id/$DISK2 +sgdisk --zap-all /dev/disk/by-id/$DISK3 +sync + +# 2.2 Partition your disk: +# +# We assume advanced format: 4096 bytes per sector, 8 multiple +# +# Legacy (BIOS) booting (part-1): Used for GRUB boot-code in 'MBR-gap': +sgdisk -a1 -n1:40:8191 -t1:EF02 /dev/disk/by-id/$DISK1 +sgdisk -a1 -n1:40:8191 -t1:EF02 /dev/disk/by-id/$DISK2 +sgdisk -a1 -n1:40:8191 -t1:EF02 /dev/disk/by-id/$DISK3 +sync + +# ZFS partition: Remainder +sgdisk -n2:0:0 -t2:BF01 /dev/disk/by-id/$DISK1 +sgdisk -n2:0:0 -t2:BF01 /dev/disk/by-id/$DISK2 +sgdisk -n2:0:0 -t2:BF01 /dev/disk/by-id/$DISK3 +sync + +sleep 3 +sync + +## +## Create POOL +## + +mkdir -p ${ROOTFS_DIR} + +# +# Manually enabled ZFS features for GRUB compatibility! +# See https://wiki.archlinux.org/title/ZFS#GRUB-compatible_pool_creation +# Tested w/ Grub 2.04-19 +# +zpool create -f -o ashift=12 -o autoexpand=on \ + -O atime=off -O compression=off \ + -O mountpoint=/ -R ${ROOTFS_DIR} \ + -d \ + -o feature@allocation_classes=enabled \ + -o feature@async_destroy=enabled \ + -o feature@bookmarks=enabled \ + -o feature@embedded_data=enabled \ + -o feature@empty_bpobj=enabled \ + -o feature@enabled_txg=enabled \ + -o feature@extensible_dataset=enabled \ + -o feature@filesystem_limits=enabled \ + -o feature@hole_birth=enabled \ + -o feature@large_blocks=enabled \ + -o feature@log_spacemap=enabled \ + -o feature@lz4_compress=enabled \ + -o feature@project_quota=enabled \ + -o feature@resilver_defer=enabled \ + -o feature@spacemap_histogram=enabled \ + -o feature@spacemap_v2=enabled \ + -o feature@userobj_accounting=enabled \ + -o feature@zpool_checkpoint=enabled \ + \ + $POOL raidz2 \ + /dev/disk/by-id/$DISK1-part2 \ + /dev/disk/by-id/$DISK2-part2 \ + /dev/disk/by-id/$DISK3-part2 + +zpool autoexpand=on $POOL +zpool autoreplace=off $POOL +zpool listsnapshots=off $POOL + +zfs set dedup=off $POOL +zfs set compression=off $POOL +zfs set atime=off $POOL +zfs set mountpoint=none $POOL +zfs set aclinherit=passthrough $POOL +zfs set acltype=posixacl $POOL +zfs set xattr=sa $POOL + +# Create Dataset System Root +zfs create -o mountpoint=none $POOL/system +zfs create -o mountpoint=/ $POOL/system/debian +#zfs mount $POOL/system/debian +zpool set bootfs=$POOL/system/debian $POOL + +zfs create -o compression=${ZFS_COMPRESSION_METHOD} $POOL/system/debian/var + +# Create Datasets .. +zfs create -o mountpoint=/home $POOL/users +zfs create -o mountpoint=/root $POOL/users/root + +zfs create -o mountpoint=/backup -o compression=${ZFS_COMPRESSION_METHOD} $POOL/backup +zfs create -o mountpoint=/data $POOL/data +zfs create -o mountpoint=/srv $POOL/services +zfs create -o mountpoint=/usr/local/projects -o compression=${ZFS_COMPRESSION_METHOD} $POOL/projects + +## Export / Import ( '-d ..' also changes the dev names ) +##zpool export $POOL +##zpool import -d /dev/disk/by-id -R ${ROOTFS_DIR} $POOL + diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install_s0.sh b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install_s0.sh new file mode 100755 index 0000000..c2139ab --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install_s0.sh @@ -0,0 +1,103 @@ +#! /bin/bash -e + +## +## Prepare ROOT +## +## zfs root expected to be mounted on ${ROOTFS_DIR} +## + +export BASE_DIR=`dirname $(readlink -f "${BASH_SOURCE[0]}")` + +source "${BASE_DIR}/install.cfg" + +source "${BASE_DIR}/common.sh" + +if [ "${TARGET_ARCH}" != "amd64" ]; then + echo "ZFS install not supported on ARCH ${TARGET_ARCH}, only on amd64" + exit 2 +fi + +## +## stage0 bootstrap and initial setup +## + +bootstrap ${RELEASE} "${ROOTFS_DIR}" http://deb.debian.org/debian/ + +if [ "${IS_TESTING}" = "1" ]; then + install -m 644 files/sources-testing.list "${ROOTFS_DIR}/etc/apt/sources.list" +else + install -m 644 files/sources-stable.list "${ROOTFS_DIR}/etc/apt/sources.list" +fi +sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list" + +if [ -n "$APT_PROXY" ]; then + install -m 644 files/51cache "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" + sed "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" -i -e "s|APT_PROXY|${APT_PROXY}|" +else + rm -f "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" +fi + +on_chroot << EOF + if [ "${TARGET_ARCH}" = "arm64" ]; then + dpkg --add-architecture armhf + fi + apt-get update + apt-get dist-upgrade -y +EOF + +## +## stage0 setup locales and install kernel/firmware +## + +on_chroot << EOF + $(declare -f apt_install) + + # locales with pre-selection + debconf-set-selections <<SELEOF + $(cat "files/locale-debconf") +SELEOF + apt_install locales + + # firmware and kernel + apt_install gdisk build-essential dkms dpkg-dev linux-headers-${TARGET_ARCH} linux-image-${TARGET_ARCH} \ + amd64-microcode intel-microcode \ + atmel-firmware firmware-amd-graphics firmware-bnx2 firmware-bnx2x \ + firmware-brcm80211 firmware-intelwimax \ + firmware-iwlwifi firmware-libertas firmware-linux firmware-linux-free firmware-linux-nonfree \ + firmware-misc-nonfree firmware-myricom firmware-netxen firmware-qlogic firmware-realtek \ + bluez-firmware +EOF + +## +## stage0 ZFS package +## + +cp -a ${BASE_DIR}/../../zfs "${ROOTFS_DIR}/root/" + +on_chroot << EOF + # Build ZFS from scratch requirements + apt_install sysfsutils grub-pc \ + build-essential autoconf libtool gawk alien fakeroot gdebi linux-headers-amd64 \ + zlib1g-dev uuid-dev libattr1-dev libblkid-dev libselinux-dev libudev-dev libssl-dev parted lsscsi wget ksh gdebi \ + python3 python3-dev python3-setuptools python3-cffi python3-distutils + + # Replace Debian ZFS packages and replace with vanilla latest release + cd /root/zfs + . ./zfs-remove.sh + if [ "${RELEASE}" = "bullseye" ]; then + . ./zfs-install-debian11.sh + elif [ "${RELEASE}" = "buster" ]; then + . ./zfs-install-debian10.sh + else + echo "No ZFS packages provisioned for RELEASE ${RELEASE}" + exit 2 + fi + + cat ./apt-preferences.d-local-pin-init >> /etc/apt/preferences.d/local-pin-init + + systemctl enable zfs-import-cache.service zfs-mount.service zfs-zed.service zfs-import.target zfs-volumes.target zfs.target + systemctl start zfs-import-cache.service zfs-mount.service zfs-zed.service zfs-import.target zfs-volumes.target zfs.target + + zfs snapshot $POOL/system/debian@install_s0 +EOF + diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install_s1.sh b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install_s1.sh new file mode 100755 index 0000000..452f222 --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install_s1.sh @@ -0,0 +1,82 @@ +#! /bin/bash -e + +## +## Prepare ROOT +## +## zfs root expected to be mounted on ${ROOTFS_DIR} +## + +export BASE_DIR=`dirname $(readlink -f "${BASH_SOURCE[0]}")` + +source "${BASE_DIR}/install.cfg" + +source "${BASE_DIR}/common.sh" + +if [ "${TARGET_ARCH}" != "amd64" ]; then + echo "ZFS install not supported on ARCH ${TARGET_ARCH}, only on amd64" + exit 2 +fi + +## +## stage1 +## + +# fstab and user +install -v -m 644 files/fstab "${ROOTFS_DIR}/etc/fstab" + +on_chroot << EOF + if ! id -u ${FIRST_USER_NAME} >/dev/null 2>&1; then + adduser --disabled-password --gecos "" ${FIRST_USER_NAME} + fi + echo "${FIRST_USER_NAME}:${FIRST_USER_PASS}" | chpasswd + echo "root:root" | chpasswd +EOF + +# stage1 TCP/IP basic networking +on_chroot << EOF + $(declare -f apt_install) + + apt_install netbase ethtool +EOF +echo "${TARGET_HOSTNAME}" > "${ROOTFS_DIR}/etc/hostname" +echo "127.0.1.1 ${TARGET_HOSTNAME}" >> "${ROOTFS_DIR}/etc/hosts" + +ln -sf /dev/null "${ROOTFS_DIR}/etc/systemd/network/99-default.link" + +# stage1 essential packages +on_chroot << EOF + $(declare -f apt_install) + + debconf-set-selections <<SELEOF + $(cat "files/console-debconf") +SELEOF + + # Fundamentals + apt_install less sysfsutils grub-pc vim sharutils psmisc htop patch fbset sudo \ + console-setup keyboard-configuration debconf-utils parted unzip bash-completion \ + manpages-dev gdb pkg-config libstdc++6 python3-minimal strace \ + v4l-utils lua5.1 luajit hardlink ca-certificates \ + usbutils libfreetype6-dev dosfstools squashfs-tools fatattr \ + lzop apt-listchanges usb-modeswitch libmtp-runtime htop iotop powertop \ + man-db policykit-1 rng-tools ntfs-3g pciutils busybox initramfs-tools-core initramfs-tools + + # debootstrap requirements (pi-gen requirements on target for reproduction) + apt_install coreutils quilt parted qemu-user-static debootstrap zerofree zip dosfstools libarchive-tools libcap2-bin grep \ + xz-utils file git curl bc qemu-utils kpartx squashfs-tools fatattr + + # ensure sysfsutils is enabled at boot + systemctl is-enabled sysfsutils + + for GRP in input spi i2c gpio; do + groupadd -f -r "\$GRP" + done + for GRP in adm dialout cdrom audio users sudo video games plugdev input gpio spi i2c netdev; do + adduser $FIRST_USER_NAME \$GRP + done + + setupcon --force --save-only -v + usermod --pass='*' root + + zfs snapshot $POOL/system/debian@install_s1 +EOF + diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install_s2.sh b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install_s2.sh new file mode 100755 index 0000000..43d002f --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/install_s2.sh @@ -0,0 +1,178 @@ +#! /bin/bash -e + +## +## Prepare ROOT +## +## zfs root expected to be mounted on ${ROOTFS_DIR} +## + +export BASE_DIR=`dirname $(readlink -f "${BASH_SOURCE[0]}")` + +source "${BASE_DIR}/install.cfg" + +source "${BASE_DIR}/common.sh" + +if [ "${TARGET_ARCH}" != "amd64" ]; then + echo "ZFS install not supported on ARCH ${TARGET_ARCH}, only on amd64" + exit 2 +fi + +## +## stage2/02-net-tweaks +## + +on_chroot << EOF + $(declare -f apt_install) + + apt_install net-tools ifupdown dhcpcd5 avahi-daemon iftop \ + bluez \ + nfs-common autofs openssh-server ssh ssh-import-id rsync curl \ + wpasupplicant wireless-tools firmware-atheros firmware-brcm80211 firmware-libertas firmware-misc-nonfree firmware-realtek \ + rfkill +EOF + +if [ -n "${PUBKEY_SSH_FIRST_USER}" ]; then + install -v -m 0700 -o 1000 -g 1000 -d "${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.ssh + echo "${PUBKEY_SSH_FIRST_USER}" >"${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.ssh/authorized_keys + if [ -n "${PUBKEY2_SSH_FIRST_USER}" ]; then + echo "${PUBKEY2_SSH_FIRST_USER}" >>"${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.ssh/authorized_keys + fi + chown 1000:1000 "${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.ssh/authorized_keys + chmod 0600 "${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.ssh/authorized_keys +fi + +if [ "${PUBKEY_ONLY_SSH}" = "1" ]; then + sed -i -Ee 's/^#?[[:blank:]]*PubkeyAuthentication[[:blank:]]*no[[:blank:]]*$/PubkeyAuthentication yes/ +s/^#?[[:blank:]]*PasswordAuthentication[[:blank:]]*yes[[:blank:]]*$/PasswordAuthentication no/' "${ROOTFS_DIR}"/etc/ssh/sshd_config +fi + +install -m 644 files/network/ethN "${ROOTFS_DIR}/etc/network/interfaces.d/" +install -m 644 files/network/enN "${ROOTFS_DIR}/etc/network/interfaces.d/" + +install -v -d "${ROOTFS_DIR}/etc/wpa_supplicant" +install -v -m 600 files/wpa_supplicant.conf "${ROOTFS_DIR}/etc/wpa_supplicant/" + +echo "env force_hostname=YES" >> "${ROOTFS_DIR}/etc/dhcpcd.conf" + +if [ -v WPA_COUNTRY ]; then + echo "country=${WPA_COUNTRY}" >> "${ROOTFS_DIR}/etc/wpa_supplicant/wpa_supplicant.conf" +fi + +if [ -v WPA_ESSID ] && [ -v WPA_PASSWORD ]; then + on_chroot <<EOF + set -o pipefail + wpa_passphrase "${WPA_ESSID}" "${WPA_PASSWORD}" | tee -a "/etc/wpa_supplicant/wpa_supplicant.conf" +EOF +elif [ -v WPA_ESSID ]; then + cat >> "${ROOTFS_DIR}/etc/wpa_supplicant/wpa_supplicant.conf" << EOL + + network={ + ssid="${WPA_ESSID}" + key_mgmt=NONE + } +EOL +fi + +on_chroot << EOF + $(declare -f apt_install) + + # default off, user may enable .. + systemctl disable wpa_supplicant + systemctl mask wpa_supplicant + systemctl disable rsync + systemctl mask rsync + systemctl disable nfs-common + systemctl mask nfs-common + systemctl disable rpcbind + systemctl mask rpcbind + + if [ "${ENABLE_SSH}" == "1" ]; then + systemctl unmask ssh + systemctl enable ssh + else + systemctl disable ssh + systemctl mask ssh + fi + systemctl mask regenerate_ssh_host_keys + systemctl disable regenerate_ssh_host_keys + + systemctl unmask systemd-rfkill + systemctl enable systemd-rfkill + rfkill block all +EOF + +# +# stage2/03-set-timezone +# +echo "${TIMEZONE_DEFAULT}" > "${ROOTFS_DIR}/etc/timezone" +rm "${ROOTFS_DIR}/etc/localtime" + +on_chroot << EOF +dpkg-reconfigure -f noninteractive tzdata +EOF + +# +# stage2 conclusion +# +sed -i 's/#GRUB_TERMINAL=.*$/GRUB_TERMINAL=console/g' "${ROOTFS_DIR}/etc/default/grub" + +on_chroot << EOF + KVERSION=\$(ls /lib/modules/ | tail -n 1) + update-initramfs -u -k \${KVERSION} + + update-grub + grub-install /dev/disk/by-id/$DISK1 + grub-install /dev/disk/by-id/$DISK2 + grub-install /dev/disk/by-id/$DISK3 +EOF + + +# +# Complete Initial Installation +# + +on_chroot << EOF + # SWAP + zfs create -V $MYSWAPSIZE -b $(getconf PAGESIZE) -o compression=zle \ + -o logbias=throughput -o sync=always \ + -o primarycache=metadata -o secondarycache=none \ + -o com.sun:auto-snapshot=false $POOL/swap + + zfs set compression=zle $POOL/swap + zfs set logbias=throughput $POOL/swap + zfs set sync=always $POOL/swap + zfs set primarycache=metadata $POOL/swap + zfs set secondarycache=none $POOL/swap + zfs set com.sun:auto-snapshot=false $POOL/swap + zfs set checksum=off $POOL/swap + + mkswap -f /dev/zvol/$POOL/swap + echo /dev/zvol/$POOL/swap none swap defaults 0 0 >> /etc/fstab + # UUID=ee57ce05-7287-4b37-93c4-03aeaba756f1 + # /etc/fstab + # /dev/zvol/$POOL/swap none swap defaults 0 0 + # + swapon /dev/zvol/$POOL/swap + + # logrotate w/o compression (zfs is compressed) + for f in /etc/logrotate.d/* ; do + if grep -Eq "(^|[^#y])compress" "\$f" ; then + sed -i -r "s/(^|[^#y])(compress)/\1#\2/" "\$f" + fi + done + + # final update and snapshot + apt-get update + apt-get clean + + zfs snapshot $POOL/system/debian@install_s2 +EOF + +#umount -R /mnt/dev +#umount -R /mnt/proc +#umount -R /mnt/sys +cat /proc/mounts | awk '{print $2}' | grep "${ROOTFS_DIR}" | sort -r | xargs umount + +zfs unmount -a +zpool export $POOL + diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/new_disk.sh b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/new_disk.sh new file mode 100644 index 0000000..820fc6c --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/new_disk.sh @@ -0,0 +1,24 @@ + +NDISK1=ata-WDC_WD40EFZX-68AWUN0_WD-WX92DA0798JN +NDISK2=ata-WDC_WD40EFZX-68AWUN0_WD-WX92DA0791VU +NDISK3=ata-WDC_WD40EFZX-68AWUN0_WD-WX92DA02K427 + +# Clear the partition table: +sgdisk --zap-all /dev/disk/by-id/$NDISK1 +#sgdisk --zap-all /dev/disk/by-id/$NDISK2 +#sgdisk --zap-all /dev/disk/by-id/$NDISK3 + +# 2.2 Partition your disk: +# +# Run this if you need legacy (BIOS) booting: +sgdisk -a1 -n1:40:2047 -t1:EF02 /dev/disk/by-id/$NDISK1 +#sgdisk -a1 -n1:40:2047 -t1:EF02 /dev/disk/by-id/$NDISK2 +#sgdisk -a1 -n1:40:2047 -t1:EF02 /dev/disk/by-id/$NDISK3 + +#Run these in all cases: +sgdisk -n2:0:0 -t2:BF01 /dev/disk/by-id/$NDISK1 +#sgdisk -n2:0:0 -t2:BF01 /dev/disk/by-id/$NDISK2 +#sgdisk -n2:0:0 -t2:BF01 /dev/disk/by-id/$NDISK3 + +echo "Now replace the disk .." +echo "zpool replace risa 12458555210078177352 /dev/disk/by-id/ata-WDC_WD40EFZX-68AWUN0_WD-WX92DA0798JN-part1" diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/rescue00.sh b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/rescue00.sh new file mode 100644 index 0000000..233529e --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/rescue00.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +export ROOTFS_DIR="/mnt" +export POOL=tpool diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/rescue01.sh b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/rescue01.sh new file mode 100644 index 0000000..4c2440b --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/rescue01.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +export BASE_DIR=`dirname $(readlink -f "${BASH_SOURCE[0]}")` + +source "${BASE_DIR}/rescue00.sh" + +zpool import -f -R ${ROOTFS_DIR} ${POOL} diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/rescue02.sh b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/rescue02.sh new file mode 100644 index 0000000..87d2406 --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/rescue02.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +export BASE_DIR=`dirname $(readlink -f "${BASH_SOURCE[0]}")` + +source "${BASE_DIR}/rescue00.sh" + +source "${BASE_DIR}/common.sh" + +on_chroot -c "bash --login" + diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/rescue03.sh b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/rescue03.sh new file mode 100644 index 0000000..439e6f2 --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/rescue03.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +export BASE_DIR=`dirname $(readlink -f "${BASH_SOURCE[0]}")` + +source "${BASE_DIR}/rescue00.sh" + +cat /proc/mounts | awk '{print $2}' | grep "${ROOTFS_DIR}" | sort -r | xargs umount diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/sh-zfs-arc.sh b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/sh-zfs-arc.sh new file mode 100644 index 0000000..fe359af --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/sh-zfs-arc.sh @@ -0,0 +1,25 @@ +# 21474836480 # 0x500000000 (20 GB) +# 17179869184 # 0x400000000 (16 GB) +# 12884901888 # 0x300000000 (12 GB) +# 8589934592 # 0x200000000 ( 8 GB) +# 6442450944 # 0x180000000 ( 6 GB) +# 5368709120 # 0x140000000 ( 5 GB) +# 4294967296 # 0x100000000 ( 4 GB) +# 1073741824 # 0x040000000 ( 1 GB) +# 536870912 # 0x020000000 (.5 GB) + +# 4294967296 # 0x100000000 ( 4 GB) +echo options zfs zfs_arc_max=4294967296 >> /etc/modprobe.d/zfs.conf +echo zfs zfs_arc_max=4294967296 >> /etc/initramfs-tools/modules +#echo zfs zfs_arc_max=4294967296 >> /etc/modules + +# 5368709120 # 0x140000000 ( 5 GB) +echo options zfs zfs_arc_max=4294967296 >> /etc/modprobe.d/zfs.conf +echo zfs zfs_arc_max=4294967296 >> /etc/initramfs-tools/modules +#echo zfs zfs_arc_max=4294967296 >> /etc/modules + +# 17179869184 # 0x400000000 (16 GB) +echo options zfs zfs_arc_max=17179869184 >> /etc/modprobe.d/zfs.conf +echo zfs zfs_arc_max=17179869184 >> /etc/initramfs-tools/modules +#echo zfs zfs_arc_max=17179869184 >> /etc/modules + diff --git a/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/zfs-zap-disk.txt b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/zfs-zap-disk.txt new file mode 100644 index 0000000..72185e8 --- /dev/null +++ b/stage_rescuezfs/00-install-zfs/files/zfs/bootstrap/zfs-zap-disk.txt @@ -0,0 +1,27 @@ +#! /bin/sh + +strace -e pread64 zdb -l /dev/sdl >/dev/null +pread64(5, "\0\1\0\0\0\0\0\0\1\0\0\0000\0\0\0\7\0\0\0\1\0\0\0\23\0\0\0doze"..., 13920, 0) = 13920 +pread64(5, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 262144, 0) = 262144 +pread64(5, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 262144, 262144) = 262144 +pread64(5, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 262144, 16000900136960) = 262144 +pread64(5, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 262144, 16000900399104) = 262144 ++++ exited with 2 +++ +[root@fs01 etc]# for f in 0 262144 16000900136960 16000900399104; do dd if=/dev/zero of=/dev/sdl bs=1 seek=$f count=262144; done +[root@fs01 etc]# for f in 0 262144 4000785367040 4000785629184; do dd if=/dev/zero of=/dev/disk/by-id/ata-WDC_WD40EFZX-68AWUN0_WD-WX92DA0798JN-part2 bs=1 seek=$f count=262144; done +262144+0 records in +262144+0 records out +262144 bytes (262 kB, 256 KiB) copied, 0.507745 s, 516 kB/s +262144+0 records in +262144+0 records out +262144 bytes (262 kB, 256 KiB) copied, 0.508549 s, 515 kB/s +262144+0 records in +262144+0 records out +262144 bytes (262 kB, 256 KiB) copied, 0.499234 s, 525 kB/s +262144+0 records in +262144+0 records out +262144 bytes (262 kB, 256 KiB) copied, 0.496669 s, 528 kB/s + +[root@fs01 etc]# partprobe /dev/sdl +### LSBLK shows sdl has no partitions, so far so good + |