public:a_perfect_btrfs_server
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| public:a_perfect_btrfs_server [2018/07/21 17:01] – [Add zram based swap] pcouderc | public:a_perfect_btrfs_server [2021/11/19 08:56] (Version actuelle) – [Initialize LXD] pcouderc | ||
|---|---|---|---|
| Ligne 40: | Ligne 40: | ||
| </ | </ | ||
| - | ===== Update init system | + | ===== Various inits |
| - | ... to allow boot in case of failure of one disk of the RAID1. | + | I suggest |
| - | + | ||
| - | Include ' | + | |
| < | < | ||
| - | GRUB_CMDLINE_LINUX=" | + | Storage=persistent |
| - | </ | + | |
| - | Then : | + | |
| - | < | + | |
| - | update-grub | + | |
| - | grub-install /dev/sda1 | + | |
| - | grub-install /dev/sdb1 | + | |
| - | </ | + | |
| - | And too replace " | + | |
| - | < | + | |
| - | UUID=... | + | |
| </ | </ | ||
| + | See : https:// | ||
| ==== 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. | + | Ubuntu policy is to assign half of the memory to swap and divide it by the the number of CPU hearts. |
| < | < | ||
| - | git clone https:// | + | apt install |
| - | cd systemd-zram | + | |
| - | ./ | + | |
| </ | </ | ||
| - | Here you can modify /etc/systemd/zram.conf from 33% to 50 for next reboot... | + | You should |
| - | apt install bc, in order to get / | ||
| ===== 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: | ||
| </ | </ | ||
| - | ==== Install lxd ==== | + | ==== Install lxd from snap ==== |
| - | It is [[https:// | + | |
| - | === From sources === | ||
| - | |||
| - | In your home directory (not root) : | ||
| - | |||
| - | |||
| - | < | ||
| - | 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/ | ||
| - | cd $GOPATH/ | ||
| - | make | ||
| - | cd $GOPATH/bin | ||
| - | mv lxc / | ||
| - | mv lxc / | ||
| - | echo " | ||
| - | sudo -E / | ||
| - | </ | ||
| - | |||
| - | Then initialize lxd below. | ||
| - | |||
| - | === with snap === | ||
| - | All this can be simplified installing lxd via snap: | ||
| < | < | ||
| Ligne 151: | Ligne 118: | ||
| < | < | ||
| lxc launch images: | lxc launch images: | ||
| + | lxc config device | ||
| + | lxc config set debian | ||
| + | |||
| 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 / | + | === Backup === |
| + | < | ||
| + | lxc export pgsql / | ||
| + | </ | ||
| + | After import, the container is on stopped state : | ||
| < | < | ||
| - | [Unit] | + | lxc import |
| - | Description=LXD - main daemon | + | </ |
| - | After=lxcfs.service | + | |
| - | Requires=lxcfs.service | + | |
| - | [Service] | + | === Use simple mail in server or containers |
| - | EnvironmentFile=-/ | + | == nullmailler |
| - | ExecStartPre=/ | + | Bien |
| - | ExecStart=/ | + | == msmtp == |
| - | ExecStartPost=/ | + | |
| - | KillMode=process | + | |
| - | TimeoutStartSec=600s | + | |
| - | TimeoutStopSec=30s | + | |
| - | Restart=on-failure | + | |
| - | LimitNOFILE=1048576 | + | |
| - | LimitNPROC=infinity | + | |
| - | TasksMax=infinity | + | |
| - | [Install] | + | < |
| - | WantedBy=multi-user.target | + | apt install msmtp msmtp-mta |
| - | Alias=lxd.service | + | </ |
| + | Et / | ||
| + | |||
| + | < | ||
| + | account default | ||
| + | host 192.168.13.36 | ||
| + | auto_from off | ||
| + | from container_name@couderc.eu | ||
| + | syslog LOG_MAIL | ||
| </ | </ | ||
| - | This service must be started. | + | == Data access == |
| + | < | ||
| + | / | ||
| + | </ | ||
| + | ===== Maintenance ===== | ||
| + | In case of failure, prevent the problem by having a 3rd empty disk ready... | ||
| + | |||
| + | To replace : | ||
| + | |||
| + | < | ||
| + | btrfs fi show | ||
| + | btrfs replace start -rf /dev/sdb2 /dev/sda2 / | ||
| + | </ | ||
public/a_perfect_btrfs_server.1532192507.txt.gz · Dernière modification : de pcouderc
