Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- sgdisk -Z -n9:-8M:0 -t9:bf07 -c9:sda9-Reserved -n1:1M:+512M -t1:EF00 -c1:sda1-EFI -n2:513M:+105G -t2:bf01 -c2:sda2-zfssytem /dev/sda
- sgdisk -Z -n9:-8M:0 -t9:bf07 -c9:sdb9-Reserved -n1:1M:+512M -t1:EF00 -c1:sdb1-EFI -n2:513M:+105G -t2:bf01 -c2:sdb2-zfssytem -n3:0:0 -t2:bf01 -c3:sdb3-zfsdata /dev/sdb
- sgdisk -Z -n9:-8M:0 -t9:bf07 -c9:sdc9-Reserved -n1:1M:+512M -t1:EF00 -c1:sdc1-EFI -n2:513M:+105G -t2:bf01 -c2:sdc2-zfssytem -n3:0:0 -t2:bf01 -c3:sdc3-zfsdata /dev/sdc
- cat /proc/partitions
- ls -lh /dev/disk/by-partlabel
- apt update
- apt -y install zfsutils-linux
- mkdir -p /target
- zpool create -f -o ashift=12 -O atime=off -O canmount=off -O compression=lz4 -O normalization=formD -O mountpoint=/ -R /target systempool mirror /dev/sda2 /dev/sdb2 /dev/sdc2
- zpool status
- zfs create -o canmount=off -o mountpoint=none systempool/ROOT
- zfs create -o canmount=noauto -o mountpoint=/ -o exec=on -o setuid=on -o devices=on systempool/ROOT/ubuntu
- zfs mount systempool/ROOT/ubuntu
- zpool set bootfs=systempool/ROOT/ubuntu systempool
- zfs set exec=off systempool
- zfs set setuid=off systempool
- zfs set devices=off systempool
- zfs create -o canmount=off systempool/var
- zfs create -o canmount=off systempool/var/lib
- zfs create systempool/var/lib/apt
- zfs create -o exec=on systempool/var/lib/dpkg
- zfs create systempool/var/log
- zfs create -o com.sun:auto-snapshot=false systempool/var/tmp
- zfs create -o com.sun:auto-snapshot=false systempool/var/cache
- zfs create -o com.sun:auto-snapshot=false systempool/var/cache/apt
- zfs create systempool/var/spool
- zfs create systempool/var/mail
- zfs create -o com.sun:auto-snapshot=false -o exec=on systempool/tmp
- zfs create -o exec=on systempool/root
- zfs create -o mountpoint=/home systempool/home
- zfs create -o mountpoint=/srv systempool/srv
- df -h
- zfs list
- chmod 1777 /target/tmp
- chmod 1777 /target/var/tmp
- apt -y install debootstrap
- debootstrap --include=zfsutils-linux bionic /target
- echo asztalos01 > /target/etc/hostname
- echo "127.0.1.1 asztalos01.matrixhome.lan asztalos01" >> /target/etc/hosts
- cat <<EOF > /target/etc/netplan/00-lan-config.yaml
- # This file is generated from information provided by
- # the datasource. Changes to it will not persist across an instance.
- # To disable cloud-init's network configuration capabilities, write a file
- # /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
- # network: {config: disabled}
- network:
- ethernets:
- enp2s0:
- dhcp4: true
- version: 2
- EOF
- cat <<EOF > /target/configure.sh
- #!/bin/bash
- apt update
- apt -y full-upgrade
- apt -y install language-pack-hu
- dpkg-reconfigure locales
- dpkg-reconfigure debconf
- dpkg-reconfigure tzdata
- apt install --yes hfsprogs
- apt install -y --no-install-recommends linux-image-generic
- apt install -y gdisk dosfstools zfs-initramfs
- apt -y install grub-efi
- apt install --yes grub-efi-amd64-signed shim-signed
- mkdosfs -F 32 -n EFI-SDA1 /dev/sda1
- mkdosfs -F 32 -n EFI-SDB1 /dev/sdb1
- mkdosfs -F 32 -n EFI-SDC1 /dev/sdc1
- mkdir /boot/efi
- # olds echo PARTUUID=$(blkid -s PARTUUID -o value /dev/disk/by-partlabel/sda1-EFI) /boot/efi vfat defaults 0 1 >> /etc/fstab
- echo PARTUUID=$(blkid -s PARTUUID -o value /dev/disk/by-partlabel/sda1-EFI) /boot/efi vfat nofail,x-systemd.device-timeout=1 0 1 >> /etc/fstab
- mount /boot/efi
- grub-probe /
- update-initramfs -u -k all
- update-grub
- grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu --recheck --no-floppy
- echo '\EFI\ubuntu\grubx64.efi' > /boot/efi/startup.nsh
- ls /boot/grub/*/zfs.mod
- apt -y ssh nano lshw rsync mc lswh ethtool di
- passwd root
- /bin/bash
- EOF
- cat <<EOF >> /etc/apt/sources.list
- #deb http://archive.ubuntu.com/ubuntu bionic main
- deb http://archive.ubuntu.com/ubuntu bionic-updates main
- deb http://security.ubuntu.com/ubuntu bionic-security main
- deb http://archive.ubuntu.com/ubuntu/ bionic universe
- deb http://archive.ubuntu.com/ubuntu/ bionic-updates universe
- deb http://security.ubuntu.com/ubuntu bionic-security universe
- EOF
- chmod +x /target/configure.sh
- mount --rbind /dev /target/dev
- mount --rbind /proc /target/proc
- mount --rbind /sys /target/sys
- chroot /target /bin/bash
- chroot /target /configure.sh
- ./configure.sh
- umount -Rfl /target/dev
- umount -Rfl /target/sys
- umount -Rfl /target/proc
- umount /target/boot/efi
- zpool export systempool
- echo DONE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement