====== 🔄 Ativar LVM automaticamente no boot do Proxmox VE ======
===== 📋 Visão Geral =====
Em alguns ambientes Proxmox VE, os volumes LVM podem não ficar ativos automaticamente após a inicialização do servidor.
Quando isso acontece, é necessário executar manualmente:
lvchange -ay pve/data_tdata
lvchange -ay pve/data_tmeta
lvchange -ay pve/data
Este procedimento cria um **serviço systemd** para executar automaticamente os três comandos durante o boot.
Após configurar o serviço, os volumes LVM serão ativados automaticamente durante a inicialização do Proxmox VE.
---
===== ⚠️ Antes de começar =====
Execute este procedimento somente se os volumes abaixo realmente existirem no seu ambiente:
pve/data_tdata
pve/data_tmeta
pve/data
Confirme com:
lvs
Exemplo esperado:
LV VG Attr
data pve ...
---
====== 🛠️ Procedimento ======
===== Etapa 1 — Criar o serviço systemd =====
No shell do Proxmox, execute:
nano /etc/systemd/system/lvm-pve-data.service
Cole exatamente:
[Unit]
Description=Ativar LVM pve/data no boot
After=local-fs-pre.target
Before=local-fs.target
[Service]
Type=oneshot
ExecStart=/sbin/lvchange -ay pve/data_tdata
ExecStart=/sbin/lvchange -ay pve/data_tmeta
ExecStart=/sbin/lvchange -ay pve/data
RemainAfterExit=yes
[Install]
WantedBy=local-fs.target
Salvar:
CTRL + O
ENTER
CTRL + X
---
===== Etapa 2 — Recarregar o systemd =====
Executar:
systemctl daemon-reload
---
===== Etapa 3 — Habilitar no boot =====
Executar:
systemctl enable lvm-pve-data.service
Resultado esperado:
Created symlink ...
O comando ''enable'' faz com que o serviço seja executado automaticamente em todos os próximos boots.
---
===== Etapa 4 — Testar sem reiniciar o servidor =====
Para testar imediatamente:
systemctl start lvm-pve-data.service
Verificar o status:
systemctl status lvm-pve-data.service
Resultado esperado:
Active: active (exited)
---
===== Etapa 5 — Confirmar os volumes ativos =====
Executar:
lvs
Também pode verificar diretamente:
lvdisplay pve/data
O volume deve aparecer como ativo.
---
====== 🔄 Teste após reboot ======
Após configurar o serviço, **não é necessário executar os comandos manualmente novamente**.
Ao reiniciar o Proxmox:
reboot
O systemd executará automaticamente:
lvchange -ay pve/data_tdata
lvchange -ay pve/data_tmeta
lvchange -ay pve/data
Depois que o servidor voltar, confirme:
lvs
E:
systemctl status lvm-pve-data.service
Resultado esperado:
Active: active (exited)
---
====== 🧪 Verificação rápida ======
Para verificar se o serviço está habilitado para iniciar automaticamente:
systemctl is-enabled lvm-pve-data.service
Resultado esperado:
enabled
Para verificar se os volumes estão ativos:
lvs
---
====== 🗑️ Remover a configuração ======
Caso seja necessário remover o serviço criado:
Desabilitar:
systemctl disable lvm-pve-data.service
Remover o arquivo:
rm /etc/systemd/system/lvm-pve-data.service
Recarregar o systemd:
systemctl daemon-reload
---
===== 📌 Resumo =====
O objetivo deste procedimento é fazer com que os três volumes sejam **ativados automaticamente durante o boot**:
pve/data_tdata
pve/data_tmeta
pve/data
Assim, não será necessário executar manualmente após cada reinicialização:
lvchange -ay pve/data_tdata
lvchange -ay pve/data_tmeta
lvchange -ay pve/data
Após configurar corretamente o serviço, o processo passa a ser automático no boot do Proxmox VE.