This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tips:zfs [2017/08/31 10:01] – [libvirt] scipio | tips:zfs [2023/01/18 11:22] (current) – sscipioni | ||
|---|---|---|---|
| Line 36: | Line 36: | ||
| zpool create lxd /dev/sda4 | zpool create lxd /dev/sda4 | ||
| </ | </ | ||
| + | |||
| + | ===== docker ===== | ||
| + | |||
| + | < | ||
| + | systemctl stop docker | ||
| + | rm -fR / | ||
| + | zfs create -o mountpoint=/ | ||
| + | zfs create -o mountpoint=/ | ||
| + | systemctl start docker | ||
| + | </ | ||
| + | |||
| + | / | ||
| + | < | ||
| + | { | ||
| + | " | ||
| + | [ | ||
| + | {" | ||
| + | ], | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | } | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| ===== libvirt ===== | ===== libvirt ===== | ||
| Line 41: | Line 68: | ||
| add ZFS pool to libvirt | add ZFS pool to libvirt | ||
| < | < | ||
| + | # in bionic | ||
| + | apt install libvirt-daemon-driver-storage-zfs && systemctl restart libvirtd | ||
| + | |||
| # create zfs filesystem | # create zfs filesystem | ||
| zfs create rpool/ | zfs create rpool/ | ||
| - | virsh pool-define-as --name zfspool --source-name rpool --type zfs | + | virsh pool-define-as --name zfspool --source-name rpool/ |
| virsh pool-start zfspool | virsh pool-start zfspool | ||
| virsh pool-autostart zfspool | virsh pool-autostart zfspool | ||
| Line 57: | Line 87: | ||
| < | < | ||
| virsh vol-delete --pool zfspool maas2 | virsh vol-delete --pool zfspool maas2 | ||
| + | </ | ||
| + | |||
| + | add volume to instance | ||
| + | |||
| + | create file mydevice.xml | ||
| + | < | ||
| + | <disk type=' | ||
| + | <driver name=' | ||
| + | <source dev='/ | ||
| + | <target dev=' | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | add volume | ||
| + | < | ||
| + | virsh attach-device --config juju-controller mydevice.xml | ||
| </ | </ | ||
| Line 66: | Line 112: | ||
| </ | </ | ||
| + | create vmdk file that point / | ||
| + | < | ||
| + | VBoxManage internalcommands createrawvmdk -filename / | ||
| + | </ | ||
| + | |||
| + | now use / | ||
| ===== tuning ===== | ===== tuning ===== | ||
| Line 108: | Line 160: | ||
| destination volume cannot be exists | destination volume cannot be exists | ||
| <code bash> | <code bash> | ||
| - | zfs snap storage/ | ||
| zfs send -R storage/ | zfs send -R storage/ | ||
| # zfs destroy storage/ | # zfs destroy storage/ | ||
| Line 123: | Line 174: | ||
| </ | </ | ||
| + | ==== syncoid ==== | ||
| + | |||
| + | * https:// | ||
| + | |||
| + | < | ||
| + | apt install pv lzop mbuffer | ||
| + | wget https:// | ||
| + | chmod +x / | ||
| + | </ | ||
| + | |||
| + | using from server zfs1 (to server zfs2) | ||
| + | < | ||
| + | syncoid rpool/ | ||
| + | </ | ||
| ===== incremental backup ===== | ===== incremental backup ===== | ||
| Line 149: | Line 214: | ||
| - | ===> CRYPTOLOCKER grows SNAP | + | ------> CRYPTOLOCKER grows SNAP |
| check crypto locker every day | check crypto locker every day | ||
| Line 162: | Line 227: | ||
| fi | fi | ||
| </ | </ | ||
| + | |||
| + | ===== swap ===== | ||
| + | |||
| + | < | ||
| + | zfs create -V 4G -b $(getconf PAGESIZE) -o compression=zle \ | ||
| + | -o logbias=throughput -o sync=always \ | ||
| + | -o primarycache=metadata -o secondarycache=none \ | ||
| + | -o com.sun: | ||
| + | |||
| + | mkswap -f / | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | echo / | ||
| + | swapon -av | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||