自動配置 LVM 裝置

(Redirected from Autoassembly of LVM devices)
Jump to: navigation, search

◄設定

LVM 自動配置於 iSCSI 裝置上

Using LVM over iSCSI has the initial problem that iSCSI is started only after the network and with that far too late for the boot.lvm script to activate any LVM volume groups devices. However, with openSUSE 10.3 we've integrated the necessary tools to integrate lvm startup into udev, so that any LVM volume groups will be activated automatically via udev once all required physical volumes have been detected.

如何設定

  1. Use the script lvm-vg-to-udev-rules.sh. It takes as argument the volume group you want to start automatically. This script will generate the required udev rules.
  2. Restart iSCSI; the volume groups will be activated automatically.

That's all. If you want to have the array started automatically on boot you have to switch the iSCSI component devices to 'automatic', so that the initiator will log into the target automatically on boot.

詳細的問題

LVM autoassembly in udev makes use of the udev helper program 'collect'. This program takes as the first argument an abstract 'ID' to be checked, followed by a list of component IDs. Once this program has been called with each of the component IDs as the first argument it'll return 0.

So for autoassembly we register the physical volume UUIDs for the given volume group as argument list for 'collect'. udev (or rather vol_id) is capable of detecting the physical volume UUID on a device and hence it can be passed as the first argument to 'collect'.

Once 'collect' has been called with all physical volume UUIDs (ie udev has received events for all component devices) the next rule triggers which just calls 'vgchange -a y <vgname>' and the volume group will be activated.