In the first part of the article about LVM I described the structure and basic configuration files. The second part will focus on LVM configuration commands.
Create Volume Group vg01:
- Find free disks. Useful commands:
- ioscan-funC disk -lists the drives in the system,
- insf-C disk -creates device files to disk (if there was),
- bdf -list of mounted file systems (helps define engaged wheels)
- swapinfo-d -displays the disks and filesystems, used as a swap area
- strings/etc/lvmtab -list existing volume group and drives in them- vxdisk list -a list of drives employed in VxVM (another system/disk management). - Check the availability and integrity of the selected disks. For example,/dev/dsk/c0t1d0:
- diskinfo/dev/rdsk/c1t1d2 -information about the disk
- dd if =/dev/rdsk/c1t1d2 of =/dev/null bs = 1024 k -read the contents of a disk, a
search for "bad blocks".
- Prepare disks by creating them physical volumes (PV):pvcreate-f/dev/rdsk/c1t1d2 for slow disks, you can specify a larger timeout by adding the
option "-t 180". - Create a directory and a control file (group special file):
- mkdir/dev/vg01
- chmod 755/dev/vg01
- mknod/dev/vg01/group c 64 0x010000 the control file is always character type-c
major (major) always-64 and younger (minor) is encoded 0xhh0000, where hh is a unique
hexadecimal number of the VG. - chown-R root: sys/dev/vg01
- chmod 640/dev/vg01/group
- Create A Volume Group:
- vgcreate/dev/vg01/dev/dsk/c1t1d2 if multiple disks, then scroll through the gap. A set
of parameters that can be set:
-s 1-256 ( default 4 MB ) the size of the physical extent (pieces that are distributed)-p
1-255 ( default 255 ) the maximum number of PV
-l 1-255 ( default 255 ) the maximum number of LV,
-e 1-65535 (default, 1016 which corresponds to 4 GB) is the maximum number of physical
extents on disk (physical). Is very important and is set depending on the size of the volume
by the formula: PV size < >/< > size of the extent.
Does not change in the future, making it impossible to add more disks larger than the original,
in the Volume Group. - View VG settings command:
- vgdisplay vg01
Now you can create the Logical volume: lvol1
- Reserve the name:
- lvcreate-n lvol1 vg01 - Expand the LV to the desired size by selecting what disk in VG:lvextend-L 200/dev/vg01/lvol1/dev/dsk/c1t1d2 the key-L Specifies the size, in MB
and the key-l specifies the size in extents. Be careful. - You can set additional parameters:
- lvchange-a y | n/dev/vg01/lvol1 -resolution | ban on the use of LV.- lvchange-p r | w/dev/vg01/lvol1 -the right to "read-only" | " read-write when using a
Logical Volume.- lvchange-r y | n | N/dev/vg01/lvol1 -options for working with "bad blocks": move the
"bad blocks" | does not move and I/O error | disables the mechanism for the use of disk array,
for example. - Show volume settings you can command: lvdisplay/dev/vg01/lvol1
but the above sequence of commands allows you to specify which drive of the VG will be a LV. This adds flexibility when creating.
Use Logical Volume lvol1:
- As the file system:
- newfs-F vxfs/dev/vg01/rlvol1
- mkdir/data
- mount/dev/vg01/lvol1/data
- vi/etc/fstab -add a file system to mount after reboot.
- As a swap area:
- swapon/dev/vg01/lvol1
- vi/etc/fstab -add to use after the reboot.
No comments:
Post a Comment