AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / unix / Perguntas / 513969
Accepted
Yurij Goncharuk
Yurij Goncharuk
Asked: 2019-04-24 00:36:47 +0800 CST2019-04-24 00:36:47 +0800 CST 2019-04-24 00:36:47 +0800 CST

Maneira correta de ativar a partição LVM no multipath durante a inicialização

  • 772

Eu tenho o Debian 9 com iSCSI e multipath configurados com sucesso:

# multipath -ll /dev/mapper/mpathb
mpathb (222c60001556480c6) dm-2 Promise,Vess R2600xi
size=10T features='1 retain_attached_hw_handler' hwhandler='0' wp=rw
|-+- policy='service-time 0' prio=1 status=active
| `- 12:0:0:0 sdc 8:32 active ready running
`-+- policy='service-time 0' prio=1 status=enabled
  `- 13:0:0:0 sdd 8:48 active ready running

/dev/mapper/mpathbfaz parte do grupo LVM vg-one-100:

# pvs
  PV         VG         Fmt  Attr PSize  PFree
  /dev/dm-2  vg-one-100 lvm2 a--  10,00t 3,77t
# vgs
  VG         #PV #LV #SN Attr   VSize  VFree
  vg-one-100   1  17   0 wz--n- 10,00t 3,77t

vg-one-100grupo contém vários volumes:

# lvs
  LV          VG         Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv-one-0-1  vg-one-100 -wi-a----- 20,00g                                                    
  lv-one-1-0  vg-one-100 -wi-a-----  2,41g                                                    
  lv-one-10-0 vg-one-100 -wi------- 20,00g                                                    
  lv-one-11-0 vg-one-100 -wi------- 30,00g                                                    
  lv-one-12-0 vg-one-100 -wi-------  2,41g                                                    
  lv-one-13-0 vg-one-100 -wi-------  2,41g                                                    
  lv-one-14-0 vg-one-100 -wi-------  2,41g                                                    
  lv-one-15-0 vg-one-100 -wi-------  2,41g                                                    
  lv-one-16-0 vg-one-100 -wi-------  2,41g                                                    
  lv-one-17-0 vg-one-100 -wi------- 30,00g                                                    
  lv-one-18-0 vg-one-100 -wi------- 30,00g                                                    
  lv-one-23-0 vg-one-100 -wi------- 20,00g                                                    
  lv-one-31-0 vg-one-100 -wi------- 20,00g                                                    
  lv-one-8-0  vg-one-100 -wi------- 30,00g                                                    
  lv-one-9-0  vg-one-100 -wi------- 20,00g                                                    
  lvm_images  vg-one-100 -wi-a-----  5,00t                                                    
  lvm_system  vg-one-100 -wi-a-----  1,00t          

My lvm.confinclui os seguintes filtros:

# grep filter /etc/lvm/lvm.conf | grep -vE '^.*#'
    filter = ["a|/dev/dm-*|", "r|.*|"]
    global_filter = ["a|/dev/dm-*|", "r|.*|"]

lvmetadestá desabilitado:

# grep use_lvmetad /etc/lvm/lvm.conf | grep -vE '^.*#'
    use_lvmetad = 0

Se lvmetadestiver desabilitado, então lvm2-activation-generatorserá usado.

No meu caso, lvm2-activation-generatorgerei todos os arquivos de unidade necessários e executei-os durante a inicialização:

# ls -1 /var/run/systemd/generator/lvm2-activation*
/var/run/systemd/generator/lvm2-activation-early.service
/var/run/systemd/generator/lvm2-activation-net.service
/var/run/systemd/generator/lvm2-activation.service

# systemctl status lvm2-activation-early.service
● lvm2-activation-early.service - Activation of LVM2 logical volumes
   Loaded: loaded (/etc/lvm/lvm.conf; generated; vendor preset: enabled)
   Active: inactive (dead) since Thu 2019-03-28 17:20:48 MSK; 3 weeks 4 days ago
     Docs: man:lvm2-activation-generator(8)
 Main PID: 897 (code=exited, status=0/SUCCESS)

systemd[1]: Starting Activation of LVM2 logical volumes...
systemd[1]: Started Activation of LVM2 logical volumes.
root@virt1:~# systemctl status lvm2-activation-net.service
● lvm2-activation-net.service - Activation of LVM2 logical volumes
   Loaded: loaded (/etc/lvm/lvm.conf; generated; vendor preset: enabled)
   Active: inactive (dead) since Thu 2019-03-28 17:21:24 MSK; 3 weeks 4 days ago
     Docs: man:lvm2-activation-generator(8)
 Main PID: 1537 (code=exited, status=0/SUCCESS)

systemd[1]: Starting Activation of LVM2 logical volumes...
lvm[1537]:   4 logical volume(s) in volume group "vg-one-100" now active
systemd[1]: Started Activation of LVM2 logical volumes.
root@virt1:~# systemctl status lvm2-activation.service
● lvm2-activation.service - Activation of LVM2 logical volumes
   Loaded: loaded (/etc/lvm/lvm.conf; generated; vendor preset: enabled)
   Active: inactive (dead) since Thu 2019-03-28 17:20:48 MSK; 3 weeks 4 days ago
     Docs: man:lvm2-activation-generator(8)
 Main PID: 900 (code=exited, status=0/SUCCESS)

systemd[1]: Starting Activation of LVM2 logical volumes...
systemd[1]: Started Activation of LVM2 logical volumes.

O problema em: não consigo ativar automaticamente todos os volumes LVM durante a inicialização porque lvm2-activator-net.serviceative os volumes depois que ele foi conectado (logado) sobre iSCSI em vez de dispositivo multipath ( journalctlfragmento):

. . .
kernel: sd 11:0:0:0: [sdc] 21474836480 512-byte logical blocks: (11.0 TB/10.0 TiB)
kernel: sd 10:0:0:0: [sdb] Write cache: enabled, read cache: enabled, supports DPO and FUA
kernel: sd 11:0:0:0: [sdc] Write Protect is off
kernel: sd 11:0:0:0: [sdc] Mode Sense: 97 00 10 08
kernel: sd 11:0:0:0: [sdc] Write cache: enabled, read cache: enabled, supports DPO and FUA
kernel: sd 10:0:0:0: [sdb] Attached SCSI disk
kernel: sd 11:0:0:0: [sdc] Attached SCSI disk
iscsiadm[1765]: Logging in to [iface: default, target: iqn.2012-07.com.promise:alias.tgt0000.2000000155588d75, portal: 172.16.0.151,3260] (multiple)
iscsiadm[1765]: Logging in to [iface: default, target: iqn.2012-07.com.promise:alias.tgt0000.2000000155588d75, portal: 172.16.1.151,3260] (multiple)
iscsiadm[1765]: Login to [iface: default, target: iqn.2012-07.com.promise:alias.tgt0000.2000000155588d75, portal: 172.16.0.151,3260] successful.
iscsiadm[1765]: Login to [iface: default, target: iqn.2012-07.com.promise:alias.tgt0000.2000000155588d75, portal: 172.16.1.151,3260] successful.
systemd[1]: Started Login to default iSCSI targets.
systemd[1]: Starting Activation of LVM2 logical volumes...
systemd[1]: Starting Activation of LVM2 logical volumes...
multipathd[884]: sdb: add path (uevent)
systemd[1]: Started Activation of LVM2 logical volumes.
systemd[1]: Started Activation of LVM2 logical volumes.
systemd[1]: Reached target Remote File Systems (Pre).
systemd[1]: Mounting /var/lib/one/datastores/101...
systemd[1]: Mounting /var/lib/one/datastores/100...
multipathd[884]: mpathb: load table [0 21474836480 multipath 1 retain_attached_hw_handler 0 1 1 service-time 0 1 1 8:16 1]
multipathd[884]: mpathb: event checker started
multipathd[884]: sdb [8:16]: path added to devmap mpathb
multipathd[884]: sdc: add path (uevent)
multipathd[884]: mpathb: load table [0 21474836480 multipath 1 retain_attached_hw_handler 0 2 1 service-time 0 1 1 8:16 1 service-time 0 1 1 8:32 1]
. . .

As condições para começar lvm2-activation-net.serviceestão corretas:

# grep After /var/run/systemd/generator/lvm2-activation-net.service 
After=lvm2-activation.service iscsi.service fcoe.service

Como posso ativar adequadamente allos volumes lógicos durante a inicialização?

debian lvm
  • 1 1 respostas
  • 3763 Views

1 respostas

  • Voted
  1. Best Answer
    Ferenc Wágner
    2019-04-24T02:30:38+08:002019-04-24T02:30:38+08:00

    Como você parece ter um único volume físico, realmente me pergunto como a ativação parcial pode acontecer no seu caso. Deve ser tudo ou nada. Mas aqui estão alguns problemas para cuidar de qualquer maneira:

    • Você precisa de nomes de dispositivos multipath persistentes. Não tenho certeza mpathbde onde vem, mas recomendo não habilitar user_friendly_namespara /etc/multipath.confmaior clareza. Configure o alias manualmente ou use o WWID conforme fornecido pelo seu armazenamento.
    • Os filtros LVM são expressões regulares, não globs de shell, então você precisa alterar a sintaxe para algo como

      filter = ["a|^/dev/mapper/222c60001556480c6$|", "r|.|"]
      

      ( global_filteré opcional para a funcionalidade adequada, mas pode fazer diferença nos tempos de inicialização.)

    • Você precisa atrasar a ativação até que os dispositivos multipath de todos os seus volumes físicos apareçam. Uma possibilidade é adicionar

      Requires = dev-mapper-222c60001556480c6.device
      After = dev-mapper-222c60001556480c6.device
      

      para /etc/systemd/system/lvm2-activation-net.service.d/wait_for_storage.conf. Outra é criar um serviço de ativação dedicado.

    • Os dispositivos de armazenamento iSCSI (e seus dispositivos multipath) podem levar muito tempo para aparecer. Você pode precisar criar /etc/systemd/system/dev-mapper-222c60001556480c6.devicecontendo

      [Unit]
      JobTimeoutSec=3min
      

      para garantir que o systemd não atinja o tempo limite muito rapidamente esperando por ele. Use links simbólicos para um arquivo comum se você tiver vários desses dispositivos.

    Mesmo que o acima não resolva seu problema imediatamente, ele tornará a depuração mais tratável. Boa sorte!

    • 3

relate perguntas

  • Configuração do GRUB para reconhecer diferentes ambientes de desktop (instalações) da mesma distribuição Linux

  • astyle não altera a formatação do arquivo de origem

  • Recebendo e-mail em um novo Debian fresco

  • Debian Stretch: gnome-software segfault em libgs_plugin_systemd-updates.so

  • Como digitar ü no Pinyin IME?

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Possível firmware ausente /lib/firmware/i915/* para o módulo i915

    • 3 respostas
  • Marko Smith

    Falha ao buscar o repositório de backports jessie

    • 4 respostas
  • Marko Smith

    Como exportar uma chave privada GPG e uma chave pública para um arquivo

    • 4 respostas
  • Marko Smith

    Como podemos executar um comando armazenado em uma variável?

    • 5 respostas
  • Marko Smith

    Como configurar o systemd-resolved e o systemd-networkd para usar o servidor DNS local para resolver domínios locais e o servidor DNS remoto para domínios remotos?

    • 3 respostas
  • Marko Smith

    apt-get update error no Kali Linux após a atualização do dist [duplicado]

    • 2 respostas
  • Marko Smith

    Como ver as últimas linhas x do log de serviço systemctl

    • 5 respostas
  • Marko Smith

    Nano - pule para o final do arquivo

    • 8 respostas
  • Marko Smith

    erro grub: você precisa carregar o kernel primeiro

    • 4 respostas
  • Marko Smith

    Como baixar o pacote não instalá-lo com o comando apt-get?

    • 7 respostas
  • Martin Hope
    user12345 Falha ao buscar o repositório de backports jessie 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl Por que a maioria dos exemplos do systemd contém WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky Como exportar uma chave privada GPG e uma chave pública para um arquivo 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll status systemctl mostra: "Estado: degradado" 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim Como podemos executar um comando armazenado em uma variável? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S Por que /dev/null é um arquivo? Por que sua função não é implementada como um programa simples? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 Como ver as últimas linhas x do log de serviço systemctl 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - pule para o final do arquivo 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla Por que verdadeiro e falso são tão grandes? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis Substitua a string em um arquivo de texto enorme (70 GB), uma linha 2017-12-30 06:58:33 +0800 CST

Hot tag

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve