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/01/11 10:53] – [Add zram based swap] admin | 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 github.com/ | ||
- | cd $GOPATH/ | ||
- | make | ||
- | cd $GOPATH/bin | ||
- | </ | ||
- | I did move lxc,lxd to / | ||
- | |||
- | < | ||
- | [Unit] | ||
- | Description=LXD - main daemon | ||
- | After=lxcfs.service | ||
- | Requires=lxcfs.service | ||
- | |||
- | [Service] | ||
- | EnvironmentFile=-/ | ||
- | ExecStartPre=/ | ||
- | ExecStart=/ | ||
- | ExecStartPost=/ | ||
- | KillMode=process | ||
- | TimeoutStartSec=600s | ||
- | TimeoutStopSec=30s | ||
- | Restart=on-failure | ||
- | LimitNOFILE=1048576 | ||
- | LimitNPROC=infinity | ||
- | TasksMax=infinity | ||
- | |||
- | [Install] | ||
- | WantedBy=multi-user.target | ||
- | Alias=lxd.service | ||
- | |||
- | </ | ||
- | |||
- | === with snap === | ||
- | All this can be simplified installing lxd via snap: | ||
< | < | ||
Ligne 171: | 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 177: | 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. | ||
+ | ==== Containers LXD ==== | ||
+ | === Backup === | ||
+ | < | ||
+ | lxc export pgsql / | ||
+ | </ | ||
+ | After import, the container is on stopped state : | ||
+ | < | ||
+ | lxc import | ||
+ | </ | ||
+ | === Use simple mail in server or containers === | ||
+ | == nullmailler == | ||
+ | Bien | ||
+ | == msmtp == | ||
+ | < | ||
+ | apt install msmtp msmtp-mta | ||
+ | </ | ||
+ | Et / | ||
+ | < | ||
+ | account default | ||
+ | host 192.168.13.36 | ||
+ | auto_from off | ||
+ | from container_name@couderc.eu | ||
+ | syslog LOG_MAIL | ||
+ | </ | ||
+ | |||
+ | == 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.txt · Dernière modification : 2021/11/19 08:56 de pcouderc