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 [2019/08/29 06:38] pcoudercpublic: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> +
-GRUB_CMDLINE_LINUX="rootflags=degraded,subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}" +
-</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> <code>
-UUID=...   / btrfs   degraded,noatime,nodiratime,subvol=@    0+Storage=persistent
 </code> </code>
 +See : https://guillaume.fenollar.fr/blog/journald-tutoriel-journald-journalctl/
  
 ==== Add zram based swap ==== ==== Add zram based swap ====
Ligne 106: 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 154: 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 160: 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.1567060682.txt.gz · Dernière modification : 2019/08/29 06:38 de pcouderc

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki