Debian ROOT ZFS:

echo "deb stretch main contrib non-free” > /etc/apt/sources.list
echo “deb stretch/updates main contrib non-free” >> /etc/apt/sources.list
apt update
apt install openssh-server 
sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config
systemctl restart ssh
apt install --yes debootstrap gdisk linux-headers-$(uname -r) 
apt install --yes zfs-dkms
modprobe zfs
sgdisk --zap-all /dev/sda
sgdisk --zap-all /dev/sdb
sgdisk --zap-all /dev/sdc
sgdisk --zap-all /dev/sdd
sgdisk -a1 -n1:34:2047  -t1:EF02 /dev/sda
sgdisk  -n2:1M:+512M -t2:EF00 /dev/sda
sgdisk -n3:0:0 -t3:BF01 /dev/sda
sgdisk /dev/sda -R /dev/sdb
sgdisk -G /dev/sdb
sgdisk /dev/sda -R /dev/sdc
sgdisk /dev/sda -R /dev/sdd
sgdisk -G /dev/sdc
sgdisk -G /dev/sdd

zpool create -o ashift=12 -O atime=off -O canmount=off -O compression=lz4 -O normalization=formD -O mountpoint=/rpool -R /mnt rpool raidz2 /dev/sda3 /dev/sdb3 /dev/sdc3 /dev/sdd3

zfs create -o canmount=off -o mountpoint=none rpool/ROOT
zfs create -o canmount=noauto -o mountpoint=/ rpool/ROOT/pve-1
zfs mount rpool/ROOT/pve-1
zpool set bootfs=rpool/ROOT/pve-1 rpool
zfs create  rpool/data
mkdir -p /mnt/var/tmp
chmod 1777 /mnt/var/tmp
debootstrap stretch /mnt
zfs set devices=off rpool
echo pve > /mnt/etc/hostname

nano /mnt/etc/network/interfaces:

auto eno1
iface eno1 inet dhcp
mount --rbind /dev  /mnt/dev
mount --rbind /proc /mnt/proc
mount --rbind /sys  /mnt/sys
chroot /mnt /bin/bash --login
nano /etc/apt/sources.list 
deb stretch main contrib non-free
deb-src stretch main contrib non-free
deb stretch/updates main contrib non-free
ln -s /proc/self/mounts /etc/mtab
apt update
apt install --yes locales
dpkg-reconfigure locales

dpkg-reconfigure tzdata

apt install --yes gdisk linux-headers-$(uname -r) linux-image-amd64
apt install --yes zfs-dkms zfs-initramfs
modprobe zfs
apt install --yes dosfstools
mkdosfs -F 32 -n EFI /dev/sda2
mkdir /boot/efi
echo PARTUUID=$(blkid -s PARTUUID -o value  /dev/sda2)  /boot/efi vfat defaults 0 1 >> /etc/fstab
mount /boot/efi
apt install --yes grub-efi-amd64
grub-probe /
update-initramfs -u -k all

nano /etc/default/grub

Uncomment: GRUB_TERMINAL=console
Save and quit.

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=debian --recheck --no-floppy



mount | grep -v zfs | tac | awk '/\/mnt/ {print $3}' | xargs -i{} umount -lf {}

zpool export rpool



zfs create -V 8G -b $(getconf PAGESIZE) -o compression=zle -o logbias=throughput -o sync=always -o primarycache=metadata -o secondarycache=none -o com.sun:auto-snapshot=false rpool/swap

mkswap -f /dev/zvol/rpool/swap
echo /dev/zvol/rpool/swap none swap defaults 0 0 >> /etc/fstab
swapon -av

As /var/log is already compressed by ZFS, logrotate’s compression is going to burn CPU and disk I/O for (in most cases) very little gain. Also, if you are making snapshots of /var/log, logrotate’s compression will actually waste space, as the uncompressed data will live on in the snapshot. You can edit the files in /etc/logrotate.d by hand to comment out compress, or use this loop (copy-and-paste highly recommended):

for file in /etc/logrotate.d/* ; do
    if grep -Eq "(^|[^#y])compress" "$file" ; then
        sed -i -r "s/(^|[^#y])(compress)/\1#\2/" "$file"
Stránka naposled modifikovaná May 14, 2018, at 08:23 AM