- Linux Training
- Desktop Tutorials
- Server Tutorials
|Create a Mirrored Logical Volume|
|Server Training - Logical Volume Management|
Create Mirrored Logical Volume
Mirrored Logical Volumes
The mirror creates an exact copy of all data on a different device. Once data is written to one of the devices, it will proceed to writing the information to the second device. If one device fails the mirrored volume becomes a linear logical volume and continues to function. The whole process of mirroring will be placed in a log that will verify that the drives are actually synced. The mirror divides the device being copied into sections that are about 512KB.
The key to creating mirrored logical volumes is that you must have at least 3 pvs with free space. So first you may have to create a pv from the command line. This example assumes that you are creating the pv on /dev/sdb and that you have the free space to do that.
Sizes are small just for illustration and practice.
The number of cylinders for this disk is set to 3736.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/sdb: 3.7 GB, 3735581184 bytes
255 heads, 63 sectors/track, 3736 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 127 1020096 8e Linux LVM
Command (m for help): n
p primary partition (1-4)
Partition number (1-4): 2
First cylinder (128-3736, default 128):
Using default value 128
Last cylinder or +size or +sizeM or +sizeK (128-3736, default 3736): +100M
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 8e
Changed system type of partition 2 to 8e (Linux LVM)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
This now means that you have an new partition /dev/sdb2 which is a LVM of 100 MB.
Once you create the LVM it is important to either restart or run partprobe so the new partition is recognized.
Now you can create a mirrored logical partition. Mount the partition as /sales on the file system.
Remove a Mirrored Logical Volume
In order to remove a mirrored logical volume select the mirrored logical volume from the logical view. Now select Remove Selected Logical Volume(S). Of course all data on those mirrors will be lost when it is deleted.
Copyright CyberMontana Inc. and BeginLinux.com All rights reserved. Cannot be reproduced without written permission. Box 1262 Trout Creek, MT 59874