AIX磁盘相关操作

下面是使用VIO的AIX服务器上功能删除一块存储上硬盘分区的操作方法


操作环境:AIX操作系统版本5.3

AIX删除用户卷组VG操作3大步骤如下:

l  umount  文件系统

l  varyoffvg 指定datavg

l  exportvg  删除vg(从ODM库里去掉该VG信息)此时lsvg看不到该vg,再删除PV

 

注意:由于这次操作vg用户卷组ibmvg01不需要保留数据,故可以不保留原数据操作。还由于这次操作vg中只有一个PV所以用不到reducevg

 

详细步骤如下:

l  umount  文件系统

 首先确认vg名字 运行lsvg 确认要操作删除用户vg名字为ibmvg01 如下

root@SVR059138[/]>lsvg

rootvg

ibmvg01

检查PV 命令lspv 检查得知用户VG  ibmvg01 只有一个PV:hdisk2 且PVID 是000ce4f0d68912aa

root@SVR059138[/]>lspv

hdisk0          000ce4f06dbe60eb                    rootvg          active

hdisk1          000ce4f06e3b8263                    rootvg          active

hdisk2          000ce4f0d68912aa                    ibmvg01        active

 

检查确认要操作VG的mount point 运行命令lsvg –l ibmvg01查找对应MOUNT点是/opt/IBM

root@SVR059138[/]>lsvg -l  ibmvg01

ibmvg01:

LV NAME             TYPE       LPs   PPs   PVs  LV STATE      MOUNT POINT

ibmlv01             jfs2       784   784   1    open/syncd            /opt/IBM

loglv00             jfs2log    1     1     1    open/syncd              N/A

可以用df –g命令再确认MOUNT点是/opt/IBM

Loglv00这个

root@SVR059138[/]>df -g

Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on

/dev/hd4           4.00      2.55   37%     3527     1% /

/dev/hd2           7.00      5.18   27%    42053     4% /usr

/dev/hd9var        0.25      0.17   32%      568     2% /var

/dev/hd3           2.00      1.31   35%     7558     3% /tmp

/dev/hd1           1.00      1.00    1%       92     1% /home

/proc                 -         -    -         -     -  /proc

/dev/hd10opt      50.00      5.77   89%   108206     8% /opt

/dev/ibmlv01      49.00     48.99    1%        4     1% /opt/IBM

由于这次操作vg用户卷组ibmvg01不需要保留数据,故可以直接后续操作

确认上面信息下面可以umount 该vg文件系统,运行smit umount 命令选择  Unmount a File System

root@SVR059138[/]>smit umount

 

                  选择          Unmount a File System

 

Move cursor to desired item and press Enter.

 

  Unmount a File System

  Unmount a Group of File Systems

在下面画面里在NAME of file system to unmount按F4选择/opt/IBM 如下图按执行

 

 

                                   Unmount a File System

 

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

 

                                                        [Entry Fields]

  Unmount ALL mounted file systems?                   no              

  

  Unmount all REMOTELY mounted file systems?          no              

 

  NAME of file system to unmount                     []               

  REMOTE NODE containing the file system(s)          []

    to unmount               

上面运行提示成功之后,df –g命令,检查确认之前下面一行已经不再显示,确认umount成功

/dev/ibmlv01      49.00     48.99    1%        4     1% /opt/IBM

 

 

 

l  varyoffvg 指定datavg

运行smit varyoffvg 在VOLUME GROUP name按F4选择用户卷组ibmvg01

root@SVR059138[/]>smit varyoffvg        

 

                                 Deactivate a Volume Group

 

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

 

                                                        [Entry Fields]

VOLUME GROUP name                                  []                 

  Put volume group in SYSTEM                          no               

    MANAGEMENT mode?

按执行之后执行运行lsvg还显示ibmvg01 ,如果运行lsvg –l ibmvg01 查看VG详细内容会提示你该VG状态已经不是vary on 这样确认vg已经varyoff

 

l  exportvg  删除vg

运行命令smit exportvg从ODM库里彻底去掉该vg相关信息,在* VOLUME GROUP name   F4选择ibmvg01如下:

 

                                                    Export a Volume Group

 

Type or select values in entry fields.      

Press Enter AFTER making all desired changes.

 

                                                        [Entry Fields]

* VOLUME GROUP name                                  [ibmvg01]           

 

运行lsvg 已经不显示被清理掉的ibmvg01了,确认exportvg成功

 

root@SVR059138[/]>lsvg

rootvg

此时运行lspv 对照之前lspv内容,原来挂在ibmvg01下的 hdisk2的第三列显示None已经没有关联任何vg如下:

 

root@SVR059138[/]>lspv

hdisk0          000ce4f06dbe60eb                    rootvg          active

hdisk1          000ce4f06e3b8263                    rootvg          active

hdisk2          000ce4f0d68912aa                    None            

 

此时可以已经删除VG 下的PV了 ,运行命令rmdev -dl hdisk2 成功之后lspv 之前hdisk2内容

root@SVR059138[/]>lspv

hdisk0          000ce4f06dbe60eb                    rootvg          active

hdisk1          000ce4f06e3b8263                    rootvg          active

hdisk2          000ce4f0d68912aa                    None           

root@SVR059138[/]>rmdev -dl hdisk2

hdisk2 deleted

root@SVR059138[/]>lspv

hdisk0          000ce4f06dbe60eb                    rootvg          active

hdisk1          000ce4f06e3b8263                    rootvg          active

至此要删除的VG和VG下属的PV,在AIX 的LPAR 中都已经彻底清理干净。后续再在VIO里去掉对应相关内容

 

 

 

从LPAR配置信息Excel中查询该AIX服务器是使用VIO,VIO的地址是10.52.1.247

 

在刚刚登陆AIX中Telnet VIO地址10.52.1.247 登录ID: padmin 如下出现$符合登录成功

root@SVR059138[/]>telnet 10.52.1.247

Trying...

Connected to 10.52.1.247.

Escape character is '^]'.

telnet (vios_3rd)

IBM Virtual I/O Server

login: padmin

padmin's Password:

Last unsuccessful login: Wed Jan 27 05:58:52 CST 2010 on /dev/pts/0 from10.52.1.138

Last login: Thu Jul 15 09:46:29 CDT 2010 on /dev/pts/4 from 10.52.1.138

 

$

运行lsmap –all查看所有VIO中VHOST和设备的关联关系,显示结果中,其中对应操作LPAR的 VHOST3信息如下

说明:(查询vhost和LPAR的关系,已知的一种方法就是登录HMC选择P5该服务器VIO的LPAR比如VIOS然后选择Hardware Inoformationà Virtual I/O  Adapters àSCSI 会显示VHOST和LPAR对应关系清单,可以获得对应关系,我们知道操作LPAR的VHOST名称是VHOST3

SVSA            Physloc                                      Client Partition ID

--------------- -------------------------------------------- ------------------

vhost3          U9133.55A.06EBC8G-V1-C23                     0x00000004

 

VTD                   p55a3_lpar03_01

Status                Available

LUN                   0x8100000000000000

Backing device        hdisk14

Physloc               U7311.D20.068E47B-P1-C08-T1-W201400A0B8117590-L7000000000000

 

运行$oem_setup_env(在VIOS中切换到AIX指令环境,命令行开始符号变为#) 再运行lspv命令显示vio 识别的所有PV清单查找对应上面查询到hdisk4的PV ID 为 000ce4f0d68912aa

 

 

 

$ oem_setup_env

# lspv 

hdisk0          000ce4f06ab32cbf                    rootvg          active

hdisk1          000ce4f06b1227e6                    rootvg          active

hdisk6          0006556f208991e0                    None           

hdisk11         0006556f2089944c                    None           

hdisk12         0006556f30d573de                    None           

hdisk13         0006556f30d5747c                    None           

hdisk14         000ce4f0d68912aa                    None           

hdisk15         0006556f30d575ac                    None           

hdisk16         0006556f30d57620                    None            

hdisk24         0006549d9bafc833                    None           

hdisk25         0006549d9baff789                    None           

hdisk32         000ce4f0d6894d5c                    None           

hdisk7          0006556fd1c7cec7                    None           

hdisk8          0006549d13f71cc7                    None           

hdisk18         0006556fcecedbf3                    None           

hdisk19         0006556f82f5cb8d                    None           

hdisk20         0006556f82f77766                    None           

hdisk26         000ce4f02b66f04d                    None           

hdisk27         000ce4f02b7406f7                    None           

hdisk28         000ce4f086c609a8                    None           

hdisk29         000ce4f07dacdfe0                    None           

hdisk30         none                                None           

hdisk31         none                                None           

 

先rmvdev

$mkvdev –vdev hdisk?(VISO PV) -vadapter vhost?(LPAR Vhost Name) -dev VTD(格式:AIX机器编号_LPAR编号_磁盘序号,如:p55a1_lpar01_01)把新增的LUN分配给具体LPAR中,$exit(退出 VIOS环境到AIX LPAR中)

 

再 rmdev –dev

 

随后在存储上操作

在存储上操作完成之后,在先在VIO中配置完成,后面再执行如下操作,把新划出来的PV加入LPAR中

 

 

 

 

 

 

第三部分VIO里重新定义好PV之后 在AIX   LPAR里如下操作

大致步骤

l  建立VG

l  建立文件系统smit fs  *

l  Mount建立的文件系统

*说明: 建立文件系统自动自动创建相关LV不需要额外手动去建立LV比较方便,手动去建立LV主要是针对比如有条带化或许要建立镜像等这样的特别 需求,这次需求没有特殊需求顾可以直接通过SMIT中建立文件系统自动生成LV. 建立文件系统的时候请不要把VG中空间都用完,VG保留少量几百兆 Free空间(同仁经验VG空间全都分配完,可能会导致不稳定)

 

lspv确认已经能显示到更新新增的PV 应该如下,记录下PV 名字hdisk2

 

root@SVR059138[/]>lspv

hdisk0          000ce4f06dbe60eb                    rootvg          active

hdisk1          000ce4f06e3b8263                    rootvg          active

hdisk2          000ce4f0d68912aa                    None            

 

然后新增VG,运行命令 smit vg 如下保守些可以先选择List All Volume Groups查看确认当前系统已有vg,然后F3回到下面菜单选择Add a Volume Group

 

                                                        Volume Groups

Move cursor to desired item and press Enter.

 

  List All Volume Groups

  Add a Volume Group

  Set Characteristics of a Volume Group

  List Contents of a Volume Group

  Remove a Volume Group

  Activate a Volume Group

  Deactivate a Volume Group

  Import a Volume Group

  Export a Volume Group

  Mirror a Volume Group

  Unmirror a Volume Group

  Synchronize LVM Mirrors

  Back Up a Volume Group

  Remake a Volume Group

  Preview Information about a Backup

  Verify the Readability of a Backup (Tape only)

  View the Backup Log

  List Files in a Volume Group Backup

  Restore Files in a Volume Group Backup

选择之后后面菜单如下,选择Add a Big Volume Group

注意:Add an Original Volume Group不使用,操作系统5.3大部分用Add a Big Volume Group

操作系统6.1大多选择Add a Scalable Volume Group 具体原因这里暂不讨论

                                                     Add a Volume Group

 

Move cursor to desired item and press Enter.

 

  Add an Original Volume Group

  Add a Big Volume Group

  Add a Scalable Volume Group

 

如下菜单中:

VOLUME GROUP name 输入VG名字ibmvg01

* PHYSICAL VOLUME names 选项F4选择 hdisk2

Force the creation of a volume group 请修改为YES 这个是同仁前辈经验

                                                   Add a Big Volume Group

 

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

 

                                                        [Entry Fields]

  VOLUME GROUP name                                  []

  Physical partition SIZE in megabytes                                       

* PHYSICAL VOLUME names                              []                      

  Force the creation of a volume group?               no                     

  Activate volume group AUTOMATICALLY                 yes                    

    at system restart?

  Volume Group MAJOR NUMBER                          []                      

  Create VG Concurrent Capable?                       no                      

运行lsvg –l

下面运行smit fs 选择Add / Change / Show / Delete File Systems

 

 

root@SVR059138[/]>smit fs

                                                        File Systems

 

Move cursor to desired item and press Enter.

 

  List All File Systems

  List All Mounted File Systems

  Add / Change / Show / Delete File Systems

  Mount a File System

  Mount a Group of File Systems

  Unmount a File System

  Unmount a Group of File Systems

  Verify a File System

  Backup a File System

  Restore a File System

  List Contents of a Backup

  Create and back up a snapshot

 

 

建立JFS2文件系统所以选择Enhanced Journaled File Systems

 

                                          Add / Change / Show / Delete File Systems

 

Move cursor to desired item and press Enter.

 

  Enhanced Journaled File Systems

  Journaled File Systems

  CDROM File Systems

  Network File System (NFS)

选择Add an Enhanced Journaled File System

                                               Enhanced Journaled File Systems

 

Move cursor to desired item and press Enter.

 

  Add an Enhanced Journaled File System

  Add an Enhanced Journaled File System on a Previously Defined Logical Volume

  Change / Show Characteristics of an Enhanced Journaled File System

  Remove an Enhanced Journaled File System

  Manage Quotas for an Enhanced Journaled File System

  Defragment an Enhanced Journaled File System

  List Snapshots for an Enhanced Journaled File System

  Create Snapshot for an Enhanced Journaled File System

  Mount Snapshot for an Enhanced Journaled File System

  Remove Snapshot for an Enhanced Journaled File System

  Unmount Snapshot for an Enhanced Journaled File System

  Change Snapshot for an Enhanced Journaled File System

  Rollback an Enhanced Journaled File System to a Snapshot

出现小窗口选择ibmvg01

                            Volume Group Name    

                                                 

 Move cursor to desired item and press Enter.    

                                                 

   rootvg                                        

   ibmvg01                                        

 

Unit Size 选择容量单位,下面是选择M为单位,也可以选择G为单位:

注意:建议计算下,给VG留下1G空余空间,若建立FS空间超过VG当前最大可用空间,执行会提示报错

 

 

                           Add an Enhanced Journaled File System

 

Type or select values in entry fields.      

Press Enter AFTER making all desired changes.

 

                                                        [Entry Fields]

  Volume group name                                   ibmvg01

  SIZE of file system

          Unit Size                                   Megabytes      

*         Number of units                            [50000]         

* MOUNT POINT                                        [/opt/IBM]

  Mount AUTOMATICALLY at system restart?              yes            

  PERMISSIONS                                         read/write     

  Mount OPTIONS                                      []              

  Block Size (bytes)                                  4096           

  Logical Volume for Log                                             

  Inline Log size (MBytes)                           []              

  Extended Attribute Format                           Version 1      

  ENABLE Quota Management?                            no             

正常运行完之后有如下提示

                                      COMMAND STATUS

 

Command: running       stdout: yes           stderr: no

 

Before command completion, additional instructions may appear below.

 

File system created successfully.

51247384 kilobytes total disk space.

New File System size is 102498304

运行完成lsvg ibmvg01验证下,确认

root@SVR059138[/]>lsvg ibmvg01

VOLUME GROUP:       ibmvg01                  VG IDENTIFIER: 000ce4f00000d60000000129d57707

21

VG STATE:           active                   PP SIZE:        64 megabyte(s)

VG PERMISSION:      read/write               TOTAL PPs:      799 (51136 megabytes)

MAX LVs:            512                      FREE PPs:       16 (1024 megabytes)

LVs:                2                        USED PPs:       783 (50112 megabytes)

OPEN LVs:           0                        QUORUM:         2

TOTAL PVs:          1                        VG DESCRIPTORS: 2

STALE PVs:          0                        STALE PPs:      0

ACTIVE PVs:         1                        AUTO ON:        yes

MAX PPs per VG:     130048                                   

MAX PPs per PV:     1016                     MAX PVs:        128

LTG size (Dynamic): 256 kilobyte(s)          AUTO SYNC:      no

HOT SPARE:          no                       BB POLICY:      relocatable

root@SVR059138[/]>df -g

Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on

/dev/hd4           4.00      2.55   37%     3527     1% /

/dev/hd2           7.00      5.18   27%    42053     4% /usr

/dev/hd9var        0.25      0.17   32%      568     2% /var

/dev/hd3           2.00      1.31   35%     7557     3% /tmp

/dev/hd1           1.00      1.00    1%       92     1% /home

/proc                 -         -    -         -     -  /proc

/dev/hd10opt      50.00      5.77   89%   108206     8% /opt

 

 

 

root@SVR059138[/]>smit mount

 

                                    Mount a File System

 

Move cursor to desired item and press Enter.

 

  List All Mounted File Systems

  Mount a File System

  Mount a Group of File Systems

 

 

                                    Mount a File System

 

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

 

                                                        [Entry Fields]

  FILE SYSTEM name                                   [/dev/fslv01]      

  DIRECTORY over which to mount                      [/opt/IBM]          

  TYPE of file system                                                   

  FORCE the mount?                                    no                

  REMOTE NODE containing the file system             []

    to mount                 

  Mount as a REMOVABLE file system?                   no                

  Mount as a READ-ONLY system?                        no                

  Disallow DEVICE access via this mount?              no                

  Disallow execution of SUID and sgid programs        no                

    in this file system?                                                

 

 

root@SVR059138[/]>df -g

Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on

/dev/hd4           4.00      2.55   37%     3527     1% /

/dev/hd2           7.00      5.18   27%    42053     4% /usr

/dev/hd9var        0.25      0.17   32%      568     2% /var

/dev/hd3           2.00      1.31   35%     7557     3% /tmp

/dev/hd1           1.00      1.00    1%       92     1% /home

/proc                 -         -    -         -     -  /proc

/dev/hd10opt      50.00      5.77   89%   108206     8% /opt

/dev/fslv01       48.88     48.87    1%        4     1% /opt/IBM

 

你可能感兴趣的:(AIX,disk,AIX磁盘)