LVM over iSCSI, montage au boot

Je me suis arraché les cheveux récemment avec un montage automatique d'une partition LVM montée sur un iSCSI.

Tout était impeccable à la main, mais même après avoir spécifié les bonnes options dans le fstab (_netdev), le montage plantait systématiquement, le LV indiquait systématiquement not available.

root@mirror:~# lvdisplay 
  --- Logical volume ---
  LV Path                /dev/home_vg/home
  LV Name                home
  VG Name                home_vg
  LV UUID                5zn2XF-2E70-dJaB-tvAS-37Ub-pZr8-iCiBy2
  LV Write Access        read/write
  LV Creation host, time mirror, 2016-03-29 17:18:48 +0200
  LV Status              NOT available
  # open                 1
  LV Size                1024.00 GiB
  Current LE             262143
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0

Mais grâce à cette page, j'ai pu trouver ce qui n'allait pas. Donc on résume.

On ajoute le flag _netdev dans le fstab. Cela indique au sytème de ne pas monter le volume tant que le réseau n'est pas monté :

root@mirror:~# cat /etc/fstab 
[...]
/dev/home_vg/home /home ext4  _netdev,defaults    0 0

On ajoute le nom du volume group dans /etc/default/open-iscsi et on vérifie que HANDLE_NETDEV est bien à 1.

root@mirror:~# grep LVMGROUPS /etc/default/open-iscsi
LVMGROUPS="home_vg"
root@mirror:~# grep HANDLE_NETDEV /etc/default/open-iscsi
HANDLE_NETDEV=1

On reboot et tout va bien.

Damien Gustave

Read more posts by this author.