所选语种没有对应资源,请选择:

本站点使用Cookies,继续浏览表示您同意我们使用Cookies。Cookies和隐私政策>

提示

尊敬的用户,您的IE浏览器版本过低,为获取更好的浏览体验,请升级您的IE浏览器。

升级

华为SAN存储在HP-UX系统下的主机连通性指南

华为SAN存储在HP-UX下的主机连通性指南
评分并提供意见反馈 :
华为采用机器翻译与人工审校相结合的方式将此文档翻译成不同语言,希望能帮助您更容易理解此文档的内容。 请注意:即使是最好的机器翻译,其准确度也不及专业翻译人员的水平。 华为对于翻译的准确性不承担任何责任,并建议您参考英文文档(已提供链接)。
常用配置命令

常用配置命令

创建物理卷

操作步骤描述如下:

  1. 显示当前系统存在的磁盘。

    bash-4.0# ioscan -funC disk
    Class     I  H/W Path  Driver S/W State   H/W Type     Description
    ==================================================================
    disk      0  0/0/0/2/0/0/0.8.0           sdisk   CLAIMED     DEVICE       HP      EH0072FAWJA
                          /dev/dsk/c0t8d0   /dev/rdsk/c0t8d0
    disk      1  0/0/0/2/0/0/0.8.1           sdisk   CLAIMED     DEVICE       HP      EH0072FAWJA
                          /dev/dsk/c0t8d1     /dev/dsk/c0t8d1s2   /dev/rdsk/c0t8d1    /dev/rdsk/c0t8d1s2
                          /dev/dsk/c0t8d1s1   /dev/dsk/c0t8d1s3   /dev/rdsk/c0t8d1s1  /dev/rdsk/c0t8d1s3
    disk     52  0/0/0/7/0/0/0.3.20.0.0.0.0  sdisk   CLAIMED     DEVICE       HUAWEI  S3900-M200
                          /dev/dsk/c13t0d0   /dev/rdsk/c13t0d0
    disk     53  0/0/0/7/0/0/0.3.20.0.0.0.1  sdisk   CLAIMED     DEVICE       HUAWEI  S3900-M200
                          /dev/dsk/c13t0d1   /dev/rdsk/c13t0d1
    disk     54  0/0/0/7/0/0/1.1.20.0.0.0.0  sdisk   CLAIMED     DEVICE       HUAWEI  S3900-M200
                          /dev/dsk/c14t0d0   /dev/rdsk/c14t0d0
    disk     55  0/0/0/7/0/0/1.1.20.0.0.0.1  sdisk   CLAIMED     DEVICE       HUAWEI  S3900-M200
                          /dev/dsk/c14t0d1   /dev/rdsk/c14t0d1
    bash-4.0#

  2. 选择合适的磁盘创建物理卷。

    bash-4.0# pvcreate -f /dev/rdsk/c13t0d0
    Physical volume "/dev/rdsk/c13t0d0" has been successfully created.
    bash-4.0#
    bash-4.0# pvcreate -f /dev/rdsk/c14t0d0
    Physical volume "/dev/rdsk/c14t0d0" has been successfully created.
    bash-4.0#

    上面的步骤中,我们将c13t0d0和c14t0d0创建了物理卷。

    如果不确认磁盘是否存在坏块,则可以通过命令mediainit来初始化磁盘。该命令会通过读写测试模式来校验磁盘的完成性,并闲置所有发现的坏块。命令格式如下:

    bash-4.0# mediainit /dev/rdsk/c14t0d2

    mediainit会破坏磁盘上所有现存的用户数据,使用的时候需要小心。

  3. 使用pvdisplay命令查看物理卷是否创建成功。

    bash-4.0# pvdisplay -l /dev/dsk/c13t0d0
    /dev/dsk/c13t0d0:LVM_Disk=yes
    bash-4.0# pvdisplay -l /dev/dsk/c13t0d1
    /dev/dsk/c13t0d1:LVM_Disk=no
    bash-4.0#

    若物理卷创建成功,则LVM_Disk的值为yes,否则为no。如上所示,c13t0d0已经成功创建物理卷,而c13t0d1还没有创建。

创建卷组

操作步骤描述如下:

  1. 创建卷组目录和卷组设备文件。

    bash-4.0# ls -lrt /dev/*/group
    crw-r-----   1 root       sys         64 0x000000 May 23 17:38 /dev/vg00/group
    crw-r--r--   1 root       sys         64 0x030000 May 26 17:10 /dev/vg_test2/group
    crw-r--r--   1 root       sys         64 0x060000 May 28 09:43 /dev/vg_testB/group
    crw-r--r--   1 root       sys         64 0x040000 May 28 10:03 /dev/vg_testC/group
    bash-4.0#
    bash-4.0# mkdir /dev/vg_try
    bash-4.0# mknod /dev/vg_try/group c 64 0x050000
    bash-4.0#

    上面的步骤中先是显示系统中已经存在的卷组设备文件,而后再创建了一个卷组设备文件。

    卷组设备文件(或称为控制文件),提供一种机制,使得LVM内核和LVM命令通过它们在创建的卷组中通信。

    说明:

    group文件是字符设备文件,主号一般为64,次号为16进制,总以0000结尾,为如下格式:

    0xhh0000

    其中hh为16进制数,表示卷组号。不同的卷组该部分必须不同。

  2. 选择物理卷,并创建卷组。

    bash-4.0# vgcreate /dev/vg_try /dev/dsk/c13t0d0 /dev/dsk/c14t0d0
    Increased the number of physical extents per physical volume to 1535.
    Volume group "/dev/vg_try" has been successfully created.
    Volume Group configuration for /dev/vg_try has been saved in /etc/lvmconf/vg_try.conf
    bash-4.0#

    上面的命令中,创建了卷组vg_try,卷组中物理卷成员为c13t0d0和c14t0d0。如果这两个物理卷为同一个LUN在不同路径上的设备,则上面的方法相当于让该LUN被PV-Links多路径接管。

  3. 显示卷组信息。

    bash-4.0# vgdisplay -v vg_try
    --- Volume groups ---
    VG Name                     /dev/vg_try
    VG Write Access             read/write
    VG Status                   available
    Max LV                      255
    Cur LV                      0
    Open LV                     0
    Max PV                      16
    Cur PV                      1
    Act PV                      1
    Max PE per PV               1535
    VGDA                        2
    PE Size (Mbytes)            4
    Total PE                    1535
    Alloc PE                    0
    Free PE                     1535
    Total PVG                   0
    Total Spare PVs             0
    Total Spare PVs in use      0
    VG Version                  1.0
    VG Max Size                 98240m
    VG Max Extents              24560
    
    
       --- Physical volumes ---
       PV Name                     /dev/dsk/c13t0d0
       PV Name                     /dev/dsk/c14t0d0 Alternate Link
       PV Status                   available
       Total PE                    1535
       Free PE                     1535
       Autoswitch                  On
       Proactive Polling           On

    由于加入vg_try的是同一个LUN在两条路径上的设备,所以相当于已经使用了PV-Links接管该LUN。

    从上面的信息可以发现,当前主路径为/dev/dsk/c13t0d0,备用路径为/dev/dsk/c14t0d0。

    路径的主备取决于创建卷组时给出的PV的顺序。

扩展卷组

命令格式如下:

vgextend vgname pvname

操作例子如下所示:

bash-4.0# vgdisplay -v /dev/vg_tong
--- Volume groups ---
VG Name                     /dev/vg_tong
VG Write Access             read/write
VG Status                   available
Max LV                      255
Cur LV                      0
Open LV                     0
Max PV                      16
Cur PV                      1
Act PV                      1
Max PE per PV               1791
VGDA                        2
PE Size (Mbytes)            4
Total PE                    1791
Alloc PE                    0
Free PE                     1791
Total PVG                   0
Total Spare PVs             0
Total Spare PVs in use      0
VG Version                  1.0
VG Max Size                 114624m
VG Max Extents              28656

   --- Physical volumes ---
   PV Name                     /dev/dsk/c14t0d1
   PV Status                   available
   Total PE                    1791
   Free PE                     1791
   Autoswitch                  On
   Proactive Polling           On
bash-4.0# vgextend /dev/vg_tong /dev/dsk/c13t0d1
Volume group "/dev/vg_tong" has been successfully extended.
Volume Group configuration for /dev/vg_tong has been saved in /etc/lvmconf/vg_tong.conf
bash-4.0#
bash-4.0# vgdisplay -v /dev/vg_tong
--- Volume groups ---
VG Name                     /dev/vg_tong
VG Write Access             read/write
VG Status                   available
Max LV                      255
Cur LV                      0
Open LV                     0
Max PV                      16
Cur PV                      1
Act PV                      1
Max PE per PV               1791
VGDA                        2
PE Size (Mbytes)            4
Total PE                    1791
Alloc PE                    0
Free PE                     1791
Total PVG                   0
Total Spare PVs             0
Total Spare PVs in use      0
VG Version                  1.0
VG Max Size                 114624m
VG Max Extents              28656

   --- Physical volumes ---
   PV Name                     /dev/dsk/c14t0d1
   PV Name                     /dev/dsk/c13t0d1 Alternate Link
   PV Status                   available
   Total PE                    1791
   Free PE                     1791
   Autoswitch                  On
   Proactive Polling           On
bash-4.0#

卷组/dev/vg_tong中原本包含有物理卷:/dev/dsk/c14t0d1。上面的命令将物理卷:/dev/dsk/c13t0d1加入该卷组中,从而达到扩展卷组的目的。

创建逻辑卷

操作步骤描述如下:

  1. 使用交互式命令lvcreate命令创建逻辑卷,例子如下所示:

    bash-4.0# lvcreate -L 10 -n lv_try00 vg_try
    Warning: rounding up logical volume size to extent boundary at size "12" MB.
    Logical volume "/dev/vg_try/lv_try00" has been successfully created with
    character device "/dev/vg_try/rlv_try00".
    Logical volume "/dev/vg_try/lv_try00" has been successfully extended.
    Volume Group configuration for /dev/vg_try has been saved in /etc/lvmconf/vg_try.conf
    bash-4.0#
    bash-4.0# lvcreate -l 100 -n lv_try01 vg_try
    Logical volume "/dev/vg_try/lv_try01" has been successfully created with
    character device "/dev/vg_try/rlv_try01".
    Logical volume "/dev/vg_try/lv_try01" has been successfully extended.
    Volume Group configuration for /dev/vg_try has been saved in /etc/lvmconf/vg_try.conf
    bash-4.0#

    上面的命令中,部分参数解释如下:

    • -L:Logical_volume_size,以MB为单位的逻辑卷大小。大小将取大于完整logical extent大的最小值。如上面的例子中,给出的为10,而每个logical extent的大小为4MB,所以这里会取3个logical extent,也就是12MB的空间。
    • -l:Logical_extents_number,逻辑卷中的logical extent数。
    • -n:逻辑卷的名字。

    其他的参数,保持默认,回车后,即可创建逻辑卷。

  2. 查看创建的逻辑卷,确认卷的信息无误。

    bash-4.0# vgdisplay -v vg_try
    --- Volume groups ---
    VG Name                     /dev/vg_try
    VG Write Access             read/write
    VG Status                   available
    Max LV                      255
    Cur LV                      2
    Open LV                     2
    Max PV                      16
    Cur PV                      1
    Act PV                      1
    Max PE per PV               1535
    VGDA                        2
    PE Size (Mbytes)            4
    Total PE                    1535
    Alloc PE                    103
    Free PE                     1432
    Total PVG                   0
    Total Spare PVs             0
    Total Spare PVs in use      0
    VG Version                  1.0
    VG Max Size                 98240m
    VG Max Extents              24560
    
       --- Logical volumes ---
       LV Name                     /dev/vg_try/lv_try00
       LV Status                   available/syncd
       LV Size (Mbytes)            12
       Current LE                  3
       Allocated PE                3
       Used PV                     1
    
       LV Name                     /dev/vg_try/lv_try01
       LV Status                   available/syncd
       LV Size (Mbytes)            400
       Current LE                  100
       Allocated PE                100
       Used PV                     1
    
       --- Physical volumes ---
       PV Name                     /dev/dsk/c13t0d0
       PV Name                     /dev/dsk/c14t0d0 Alternate Link
       PV Status                   available
       Total PE                    1535
       Free PE                     1432
       Autoswitch                  On
       Proactive Polling           On
    bash-4.0#
    bash-4.0# lvdisplay -v /dev/vg_try/lv_try00
    --- Logical volumes ---
    LV Name                     /dev/vg_try/lv_try00
    VG Name                     /dev/vg_try
    LV Permission               read/write
    LV Status                   available/syncd
    Mirror copies               0
    Consistency Recovery        MWC
    Schedule                    parallel
    LV Size (Mbytes)            12
    Current LE                  3
    Allocated PE                3
    Stripes                     0
    Stripe Size (Kbytes)        0
    Bad block                   on
    Allocation                  strict
    IO Timeout (Seconds)        default
    
       --- Distribution of logical volume ---
       PV Name                 LE on PV  PE on PV
       /dev/dsk/c13t0d0        3         3
    
       --- Logical extents ---
       LE    PV1                     PE1   Status 1
       00000 /dev/dsk/c13t0d0        00000 current
       00001 /dev/dsk/c13t0d0        00001 current
       00002 /dev/dsk/c13t0d0        00002 current
    bash-4.0#
    bash-4.0# lvdisplay -v /dev/vg_try/lv_try01
    --- Logical volumes ---
    LV Name                     /dev/vg_try/lv_try01
    VG Name                     /dev/vg_try
    LV Permission               read/write
    LV Status                   available/syncd
    Mirror copies               0
    Consistency Recovery        MWC
    Schedule                    parallel
    LV Size (Mbytes)            400
    Current LE                  100
    Allocated PE                100
    Stripes                     0
    Stripe Size (Kbytes)        0
    Bad block                   on
    Allocation                  strict
    IO Timeout (Seconds)        default
    
       --- Distribution of logical volume ---
       PV Name                 LE on PV  PE on PV
       /dev/dsk/c13t0d0        100       100
    
       --- Logical extents ---
       LE    PV1                     PE1   Status 1
       00000 /dev/dsk/c13t0d0        00003 current
       00001 /dev/dsk/c13t0d0        00004 current
       00002 /dev/dsk/c13t0d0        00005 current
       00003 /dev/dsk/c13t0d0        00006 current
       00004 /dev/dsk/c13t0d0        00007 current
       00005 /dev/dsk/c13t0d0        00008 current
       00006 /dev/dsk/c13t0d0        00009 current
       00007 /dev/dsk/c13t0d0        00010 current
       00008 /dev/dsk/c13t0d0        00011 current
       00009 /dev/dsk/c13t0d0        00012 current
       00010 /dev/dsk/c13t0d0        00013 current
       00011 /dev/dsk/c13t0d0        00014 current
       00012 /dev/dsk/c13t0d0        00015 current
       00013 /dev/dsk/c13t0d0        00016 current
       00014 /dev/dsk/c13t0d0        00017 current
       00015 /dev/dsk/c13t0d0        00018 current
       00016 /dev/dsk/c13t0d0        00019 current
       00017 /dev/dsk/c13t0d0        00020 current
       00018 /dev/dsk/c13t0d0        00021 current
       00019 /dev/dsk/c13t0d0        00022 current
       00020 /dev/dsk/c13t0d0        00023 current
       00021 /dev/dsk/c13t0d0        00024 current
       00022 /dev/dsk/c13t0d0        00025 current
       00023 /dev/dsk/c13t0d0        00026 current
       00024 /dev/dsk/c13t0d0        00027 current
       00025 /dev/dsk/c13t0d0        00028 current
       00026 /dev/dsk/c13t0d0        00029 current
       00027 /dev/dsk/c13t0d0        00030 current
       00028 /dev/dsk/c13t0d0        00031 current
       00029 /dev/dsk/c13t0d0        00032 current
       00030 /dev/dsk/c13t0d0        00033 current
       00031 /dev/dsk/c13t0d0        00034 current
       00032 /dev/dsk/c13t0d0        00035 current
       00033 /dev/dsk/c13t0d0        00036 current
       00034 /dev/dsk/c13t0d0        00037 current
       00035 /dev/dsk/c13t0d0        00038 current
       00036 /dev/dsk/c13t0d0        00039 current
       00037 /dev/dsk/c13t0d0        00040 current
       00038 /dev/dsk/c13t0d0        00041 current
       00039 /dev/dsk/c13t0d0        00042 current
       00040 /dev/dsk/c13t0d0        00043 current
       00041 /dev/dsk/c13t0d0        00044 current
       00042 /dev/dsk/c13t0d0        00045 current
       00043 /dev/dsk/c13t0d0        00046 current
       00044 /dev/dsk/c13t0d0        00047 current
       00045 /dev/dsk/c13t0d0        00048 current
       00046 /dev/dsk/c13t0d0        00049 current
       00047 /dev/dsk/c13t0d0        00050 current
       00048 /dev/dsk/c13t0d0        00051 current
       00049 /dev/dsk/c13t0d0        00052 current
       00050 /dev/dsk/c13t0d0        00053 current
       00051 /dev/dsk/c13t0d0        00054 current
       00052 /dev/dsk/c13t0d0        00055 current
       00053 /dev/dsk/c13t0d0        00056 current
       00054 /dev/dsk/c13t0d0        00057 current
       00055 /dev/dsk/c13t0d0        00058 current
       00056 /dev/dsk/c13t0d0        00059 current
       00057 /dev/dsk/c13t0d0        00060 current
       00058 /dev/dsk/c13t0d0        00061 current
       00059 /dev/dsk/c13t0d0        00062 current
       00060 /dev/dsk/c13t0d0        00063 current
       00061 /dev/dsk/c13t0d0        00064 current
       00062 /dev/dsk/c13t0d0        00065 current
       00063 /dev/dsk/c13t0d0        00066 current
       00064 /dev/dsk/c13t0d0        00067 current
       00065 /dev/dsk/c13t0d0        00068 current
       00066 /dev/dsk/c13t0d0        00069 current
       00067 /dev/dsk/c13t0d0        00070 current
       00068 /dev/dsk/c13t0d0        00071 current
       00069 /dev/dsk/c13t0d0        00072 current
       00070 /dev/dsk/c13t0d0        00073 current
       00071 /dev/dsk/c13t0d0        00074 current
       00072 /dev/dsk/c13t0d0        00075 current
       00073 /dev/dsk/c13t0d0        00076 current
       00074 /dev/dsk/c13t0d0        00077 current
       00075 /dev/dsk/c13t0d0        00078 current
       00076 /dev/dsk/c13t0d0        00079 current
       00077 /dev/dsk/c13t0d0        00080 current
       00078 /dev/dsk/c13t0d0        00081 current
       00079 /dev/dsk/c13t0d0        00082 current
       00080 /dev/dsk/c13t0d0        00083 current
       00081 /dev/dsk/c13t0d0        00084 current
       00082 /dev/dsk/c13t0d0        00085 current
       00083 /dev/dsk/c13t0d0        00086 current
       00084 /dev/dsk/c13t0d0        00087 current
       00085 /dev/dsk/c13t0d0        00088 current
       00086 /dev/dsk/c13t0d0        00089 current
       00087 /dev/dsk/c13t0d0        00090 current
       00088 /dev/dsk/c13t0d0        00091 current
       00089 /dev/dsk/c13t0d0        00092 current
       00090 /dev/dsk/c13t0d0        00093 current
       00091 /dev/dsk/c13t0d0        00094 current
       00092 /dev/dsk/c13t0d0        00095 current
       00093 /dev/dsk/c13t0d0        00096 current
       00094 /dev/dsk/c13t0d0        00097 current
       00095 /dev/dsk/c13t0d0        00098 current
       00096 /dev/dsk/c13t0d0        00099 current
       00097 /dev/dsk/c13t0d0        00100 current
       00098 /dev/dsk/c13t0d0        00101 current
       00099 /dev/dsk/c13t0d0        00102 current
    bash-4.0#

    上面的显示命令中显示了PE和LE的对应关系。

创建文件系统

操作步骤描述如下:

  1. 使用newfs命令创建文件系统。例子如下:

    bash-4.0# newfs -F vxfs -o largefiles /dev/vg_try/rlv_try00
        version 7 layout
        12288 sectors, 12288 blocks of size 1024, log size 1024 blocks
        largefiles supported
    bash-4.0#
    bash-4.0# newfs -F hfs -o largefiles /dev/vg_try/rlv_try01
    mkfs (hfs): Warning - 40 sector(s) in the last cylinder are not allocated.
    mkfs (hfs): /dev/vg_try/rlv_try01 - 409600 sectors in 2660 cylinders of 7 tracks, 22 sectors
    419.4Mb in 167 cyl groups (16 c/g, 2.52Mb/g, 384 i/g)
    Super block backups (for fsck -b) at:
        16,   2504,   4992,   7480,   9968,  12456,  14944,  17432,  19728,  22216,
     24704,  27192,  29680,  32168,  34656,  37144,  39440,  41928,  44416,  46904,
     49392,  51880,  54368,  56856,  59152,  61640,  64128,  66616,  69104,  71592,
     74080,  76568,  78864,  81352,  83840,  86328,  88816,  91304,  93792,  96280,
     98576, 101064, 103552, 106040, 108528, 111016, 113504, 115992, 118288, 120776,
    123264, 125752, 128240, 130728, 133216, 135704, 138000, 140488, 142976, 145464,
    147952, 150440, 152928, 155416, 157712, 160200, 162688, 165176, 167664, 170152,
    172640, 175128, 177424, 179912, 182400, 184888, 187376, 189864, 192352, 194840,
    197136, 199624, 202112, 204600, 207088, 209576, 212064, 214552, 216848, 219336,
    221824, 224312, 226800, 229288, 231776, 234264, 236560, 239048, 241536, 244024,
    246512, 249000, 251488, 253976, 256272, 258760, 261248, 263736, 266224, 268712,
    271200, 273688, 275984, 278472, 280960, 283448, 285936, 288424, 290912, 293400,
    295696, 298184, 300672, 303160, 305648, 308136, 310624, 313112, 315408, 317896,
    320384, 322872, 325360, 327848, 330336, 332824, 335120, 337608, 340096, 342584,
    345072, 347560, 350048, 352536, 354832, 357320, 359808, 362296, 364784, 367272,
    369760, 372248, 374544, 377032, 379520, 382008, 384496, 386984, 389472, 391960,
    394256, 396744, 399232, 401720, 404208, 406696, 409184
    bash-4.0#

    上面的命令中,有一个参数为largefiles,其含义是支持大文件系统。

    HP-UX在创建文件系统的时候,默认为小文件系统(单个文件不得超过2GB)。实际应用中大于2GB的文件是很常见的,所以需要在创建的时候,添加上面的参数,使得该文件系统支持大于2GB的文件。

    如果我们无法确定一个逻辑卷上创建的文件系统是否支持大文件系统,则可以通过命令:fstyp来查看。命令格式及例子如下所示:

    #fstyp -v /dev/vgXX/lvolX

    其中,“f_flag"”项的值是0或者16,如果是16的话,就说明是已经支持大文件系统了。

  2. 为文件系统创建相应的挂载点并将逻辑卷挂载起来。

    bash-4.0# mkdir -p /test/mnt1
    bash-4.0# mkdir -p /test/mnt2
    bash-4.0# mount /dev/vg_try/lv_try00 /test/mnt1/
    bash-4.0# mount /dev/vg_try/lv_try01 /test/mnt2/

  3. 显示挂载信息。

    bash-4.0# bdf
    Filesystem          kbytes    used   avail %used Mounted on
    /dev/vg00/lvol3    1048576  315152  727752   30% /
    /dev/vg00/lvol1    1835008  364368 1459224   20% /stand
    /dev/vg00/lvol8    8912896 1419480 7436496   16% /var
    /dev/vg00/lvol7    6553600 3037552 3488696   47% /usr
    /dev/vg00/lvol4     524288   20952  499536    4% /tmp
    /dev/vg00/lvol6    7864320 3071152 4760808   39% /opt
    /dev/vg00/lvol5     114688   37872   76352   33% /home
    /dev/vg_try/lv_try00
                         12288    2141    9520   18% /test/mnt1
    /dev/vg_try/lv_try01
                        398869       9  358973    0% /test/mnt2

    如上所示,两个逻辑卷挂载正常,后续即可对其进行读写操作。

  4. 如果需要卸载卷,则可以执行下面的命令:

    bash-4.0# umount /dev/vg_try/lv_try00
    bash-4.0# umount /test/mnt2/
    bash-4.0# bdf
    Filesystem          kbytes    used   avail %used Mounted on
    /dev/vg00/lvol3    1048576  315296  727608   30% /
    /dev/vg00/lvol1    1835008  364368 1459224   20% /stand
    /dev/vg00/lvol8    8912896 1419528 7436448   16% /var
    /dev/vg00/lvol7    6553600 3037552 3488696   47% /usr
    /dev/vg00/lvol4     524288   20952  499536    4% /tmp
    /dev/vg00/lvol6    7864320 3071152 4760808   39% /opt
    /dev/vg00/lvol5     114688   37872   76352   33% /home
    bash-4.0#

逻辑卷扩容

如果需要对已经创建的逻辑卷进行扩容操作,则可以按照下面的步骤进行:

  1. 卸载卷。

    bash-4.0# bdf
    Filesystem          kbytes    used   avail %used Mounted on
    /dev/vg00/lvol3    1048576  315368  727536   30% /
    /dev/vg00/lvol1    1835008  364368 1459224   20% /stand
    /dev/vg00/lvol8    8912896 1421144 7434840   16% /var
    /dev/vg00/lvol7    6553600 3037552 3488696   47% /usr
    /dev/vg00/lvol4     524288   20952  499536    4% /tmp
    /dev/vg00/lvol6    7864320 3071152 4760808   39% /opt
    /dev/vg00/lvol5     114688   37872   76352   33% /home
    /dev/vg_try/lv_try00
                         12288    2141    9520   18% /test/mnt1
    bash-4.0# umount /dev/vg_try/lv_try00
    bash-4.0# bdf
    Filesystem          kbytes    used   avail %used Mounted on
    /dev/vg00/lvol3    1048576  314880  728016   30% /
    /dev/vg00/lvol1    1835008  364368 1459224   20% /stand
    /dev/vg00/lvol8    8912896 1421248 7434736   16% /var
    /dev/vg00/lvol7    6553600 3037552 3488696   47% /usr
    /dev/vg00/lvol4     524288   20952  499536    4% /tmp
    /dev/vg00/lvol6    7864320 3071152 4760808   39% /opt
    /dev/vg00/lvol5     114688   37872   76352   33% /home
    bash-4.0#

  2. 执行卷扩容命令。命令格式如下所示:

    lvextend -l xxx lv_path

    lvextend -L yyy lvpath

    上面的命令中xxx为扩容后的logical extent,yyy为扩容后的容量。

    例子如下:

    bash-4.0# lvextend -l 300 /dev/vg_try/lv_try00
    Logical volume "/dev/vg_try/lv_try00" has been successfully extended.
    Volume Group configuration for /dev/vg_try has been saved in /etc/lvmconf/vg_try.conf
    bash-4.0#
    bash-4.0# lvextend -L 800 /dev/vg_try/lv_try01
    Logical volume "/dev/vg_try/lv_try01" has been successfully extended.
    Volume Group configuration for /dev/vg_try has been saved in /etc/lvmconf/vg_try.conf

  3. 进行文件系统扩容操作。

    bash-4.0# fstyp /dev/vg_try/rlv_try00
    vxfs
    bash-4.0# fstyp /dev/vg_try/rlv_try01
    hfs
    bash-4.0# extendfs -F vxfs /dev/vg_try/rlv_try00
    bash-4.0# extendfs -F hfs /dev/vg_try/rlv_try01
            max number of sectors extendible is 409600.
    extend file system /dev/vg_try/rlv_try01 to have 409600 sectors more.
    Warning: 80 sector(s) in last cylinder unallocated
    extended super-block backups (for fsck -b#) at:
     411672, 413968, 416456, 418944, 421432, 423920, 426408, 428896, 431384, 433680,
     436168, 438656, 441144, 443632, 446120, 448608, 451096, 453392, 455880, 458368,
     460856, 463344, 465832, 468320, 470808, 473104, 475592, 478080, 480568, 483056,
     485544, 488032, 490520, 492816, 495304, 497792, 500280, 502768, 505256, 507744,
     510232, 512528, 515016, 517504, 519992, 522480, 524968, 527456, 529944, 532240,
     534728, 537216, 539704, 542192, 544680, 547168, 549656, 551952, 554440, 556928,
     559416, 561904, 564392, 566880, 569368, 571664, 574152, 576640, 579128, 581616,
     584104, 586592, 589080, 591376, 593864, 596352, 598840, 601328, 603816, 606304,
     608792, 611088, 613576, 616064, 618552, 621040, 623528, 626016, 628504, 630800,
     633288, 635776, 638264, 640752, 643240, 645728, 648216, 650512, 653000, 655488,
     657976, 660464, 662952, 665440, 667928, 670224, 672712, 675200, 677688, 680176,
     682664, 685152, 687640, 689936, 692424, 694912, 697400, 699888, 702376, 704864,
     707352, 709648, 712136, 714624, 717112, 719600, 722088, 724576, 727064, 729360,
     731848, 734336, 736824, 739312, 741800, 744288, 746776, 749072, 751560, 754048,
     756536, 759024, 761512, 764000, 766488, 768784, 771272, 773760, 776248, 778736,
     781224, 783712, 786200, 788496, 790984, 793472, 795960, 798448, 800936, 803424,
     805912, 808208, 810696, 813184, 815672, 818160,
    bash-4.0#

  4. 重新挂载卷。

    bash-4.0# mount /dev/vg_try/lv_try00 /test/mnt1
    bash-4.0# mount /dev/vg_try/lv_try01 /test/mnt2
    bash-4.0# bdf
    Filesystem          kbytes    used   avail %used Mounted on
    /dev/vg00/lvol3    1048576  314912  727984   30% /
    /dev/vg00/lvol1    1835008  364368 1459224   20% /stand
    /dev/vg00/lvol8    8912896 1421176 7434816   16% /var
    /dev/vg00/lvol7    6553600 3037552 3488696   47% /usr
    /dev/vg00/lvol4     524288   20952  499536    4% /tmp
    /dev/vg00/lvol6    7864320 3071152 4760808   39% /opt
    /dev/vg00/lvol5     114688   37872   76352   33% /home
    /dev/vg_try/lv_try00
                       1228800    2447 1149713    0% /test/mnt1
    /dev/vg_try/lv_try01
                        797845       9  718051    0% /test/mnt2
    bash-4.0#

    从上面的显示可以发现,逻辑卷的容量已经更新,扩容成功。

    说明:

    在有在线JFS的情况下,也可以通过fsadm实现JFS文件系统的在线扩容。例如我们可以通过下面的命令将目录/test/mnt1扩展至32MB:

    fsadm -F vxfs -b 32768 /test/mnt1

    上面的命令中b为新文件系统的块数。JFS块的大小一般为1KB。

激活卷组

当导入一个卷组后,必须先将其激活,然后才能挂载,才能进行读写操作。激活卷组的命令格式如下:

vgchange -a  y 卷组名称

例子如下所示:

bash-4.0# vgchange -a y /dev/vg_tong
Activated volume group.
Volume group "/dev/vg_tong" has been successfully changed.
bash-4.0#

去激活卷组

当导出一个卷组前,需要先将其去激活。去激活命令格式如下:

vgchange –a n 卷组名称

例子如下所示:

bash-4.0# vgchange -a n /dev/vg_tong
Volume group "/dev/vg_tong" has been successfully changed.
bash-4.0#

导出卷组

集群、数据备份和数据恢复等应用场景时,需要导入或导出卷组。

导出卷组命令格式如下:

vgexport –p –s –v –m vgname.map 卷组名称

上面的命令会将卷组的信息保存在vgname.map文件中。在导出卷组之前,需要先将卷组去激活。

例子如下所示:

bash-4.0# vgchange -a n /dev/vg_tong
Volume group "/dev/vg_tong" has been successfully changed.
bash-4.0# vgexport -p -s -v -m vg_tong.map /dev/vg_tong
Beginning the export process on Volume Group "/dev/vg_tong".
/dev/dsk/c14t0d1
/dev/dsk/c13t0d1
vgexport: Preview of vgexport on volume group "/dev/vg_tong" succeeded.
bash-4.0# ls -lrt ./vg_tong.map
-rw-r--r--   1 root       sys             34 Jul 30 14:00 ./vg_tong.map
bash-4.0#

导入卷组

导入卷组命令格式如下:

vgimport –s –v –m vgname.map 卷组名称 

如果是在另外一台主机上导入该卷组(例如在集群环境中),则需要将之前导出卷组时生成的vgname.map复制到该主机上;随后还需要为该卷组创建相应的目录和卷组设备文件,内容与第一台主机保持一致。

例子如下所示(在本机上导入卷组):

bash-4.0# vgimport -s -v -m vg_tong.map /dev/vg_tong
Beginning the import process on Volume Group "/dev/vg_tong".
vgimport: Volume group "/dev/vg_tong" already exists in the "/etc/lvmtab" file.
bash-4.0# vgchange -a y /dev/vg_tong
Activated volume group.
Volume group "/dev/vg_tong" has been successfully changed.
bash-4.0#

删除逻辑卷

命令格式如下:

lvremove lvname

例子如下所示:

bash-4.0# bdf
Filesystem          kbytes    used   avail %used Mounted on
/dev/vg00/lvol3    1048576  314880  728016   30% /
/dev/vg00/lvol1    1835008  364368 1459224   20% /stand
/dev/vg00/lvol8    8912896 1421296 7434696   16% /var
/dev/vg00/lvol7    6553600 3037552 3488696   47% /usr
/dev/vg00/lvol4     524288   20952  499536    4% /tmp
/dev/vg00/lvol6    7864320 3071152 4760808   39% /opt
/dev/vg00/lvol5     114688   37872   76352   33% /home
/dev/vg_try/lv_try00
                   1228800    2447 1149713    0% /test/mnt1
/dev/vg_try/lv_try01
                    797845       9  718051    0% /test/mnt2
/dev/vg_tong/lv_tong00
                    398869       9  358973    0% /test/mnt3
bash-4.0#
bash-4.0# umount /dev/vg_tong/lv_tong00
bash-4.0# lvremove /dev/vg_tong/lv_tong00
Current path "/dev/dsk/c13t0d1" is an alternate link, skip.
The logical volume "/dev/vg_tong/lv_tong00" is not empty;
do you really want to delete the logical volume (y/n) : y
Logical volume "/dev/vg_tong/lv_tong00" has been successfully removed.
Volume Group configuration for /dev/vg_tong has been saved in /etc/lvmconf/vg_tong.conf
bash-4.0#

删除卷组

命令格式如下所示:

vgremove vgname

操作步骤描述如下:

  1. 确保卷组上的逻辑卷已经全部删除。

    bash-4.0# vgdisplay -v /dev/vg_tong
    --- Volume groups ---
    VG Name                     /dev/vg_tong
    VG Write Access             read/write
    VG Status                   available
    Max LV                      255
    Cur LV                      0
    Open LV                     0
    Max PV                      16
    Cur PV                      1
    Act PV                      1
    Max PE per PV               1791
    VGDA                        2
    PE Size (Mbytes)            4
    Total PE                    1791
    Alloc PE                    0
    Free PE                     1791
    Total PVG                   0
    Total Spare PVs             0
    Total Spare PVs in use      0
    VG Version                  1.0
    VG Max Size                 114624m
    VG Max Extents              28656
    
       --- Physical volumes ---
       PV Name                     /dev/dsk/c14t0d1
       PV Name                     /dev/dsk/c13t0d1 Alternate Link
       PV Status                   available
       Total PE                    1791
       Free PE                     1791
       Autoswitch                  On
       Proactive Polling           On
    bash-4.0#

  2. 移除卷组中的物理卷,使之只剩下最后一个物理卷。

    bash-4.0# vgreduce /dev/vg_tong /dev/dsk/c13t0d1
    Device file path "/dev/dsk/c13t0d1" is an alternate path.
    Volume group "/dev/vg_tong" has been successfully reduced.
    Volume Group configuration for /dev/vg_tong has been saved in /etc/lvmconf/vg_tong.conf
    bash-4.0# vgdisplay -v /dev/vg_tong
    --- Volume groups ---
    VG Name                     /dev/vg_tong
    VG Write Access             read/write
    VG Status                   available
    Max LV                      255
    Cur LV                      0
    Open LV                     0
    Max PV                      16
    Cur PV                      1
    Act PV                      1
    Max PE per PV               1791
    VGDA                        2
    PE Size (Mbytes)            4
    Total PE                    1791
    Alloc PE                    0
    Free PE                     1791
    Total PVG                   0
    Total Spare PVs             0
    Total Spare PVs in use      0
    VG Version                  1.0
    VG Max Size                 114624m
    VG Max Extents              28656
    
       --- Physical volumes ---
       PV Name                     /dev/dsk/c14t0d1
       PV Status                   available
       Total PE                    1791
       Free PE                     1791
       Autoswitch                  On
       Proactive Polling           On
    bash-4.0#

  3. 删除卷组。

    bash-4.0# vgremove /dev/vg_tong
    Volume group "/dev/vg_tong" has been successfully removed.
    bash-4.0#

删除物理卷

删除物理卷的命令格式如下:

pvremove 裸设备名

例子如下所示:

bash-4.0# pvremove /dev/rdsk/c13t0d1
The physical volume associated with "/dev/rdsk/c13t0d1" has been removed.
bash-4.0# pvremove /dev/rdsk/c14t0d1
pvremove: Physical Volume "/dev/rdsk/c14t0d1" contains no LVM information
bash-4.0#
bash-4.0# pvdisplay -l /dev/dsk/c13t0d1
/dev/dsk/c13t0d1:LVM_Disk=no
bash-4.0# pvdisplay -l /dev/dsk/c14t0d1
/dev/dsk/c14t0d1:LVM_Disk=no
bash-4.0#
翻译
下载文档
更新时间:2019-09-12

文档编号:EDOC1000158279

浏览量:23422

下载量:1069

平均得分:
本文档适用于这些产品
相关版本
相关文档
Share
上一页 下一页