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 [2020/01/04 21:52] 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.
  
-=== Backup containers LXD === +====  Containers LXD ==== 
- +=== Backup ===
-Store image :+
 <code> <code>
  
-lxc stop pgsql +lxc export pgsql /media/lxd_containers/pgsql2020_01_12.tar.gz
-lxc publish pgsql --alias pgsqlTC12 +
-lxc start pgsql +
-lxc export pgsqlTC12 . +
-mv xxxxxxx.tar.gz pgsqlYC12.tar.gz+
 </code> </code>
-Restore non testé :+After import, the container is on stopped state :
 <code> <code>
-lxc image import TARBALL --alias my-export +lxc import  /media/lxd_containers/pgsql2020_01_12.tar.gz
-lxc init my-export NEW-CONTAINER+
 </code> </code>
  
 +=== Use simple mail in server or containers ===
 +== nullmailler ==
 +Bien
 +== msmtp ==
  
-===  Without snap ===+<code> 
 +apt install msmtp msmtp-mta 
 +</code>
  
 +Et /etc/msmtprc :
  
-Without snap, to keep lxd permanent, I did reboot and create  +<code> 
- a /etc/systemd/system/lxd.service :+account default 
 +host 192.168.13.36 
 +auto_from off 
 +from container_name@couderc.eu 
 +syslog LOG_MAIL 
 +</code>
  
 +== Data access ==
 <code> <code>
-[Unit] +/var/snap/lxd/common/mntns/var/snap/lxd/common/lxd/storage-pools/default/containers/
-Description=LXD - main daemon +
-After=lxcfs.service +
-Requires=lxcfs.service +
- +
-[Service] +
-EnvironmentFile=-/etc/environment +
-ExecStartPre=/usr/lib/x86_64-linux-gnu/lxc/lxc-apparmor-load +
-ExecStart=/usr/local/bin/lxd --group sudo   --logfile=/var/log/lxd/lxd.log +
-ExecStartPost=/usr/local/bin/lxd waitready --timeout=600 +
-KillMode=process +
-TimeoutStartSec=600s +
-TimeoutStopSec=30s +
-Restart=on-failure +
-LimitNOFILE=1048576 +
-LimitNPROC=infinity +
-TasksMax=infinity +
- +
-[Install] +
-WantedBy=multi-user.target +
-Alias=lxd.service +
 </code> </code>
- 
-This service must be started. 
- 
 ===== Maintenance ===== ===== Maintenance =====
  
public/a_perfect_btrfs_server.1578174765.txt.gz · Dernière modification : 2020/01/04 21:52 de pcouderc

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki