Continue to describe LVM from the practical point of view.
The previous parts are available here:
- Logical Volume Manager (LVM). Part 1.Basics
- Logical Volume Manager (LVM). Part 2 Commands
- Logical Volume Manager (LVM). Part 3 Commands
Another typical situation is when you need to arrange access to a file system Volume Group from different servers. The disks are physicallylocatedin the disk array, for example, in network SAN (Storage Area Network) and multiple servers have access to those drives. This configuration is required for the Organization of the work of the failover cluster on the basis of the MC/ServiceGuard.
The sequence is as follows:
- Logical Volume Manager (LVM). Part 2 Commands
- Logical Volume Manager (LVM). Part 3 Commands
Another typical situation is when you need to arrange access to a file system Volume Group from different servers. The disks are physicallylocatedin the disk array, for example, in network SAN (Storage Area Network) and multiple servers have access to those drives. This configuration is required for the Organization of the work of the failover cluster on the basis of the MC/ServiceGuard.
The sequence is as follows:
- Create the Volume Group (c) Logical Volumes and file systems with mount points on the same server. Name it the source (host1).
- Unmount file systems and deactivate the Volume Group on the source server:
- umount /data
- vgchange -a n/dev/vg01
- Create a special mapping file Volume Group on the source server and copy it to the new server. Lets name it target (host2).
- vgexport -p -s -m /vg01.map/dev/vg01 - pay attention to the-p option (mode, when the export Volume Group vg01 is not deleted on the source server),
- rcp /vg01.map host2:/vg01.map
- On the destination server to prepare disks presented with disk array, which were included in the Volume Group vg01 on the source server, create a directory and a file for Volume Group vg01:
- the ioscan -fnC disk - in case when devices were not created, to create use the command: insf-C disk , nothing to do else with the disks then.
- mkdir /dev/vg01
- mknod /dev/vg01/group c 64 0x010000 -to search for free junior rooms use the command: ls-al /*/group
- Import to the target server using the mapping file that you obtained in step 3:
- vgimport-s-m/vg01.map/dev/vg01 -team itself finds the disks and add them to a new Volume Group; the failover command to verify that you can use the command: strings /etc/lvmtab
- You can now activate the Volume Group on the target server, save the configuration to restore, create a mount point, mount the file system and, if necessary, prescribe automatic mounts in/etc/fstab:
- vgchange -a y /dev/vg01
- vgcfgbackup /dev/vg01
- mkdir /data
- mount /dev/vg01/lvol1/data
- vi /etc/fstab
By this method the Volume Groups can be migrated from one server to another. In this case it is necessary to remove them after the migration on the source server with the following command:
- vgexport /dev/vg01