Outils pour utilisateurs

Outils du site


public:a_perfect_btrfs_server

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
public:a_perfect_btrfs_server [2018/01/11 15:55] adminpublic:a_perfect_btrfs_server [2021/11/19 08:56] (Version actuelle) – [Initialize LXD] pcouderc
Ligne 40: Ligne 40:
 </code> </code>
  
-===== Update init system =====+===== Various inits  =====
  
-... to allow boot in case of failure of one disk of the RAID1. +I suggest to modify les logs dans /etc/systemd/journald.conf :
- +
-Include 'degraded' option in GRUB_CMDLINE_LINUX in /etc/grub.d/10_linux  :+
 <code> <code>
-GRUB_CMDLINE_LINUX="rootflags=degraded,subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}" +Storage=persistent
-</code> +
-Then : +
-<code> +
-update-grub +
-grub-install /dev/sda1 +
-grub-install /dev/sdb1 +
-</code> +
-And too replace "default" options with "degraded,noatime,nodiratime,subvol=@" in btrfs line in /etc/fstab : +
-<code> +
-UUID=...   / btrfs   degraded,noatime,nodiratime,subvol=@    0+
 </code> </code>
 +See : https://guillaume.fenollar.fr/blog/journald-tutoriel-journald-journalctl/
  
 ==== Add zram based swap ==== ==== Add zram based swap ====
  
-Ubuntu policy is to assign half of the memory to swap and divide it by the the number of CPU hearts. This is done by zram-config which is not available in debian. I have choosen : +Ubuntu policy is to assign half of the memory to swap and divide it by the the number of CPU hearts.
 <code> <code>
-git  clone https://github.com/Jiab77/systemd-zram +apt install zram-tools
-cd systemd-zram +
-./install.sh+
 </code> </code>
-Here you can modify /etc/systemd/zram.conf from 33% to 50 for next reboot...+You should  modify ALLOCATION to 33-50% or total RAM in /etc/default/zramswap 
  
-apt install bc, in order to get /use/sbin/zramstat ok. 
 ===== Install lxd ===== ===== Install lxd =====
  
Ligne 87: Ligne 73:
 auto lo auto lo
 iface lo inet loopback iface lo inet loopback
 +
 +
  
 # The primary network interface # The primary network interface
 +auto enps5s0
 +iface enp5s0 inet manual
 +
 +
 auto br0 auto br0
 iface br0 inet static iface br0 inet static
Ligne 103: Ligne 95:
 </code> </code>
  
-==== Install lxd ==== +==== Install lxd from snap ====
-It is [[https://forum.snapcraft.io/t/disabling-automatic-refresh-for-snap-from-store/707/73|discussed]] whether installing lxd with snap is a good solution. Currently, I have choosen to [[https://github.com/lxc/lxd/|install from the sources]]. +
  
-=== From sources === 
- 
-In your home directory (not root) : 
- 
- 
-<code> 
-cd ~ 
-apt install acl dnsmasq-base git golang liblxc1 lxc-dev libacl1-dev make pkg-config rsync squashfs-tools tar xz-utils 
-mkdir -p ~/go 
-export GOPATH=~/go 
-go get -d -v github.com/lxc/lxd/lxd 
-cd $GOPATH/src/github.com/lxc/lxd 
-make 
-cd $GOPATH/bin 
-mv lxc /usr/local/bin 
-mv lxc /usr/local/bin 
-echo "root:1000000:65536" | sudo tee -a /etc/subuid /etc/subgid 
-sudo -E /user/local/bin/lxd --group sudo 
-</code> 
- 
-Then initialize lxd below. 
- 
-=== with snap === 
-All this can be simplified installing lxd via snap: 
  
 <code> <code>
Ligne 151: Ligne 118:
 <code> <code>
 lxc launch images:debian/stretch debian lxc launch images:debian/stretch debian
 +lxc config device  override debian eth0 hwaddr=02:1E:62:00:00:36 (recommended)
 +lxc config set  debian  volatile.eth0.hwaddr  00:1e:62:00:00:43 (not recommended)
 +
 lxc start debian lxc start debian
 lxc exec  debian bash lxc exec  debian bash
Ligne 157: Ligne 127:
 It is possible to choose to work as root in the containers as they are isolated from the host. It is possible to choose to work as root in the containers as they are isolated from the host.
  
-Without snap, to keep lxd permanent, I did reboot and create  +====  Containers LXD ==== 
- a /etc/systemd/system/lxd.service :+=== Backup === 
 +<code>
  
 +lxc export pgsql /media/lxd_containers/pgsql2020_01_12.tar.gz
 +</code>
 +After import, the container is on stopped state :
 <code> <code>
-[Unit] +lxc import  /media/lxd_containers/pgsql2020_01_12.tar.gz 
-Description=LXD - main daemon +</code>
-After=lxcfs.service +
-Requires=lxcfs.service+
  
-[Service] +=== Use simple mail in server or containers === 
-EnvironmentFile=-/etc/environment +== nullmailler == 
-ExecStartPre=/usr/lib/x86_64-linux-gnu/lxc/lxc-apparmor-load +Bien 
-ExecStart=/usr/local/bin/lxd --group sudo   --logfile=/var/log/lxd/lxd.log +== msmtp ==
-ExecStartPost=/usr/local/bin/lxd waitready --timeout=600 +
-KillMode=process +
-TimeoutStartSec=600s +
-TimeoutStopSec=30s +
-Restart=on-failure +
-LimitNOFILE=1048576 +
-LimitNPROC=infinity +
-TasksMax=infinity+
  
-[Install] +<code> 
-WantedBy=multi-user.target +apt install msmtp msmtp-mta 
-Alias=lxd.service+</code>
  
 +Et /etc/msmtprc :
 +
 +<code>
 +account default
 +host 192.168.13.36
 +auto_from off
 +from container_name@couderc.eu
 +syslog LOG_MAIL
 </code> </code>
  
-This service must be started.+== Data access == 
 +<code> 
 +/var/snap/lxd/common/mntns/var/snap/lxd/common/lxd/storage-pools/default/containers/ 
 +</code> 
 +===== Maintenance =====
  
 +In case of failure, prevent the problem by having a 3rd empty disk ready...
 +
 +To replace :
 +
 +<code>
 +btrfs fi show
 +btrfs replace start -rf /dev/sdb2 /dev/sda2 /
 +</code>
  
public/a_perfect_btrfs_server.1515686126.txt.gz · Dernière modification : 2018/01/11 15:55 de admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki