Upload
carver
View
111
Download
0
Embed Size (px)
DESCRIPTION
LVM & Mirror. QIAN Yun 2004.4. 中国惠普有限公司支持服务事业部. / dev/rdsk/c0t1d0. / dev/rdsk/c0t0d0. physical. Volumes 物理卷. volume. VG01. VG01. Group 卷组. logical. lvol3. Volumes 逻辑卷. lvol1. lvol2. Elements of LVM( 逻辑卷管理器). 一块物理硬盘( PV) 只能属于一个卷组( VG) 一个 VG 里的最大逻辑卷( LV) 数目是255 - PowerPoint PPT Presentation
Citation preview
LVM & MirrorLVM & Mirror
中国惠普有限公司 支持服务事业部 中国惠普有限公司 支持服务事业部
QIAN YunQIAN Yun
2004.42004.4
Elements of LVM (逻辑卷管理器)
physicalVolumes物理卷
volumeGroup卷组
logicalVolumes逻辑卷
VG01VG01
lvol1
/dev/rdsk/c0t0d0 /dev/rdsk/c0t1d0
lvol3lvol2
Logical Volume Manager Rules
1) 一块物理硬盘( PV )只能属于一个卷组( VG )
2) 一个 VG 里的最大逻辑卷( LV )数目是 255
3) 每个 PV 最大 PE 数目是 65536 ,默认值是 1016 ,可在创建 VG时通过 vgcreate –e 设定
4) 每个 VG 中最大 PV 数目是 255 ,默认值是 16 , 可在创建VG 时通过
vgcreate –p 设定
Creating a Logical Volume with a File System on a New Disk
1) 创建物理卷 Physical Volume
# pvcreate /dev/rdsk/c0t1d0
P V R A
BAD BLOCK POOL Transparent software sparing is not supported on HPIB
Physical Volume Reserved Area
Contents:
ID's for volume group and physical volumesPhysical extent sizePhysical volume sizeBad block directorySize and location of other disk structures
or the root disk (only used if disk hardware sparing fails)
NEW LVM DISK
2) 创建卷组所用目录
# mkdir /dev/vg01
/
dev
vg01
ROOT DISK
P V R A
BAD BLOCK POOL
NEW LVM DISK
Creating a Logical Volume with a File System on a New Disk
3) 创建卷组设备文件# mknod /dev/vg01/group c 64 0x010000
P V R A
BAD BLOCK POOL
NEW LVM DISK
/
dev
vg01
ROOT DISK
group
Creating a Logical Volume with a File System on a New Disk
4) 创建卷组
# vgcreate /dev/vg01 /dev/dsk/c0t1d0
P V R A
BAD BLOCK POOL
NEW LVM DISK
V G R A Volume Group Reserved Area Contents
Volume Group Descriptor Area (VGDA) Identifies logical and physical volumes Physical to logical extent mappingVolume Group Status Area (VGSA)
Physical volume status (missing/present) Physical extent status (stale/ok)
Mirror Consistency Record (MCR) Lists disk writes in progress
'vgcreate' creates or updates '/etc/lvmtab'
Adds volume group information to '/etc/lvmtab'
Creating a Logical Volume with a File System on a New Disk
5) 创建大小为 100M 的逻辑卷 lvtest
# lvcreate -L 100 –n lvtest vg01
P V R A
BAD BLOCK POOL
NEW LVM DISK
V G R A
/
dev
vg01
ROOT DISK
group rlvtestlvtest
BLOCK CHARACTER
DEVICE FILEDEVICE FILE
etc
lvmtab
Creating a Logical Volume with a File System on a New Disk
6) 创建文件系统
BAD BLOCK POOL
P V R A
NEW LVM DISK
V G R A
lost+found
Newfs uses logical volume one's characterdevice file to create a 100 MB filesystemin the space allocated by lvcreate.
Newfs creates a 'lost+found' directoryin the new filesystem.
# newfs /dev/vg01/rlvtest
Creating a Logical Volume with a File System on a New Disk
7) 创建挂起点
# mkdir /test
P V R A
BAD BLOCK POOL
NEW LVM DISK
V G R A
lost+found
ROOT DISK
/
dev
vg01
group rlvtestlvtest
etc
lvmtab
test
Creating a Logical Volume with a File System on a New Disk
8) 执行挂起
# mount /dev/vg01/lvtest /test# vi /etc/fstab
P V R A
BAD BLOCK POOL
NEW LVM DISK
V G R A
lost+found
ROOT DISK
/
dev
vg01
group rlvol1lvol1
etc
lvmtab
vg01lvol1
Creating a Logical Volume with a File System on a New Disk
9) 扩大逻辑卷
Creating a Logical Volume with a File System on a New Disk
# umount /test
# lvextend –L 100 /dev/vg01/lvtest
# extendfs /dev/vg01/rlvtest
# mount //dev/vg01/lvtest /test
Displaying LVM Information
For Physical Volumes
# pvdisplay [-v] /dev/dsk/cCtTdD
Displays information about the physical volume(s) specified
For Volume Groups
# vgdisplay [-v] /dev/vg*
Displays information about all the volume groups
Displaying LVM Information
For Logical Volumes
# lvdisplay [-v] /dev/vg*/lvol*
Displays information about all the logical volumes in allthe volume groups
Displaying LVM Information
lvlnboot -vShows definitions for
boot root swap dump Physical volumes in root volume group
Display Kernel Devices on LVM and Bootable Disks
The contents of '/etc/lvmtab'
# strings /etc/lvmtab
Displays volume group to physical volume relationships
Displaying LVM Information
LVM Data Structure Backup
# vgcfgbackup vg01
Disk 1
P V R A
V G R A
vg01lvol 1
vg01lvol 2
Bad Block Pool
vg01.conf
P V R A
V G R A
vg01lvol 3
vg01lvol 4
Bad Block Pool
Disk 2
P V R A
V G R A
Bad Block Pool
vg01lvol 5
vg01lvol 6
Disk 3
LVM Data Structure Restore
Disk 1
P V R A
V G R A
v g 0 1
l v o l 1
v g 0 1
l v o l 2
Bad Block Pool
Disk 3
P V R A
V G R A
Bad Block Pool
v g 0 1
l v o l 5
v g 0 1
l v o l 6
# vgcfgrestore -n vg01 /dev/rdsk/c0t2d0
Disk 2 LVM structures corrupted
Disk 2
P V R A
V G R A
v g 0 1
l v o l 3
v g 0 1
l v o l 4
Bad Block Pool
vg01.conf
Mirror: One-Way Mirroring
# lvcreate -L 40 -m 1 /dev/vg01# lvextend -m 1 /dev/vg01/lvol2# lvextend -m 1 /dev/vg01/lvol2 /dev/dsk/c0t4d0
Split Mirrored LV
# lvsplit -s backup /dev/vg02/lvol1Logical volume "/dev/vg02/lvol1backup" has been successfully created with lv number 5.
Logical volume "/dev/vg02/lvol1" has been successfully split.
Merge split LV
# lvmerge /dev/vg02/lvol1backup /dev/vg02/lvol1
Mirror a BOOT disk• pvcreate -B /dev/rdsk/c0t8d0• vgextend /dev/vg00 /dev/dsk/c0t8d0• mkboot /dev/dsk/c0t8d0• lvextend -m 1 /dev/vg00/lvol1 /dev/dsk/c0t8d0• lvextend -m 1 /dev/vg00/lvol2 /dev/dsk/c0t8d0• lvextend -m 1 /dev/vg00/lvol3 /dev/dsk/c0t8d0• lvextend -m 1 /dev/vg00/lvol4 /dev/dsk/c0t8d0• lvextend -m 1 /dev/vg00/lvol5 /dev/dsk/c0t8d0• lvextend -m 1 /dev/vg00/lvol6 /dev/dsk/c0t8d0• lvextend -m 1 /dev/vg00/lvol7 /dev/dsk/c0t8d0• lvextend -m 1 /dev/vg00/lvol8 /dev/dsk/c0t8d0• mkboot -a "hpux -lq (;0)/stand/vmunix" /dev/dsk/c0t5d0• mkboot -a "hpux -lq (;0)/stand/vmunix" /dev/dsk/c0t8d0• lvlnboot -R• lvlnboot -b /dev/vg00/lvol1• lvlnboot -r /dev/vg00/lvol3• lvlnboot -s /dev/vg00/lvol2• lvlnboot -d /dev/vg00/lvol2• lvlnboot -R
Q & A