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 [2019/08/29 06:38] – 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=" | + | |
- | </ | + | |
- | Then : | + | |
- | < | + | |
- | update-grub | + | |
- | grub-install /dev/sda1 | + | |
- | grub-install /dev/sdb1 | + | |
- | </ | + | |
- | And too replace " | + | |
< | < | ||
- | UUID=... / btrfs | + | Storage=persistent |
</ | </ | ||
+ | See : https:// | ||
==== Add zram based swap ==== | ==== Add zram based swap ==== | ||
Ligne 106: | 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 154: | 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 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 / | + | === 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.1567060682.txt.gz · Dernière modification : 2019/08/29 06:38 de pcouderc