kemonine
/
lollipopcloud
Archived
1
0
Fork 0

Add notes on zfs and moving /var/log for advanced and storage focused users

This commit is contained in:
KemoNine 2019-04-12 00:48:37 +01:00
parent aee0076840
commit 4bb18645e5
No known key found for this signature in database
GPG Key ID: 3BC2928798AE11AB
2 changed files with 133 additions and 0 deletions

26
advanced/var_log_move.md Normal file
View File

@ -0,0 +1,26 @@
# Move ```/var/log```
You can disable logging to ram by setting `ENABLED=false´ in `/etc/default/armbian-ramlog´.
``` bash
systemctl stop rsyslog.service
systemctl stop syslog.socket
lsof /var/log # (make sure it's empty)
systemctl stop log2ram
systemctl disable log2ram
systemctl stop armbian-ramlog.service
systemctl disable armbian-ramlog.service
systemctl stop armbian-zram-config.service
systemctl disable armbian-zram-config.service
nano -w /etc/default/armbian-ramlog
# Disable
nano -w /etc/default/armbian-zram-config
# Disable if *not* using swap in ram
mv /var/log /var/oldlog
mkdir /var/log
rsync -aPr /var/oldlog/ /var/log/
systemctl reboot
```

107
advanced/zfs.md Normal file
View File

@ -0,0 +1,107 @@
# ZFS
How to setup zfs on 64 bit arm boards.
*Note: this is wholly untested and likely to be broken on 32 bit arm boards*
## Initial Install / Setup
``` bash
apt-add-repository universe
apt install zfs-dkms spl-dkms zfsutils-linux
cat > /etc/modprobe.d/zfs.conf <<EOF
# Minimize RAM pain
#options zfs zfs_arc_max=268435456 zfs_arc_meta_limit=201326592
options zfs zfs_arc_max=134217728 zfs_arc_meta_limit=67108864
#options zfs zfs_arc_max=100663296 zfs_arc_meta_limit=50331648
EOF
```
## Disk Setup and Pool Creation
Partition the disk and setup the zfs pool with basic settings
``` bash
parted /dev/disk/by-id/ata-Samsung_Portable_SSD_T5_S3UKNP0K601164R
mklabel gpt
mkpart
zpool create -o ashift=12 \
-O copies=2 \
-O atime=off -O compression=lz4 \
-O normalization=formD \
tank \
/dev/disk/by-id/usb-JMicron_Tech_0000000055A1-0\:0-part1
zpool status
cat /sys/module/zfs/parameters/zfs_arc_max
cat /sys/module/zfs/parameters/zfs_arc_meta_limit
```
## zfs Backed Swap
Move swap from zram to zfs volumes on disk
``` bash
zfs create tank/swap
zfs create -V 1G -b $(getconf PAGESIZE) -o compression=zle \
-o logbias=throughput -o sync=always \
-o primarycache=metadata -o secondarycache=none \
-o com.sun:auto-snapshot=false tank/swap/swap.1
zfs create -V 1G -b $(getconf PAGESIZE) -o compression=zle \
-o logbias=throughput -o sync=always \
-o primarycache=metadata -o secondarycache=none \
-o com.sun:auto-snapshot=false tank/swap/swap.2
mkswap -f /dev/zvol/tank/swap/swap.1
mkswap -f /dev/zvol/tank/swap/swap.2
echo /dev/zvol/tank/swap/swap.1 none swap defaults 0 0 >> /etc/fstab
echo /dev/zvol/tank/swap/swap.2 none swap defaults 0 0 >> /etc/fstab
swapon -af
nano -w /etc/fstab # Add above swap and remove exiting ones
nano -w /etc/default/armbian-zram-config
# Disabe if NOT using /var/log in RAM
```
## Regular scrubs and integrity checks
``` bash
crontab -e
22 0 14 * * /sbin/zpool scrub tank
```
## Bulk storage and Samba filesystem shares
``` bash
# Samba toolchain
apt install samba tdb-tools
# Samba user setup
useradd -g users -s /usr/sbin/nologin [username]
passwd [username]
smbpasswd -a [username]
nano -w /etc/samba/smb.conf
workgroup = non-default
comment out all share definitions
systemctl restart smbd
# Bulk storage for all the things
zfs create -o sharesmb=on tank/downloads
zfs create -o sharesmb=on tank/scratch
cat /var/lib/samba/usershares/*
```