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/12/15 18:21] – 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. | ||
| - | === Backup containers | + | ==== Containers |
| - | + | === Backup === | |
| - | Store image : | + | |
| < | < | ||
| - | lxc stop pgsql | + | lxc export |
| - | lxc publish pgsql --alias pgsqlTC12 | + | |
| - | lxc start pgsql | + | |
| - | lxc export pgsqlTC12 . | + | |
| - | mv xxxxxxx.tar.gz pgsqlYC12.tar.gz | + | |
| </ | </ | ||
| - | Restore non testé | + | After import, the container is on stopped state : |
| < | < | ||
| - | lxc image import | + | lxc import |
| - | lxc init my-export NEW-CONTAINER | + | |
| </ | </ | ||
| + | === Use simple mail in server or containers === | ||
| + | == nullmailler == | ||
| + | Bien | ||
| + | == msmtp == | ||
| - | === Without snap === | + | < |
| + | apt install msmtp msmtp-mta | ||
| + | </ | ||
| + | Et / | ||
| - | Without snap, to keep lxd permanent, I did reboot and create | + | < |
| - | a / | + | account default |
| + | host 192.168.13.36 | ||
| + | auto_from off | ||
| + | from container_name@couderc.eu | ||
| + | syslog LOG_MAIL | ||
| + | </ | ||
| + | == Data access == | ||
| < | < | ||
| - | [Unit] | + | / |
| - | Description=LXD | + | </ |
| - | After=lxcfs.service | + | ===== Maintenance ===== |
| - | Requires=lxcfs.service | + | |
| - | [Service] | + | In case of failure, prevent the problem by having a 3rd empty disk ready... |
| - | EnvironmentFile=-/ | + | |
| - | ExecStartPre=/ | + | |
| - | ExecStart=/ | + | |
| - | ExecStartPost=/ | + | |
| - | KillMode=process | + | |
| - | TimeoutStartSec=600s | + | |
| - | TimeoutStopSec=30s | + | |
| - | Restart=on-failure | + | |
| - | LimitNOFILE=1048576 | + | |
| - | LimitNPROC=infinity | + | |
| - | TasksMax=infinity | + | |
| - | [Install] | + | To replace : |
| - | WantedBy=multi-user.target | + | |
| - | Alias=lxd.service | + | |
| + | < | ||
| + | btrfs fi show | ||
| + | btrfs replace start -rf /dev/sdb2 /dev/sda2 / | ||
| </ | </ | ||
| - | |||
| - | This service must be started. | ||
| - | |||
public/a_perfect_btrfs_server.1576434086.txt.gz · Dernière modification : de pcouderc
