Download presentation
Presentation is loading. Please wait.
Published byMartha Nash Modified over 9 years ago
1
LVM & Mirror 中国惠普有限公司支持服务事业部 QIAN Yun 2004.4
2
Elements of LVM (逻辑卷管理器) physical Volumes 物理卷 volume Group 卷组 logical Volumes 逻辑卷 VG01 lvol1 /dev/rdsk/c0t0d0 /dev/rdsk/c0t1d0 lvol3 lvol2
3
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 设定
4
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 volumes Physical extent size Physical volume size Bad block directory Size and location of other disk structures or the root disk (only used if disk hardware sparing fails) NEW LVM DISK
5
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
6
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
7
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 mapping Volume 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
8
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 rlvtest lvtest BLOCK CHARACTER DEVICE FILE etc lvmtab Creating a Logical Volume with a File System on a New Disk
9
6) 创建文件系统 BAD BLOCK POOL P V R A NEW LVM DISK V G R A lost+found Newfs uses logical volume one's character device file to create a 100 MB filesystem in the space allocated by lvcreate. Newfs creates a 'lost+found' directory in the new filesystem. # newfs /dev/vg01/rlvtest Creating a Logical Volume with a File System on a New Disk
10
7) 创建挂起点 # mkdir /test P V R A BAD BLOCK POOL NEW LVM DISK V G R A lost+found ROOT DISK / dev vg01 group rlvtest lvtest etc lvmtab test Creating a Logical Volume with a File System on a New Disk
11
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 rlvol1 lvol1 etc lvmtab vg01lvol1 Creating a Logical Volume with a File System on a New Disk
12
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
13
Displaying LVM Information For Physical Volumes # pvdisplay [-v] /dev/dsk/cCtTdD Displays information about the physical volume(s) specified
14
For Volume Groups # vgdisplay [-v] /dev/vg* Displays information about all the volume groups Displaying LVM Information
15
For Logical Volumes # lvdisplay [-v] /dev/vg*/lvol* Displays information about all the logical volumes in all the volume groups Displaying LVM Information
16
n lvlnboot -v Shows definitions for è boot è root è swap è dump è Physical volumes in root volume group Display Kernel Devices on LVM and Bootable Disks
17
The contents of '/etc/lvmtab' # strings /etc/lvmtab Displays volume group to physical volume relationships Displaying LVM Information
18
LVM Data Structure Backup # vgcfgbackup vg01 Disk 1 P V R A V G R A vg01 lvol 1 vg01 lvol 2 Bad Block Pool vg01.conf P V R A V G R A vg01 lvol 3 vg01 lvol 4 Bad Block Pool Disk 2 P V R A V G R A Bad Block Pool vg01 lvol 5 vg01 lvol 6 Disk 3
19
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
20
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
21
Split Mirrored LV # lvsplit -s backup /dev/vg02/lvol1 Logical volume "/dev/vg02/lvol1backup" has been successfully created with lv number 5. Logical volume "/dev/vg02/lvol1" has been successfully split.
22
Merge split LV # lvmerge /dev/vg02/lvol1backup /dev/vg02/lvol1
23
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
24
Q & A
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.