hp-unix创建和更改LV

Pseudo name=disk86
CLARiiON ID=FCNCP101600084 [CWdatabase]
Logical device ID=60060160F8902900BC375411D3B0E411 [CW_300G_Group19_LUN73]
state=alive; policy=CLAROpt; priority=0; queued-IOs=0;
Owner: default=SP A, current=SP A       Array failover mode: 4
==============================================================================
--------------- Host ---------------   - Stor -   -- I/O Path --  -- Stats ---
###  HW Path               I/O Paths    Interf.   Mode    State   Q-IOs Errors
==============================================================================
   0 0/0/6/1/0.0x5006016944604521.0x2000000000000 c38t0d2   SP B1     active  alive       0      0
   1 0/0/14/1/0.0x5006016244604521.0x4002000000000000 c25t0d2   SP A2     active  alive       0      0
   0 0/0/6/1/0.0x5006016144604521.0x4002000000000000 c6t0d2    SP A1     active  alive       0      0
   0 0/0/6/1/0.0x5006016344604521.0x4002000000000000 c43t0d2   SP A3     active  alive       0      0
   0 0/0/6/1/0.0x5006016b44604521.0x4002000000000000 c42t0d2   SP B3     active  alive       0      0
   1 0/0/14/1/0.0x5006016044604521.0x4002000000000000 c24t0d2   SP A0     active  alive       0      0
   1 0/0/14/1/0.0x5006016844604521.0x2000000000000 c19t0d2   SP B0     active  alive       0      0
   1 0/0/14/1/0.0x5006016a44604521.0x2000000000000 c17t0d2   SP B2     active  alive       0      0
1、-创建pv  
pvcreate  /dev/rdsk/c38t0d2  
pvcreate  /dev/rdsk/c25t0d2
2、创建目录
mkdir   /dev/test
3、创建node
mknod /dev/test/group c 64 0x040000
4、创建vg
vgcreate /dev/test  /dev/dsk/c38t0d2 /dev/dsk/c25t0d2 此命令报错
执行下面的
# vgcreate   -s 8   /dev/test  /dev/dsk/c38t0d2 /dev/dsk/c25t0d2
Increased the number of physical extents per physical volume to 38399.
Volume group "/dev/test" has been successfully created.
Volume Group configuration for /dev/test has been saved in /etc/lvmconf/test.conf
 -s 指定 每个PE大小8m
5 、创建 lv
# lvcreate -L 10240  -n lvtest  /dev/test
Logical volume "/dev/test/lvtest" has been successfully created with
character device "/dev/test/rlvtest".
Logical volume "/dev/test/lvtest" has been successfully extended.
Volume Group configuration for /dev/test has been saved in /etc/lvmconf/test.conf
6、创建挂在目录
mkdir /test
7、创建文件系统
#  newfs -F vxfs -o largefiles /dev/test/rlvtest
    version 6 layout
    10485760 sectors, 10485760 blocks of size 1024, log size 16384 blocks
    largefiles supported
说明:-F参数指定文件系统类型,这里的vxfs文件系统其实就是我们常说的JFS文件系统,-o用来指定文件系统支持大格式文件,即支持单个文件大于2G的文件系统,否则,将来随着文件——特别是数据库文件——的增大,很可能会出现问题。而且,如果数据库文件采用裸文件的话,就不要进行这一步操作!   
8、 挂载
#  mount /dev/test/lvtest   /test1
9、 创建开机挂在/dev/fstab
# vi /etc/fstab
 /dev/test/lvtest   /test1 vxfs delaylog 0 2
10、备份
---vgcfgbackup lvtest
11、查看     
# vgdisplay -v /dev/test
--- Volume groups ---
VG Name                     /dev/test
VG Write Access             read/write    
VG Status                   available                
Max LV                      255   
Cur LV                      1     
Open LV                     1     
Max PV                      16    
Cur PV                      1     
Act PV                      1     
Max PE per PV               38399       
VGDA                        2  
PE Size (Mbytes)            8              
Total PE                    38399  
Alloc PE                    1280   
Free PE                     37119  
Total PVG                   0       
Total Spare PVs             0             
Total Spare PVs in use      0                    
VG Version                  1.0      
VG Max Size                 4915072m  
VG Max Extents              614384       
   --- Logical volumes ---
   LV Name                     /dev/test/lvtest
   LV Status                   available/syncd          
   LV Size (Mbytes)            10240          
   Current LE                  1280     
   Allocated PE                1280       
   Used PV                     1      
   --- Physical volumes ---
   PV Name                     /dev/dsk/c38t0d2
   PV Name                     /dev/dsk/c25t0d2 Alternate Link
   PV Status                   available               
   Total PE                    38399  
   Free PE                     37119  
   Autoswitch                  On       
   Proactive Polling           On              
     
      
       
二、扩展lvgLVM的扩展分两种情况,一种是VG还有剩余空间,另外一种是VG已经没有剩余空间
 
1、创建新的pv,后面加入到vg中去
# pvcreate  /dev/rdsk/c6t0d2
pvcreate: The physical volume already belongs to a volume group      
2、扩展vg
vgextend [-f] [-A autobackup] [-g pvg_name] [-x extensibility] [-z sparepv] vg_name pv_path ...
      
# vgextend /dev/test  /dev/dsk/c6t0d2      
Current path "/dev/dsk/c25t0d2" is an alternate link, skip.
Volume group "/dev/test" has been successfully extended.
Volume Group configuration for /dev/test has been saved in /etc/lvmconf/test.conf      
      
# vgdisplay -v /dev/test
--- Volume groups ---
VG Name                     /dev/test
VG Write Access             read/write    
VG Status                   available                
Max LV                      255   
Cur LV                      1     
Open LV                     1     
Max PV                      16    
Cur PV                      1     
Act PV                      1     
Max PE per PV               38399       
VGDA                        2  
PE Size (Mbytes)            8              
Total PE                    38399  
Alloc PE                    1280   
Free PE                     37119  
Total PVG                   0       
Total Spare PVs             0             
Total Spare PVs in use      0                    
VG Version                  1.0      
VG Max Size                 4915072m  
VG Max Extents              614384       
   --- Logical volumes ---
   LV Name                     /dev/test/lvtest
   LV Status                   available/syncd          
   LV Size (Mbytes)            10240          
   Current LE                  1280     
   Allocated PE                1280       
   Used PV                     1      
   --- Physical volumes ---
   PV Name                     /dev/dsk/c38t0d2
   PV Name                     /dev/dsk/c25t0d2 Alternate Link
   PV Name                     /dev/dsk/c6t0d2  Alternate Link
   PV Status                   available               
   Total PE                    38399  
   Free PE                     37119  
   Autoswitch                  On       
   Proactive Polling           On                     
如果Free PE不为0,则表示vg还有剩余空间,剩余空间的大小为:剩余数*创建VG时使用-s指定的PE大小,如我这里剩余37119个PE,则剩余VG容量为:37119*8=300g      
      
---扩展lv
# lvextend -L 10240 /dev/test/lvtest     
lvextend: "LogicalExtentsNumber" is not bigger than current setting.
用vgdisplay -v vg00查看了下逻辑卷lvol5的大小为1008M,这里要注意的是:lvextend -L后面的数值大小是你的逻辑卷扩展后的大小,而不是你想在现有基础上增加多少,-l是增加pe的多少逻辑单元
# lvextend -L 20240 /dev/test/lvtest       ##增加容量到200G,增加100G
# lvextend –l    12800 /dev/vgbackup/lvbackup     ##增加le到12800个,每个大小8M,因此同样是增加100G
# umount /test1 (先umount文件系统)
# extendfs -F vxfs /dev/test/lvtest (让文件系统可以使用新的extends)
# mount /dev/test/lvtest   /test1 
# df  -k (查看容量是否增长)删除lvumount  /test1
lvremove  /dev/test/lvtest    ---删除vg查看/etc/lvmtab文件,确定此要移除的VG中只包含一个PV了
# strings /etc/lvmtab
/dev/test
/dev/dsk/c38t0d2
/dev/dsk/c25t0d2
/dev/dsk/c6t0d2
说明:此文件是用strings命令查看,如果PV有多个,就要一个个移除,剩下最后一个作为VG的载体--移除多余的PVvgreduce /dev/test /dev/dsk/c38t0d2
 vgreduce /dev/test /dev/dsk/c25t0d2
# vgreduce /dev/test /dev/dsk/c38t0d2
Device file path "/dev/dsk/c38t0d2" is an primary link.
Removing primary link and switching to an alternate link.
Volume group "/dev/test" has been successfully reduced.
Volume Group configuration for /dev/test has been saved in /etc/lvmconf/test.conf---移除pvvgremove /dev/test 注意       # vgcreate /dev/test  /dev/dsk/c38t0d2 /dev/dsk/c25t0d2
Warning: Max_PE_per_PV for the volume group (65535) too small for this PV (76799).
         Using only 65535 PEs from this physical volume.
Increased the number of physical extents per physical volume to 65535.
vgcreate: Volume group "/dev/test" could not be created:
VGRA for the disk is too big for the specified parameters. Increase the
extent size or decrease max_PVs/max_LVs and try again.
 
出现此报错的时候,可以通过指定 -s选项指定PE大小,例如
vgcreate  -s 8 /dev/test  /dev/dsk/c38t0d2 /dev/dsk/c25t0d2
# vgcreate /dev/test  /dev/dsk/c38t0d2
vgcreate: Minor number of /dev/test/group is not unique. /dev/vgora2/group has the same minor number.
vgcreate: Volume group "/dev/test" could not be created:
出现此报错的问题是在前面创建 mknod /dev/test/group c 64 0x020000,0x020000此号指定重复
通过查看下面的命令查看,找到一个不重复的号 mknod /dev/test/group c 64 0x040000
# ls -l /dev/*/group                                                             
crw-r--r--   1 root       sys         64 0x020000 Feb 10 13:58 /dev/test/group   
crw-r-----   1 root       sys         64 0x000000 Jun 17  2008 /dev/vg00/group   
crw-r--r--   1 root       sys         64 0x010000 Feb 26  2012 /dev/vgcwtest/group
crw-r--r--   1 root       sys         64 0x020000 Feb 26  2012 /dev/vgora2/group 
crw-r--r--   1 root       sys         64 0x030000 Feb 26  2012 /dev/vgorabak/group
# vgreduce /dev/test /dev/dsk/c6t0d2
vgreduce: Too many physical volumes specified. At least
one physical volume must stay in the volume group.
出现此报错是因为vg中至少要有一个pv存在
---------------------


原文:https://blog.csdn.net/wll_1017/article/details/43706291
posted @ 2019-06-26 16:52  翎戍  阅读(904)  评论(0编辑  收藏  举报