小型机IBM P550 AIX 更换硬盘步骤 操作LVM及文件系统

1、列出系统上所有硬盘

# lspv
hdisk0          00f6ee8a7017d102                   rootvg          active

2、插入2块新硬盘,再次查看

lspv 查看设备上所有的硬盘,显示是否有ID,属于哪个VG,是否激活

# lspv
hdisk0          00f6ee8a7017d102                    rootvg          active
hdisk1          None                                None
hdisk2          None                                None

3、新硬盘换上去是none,需要启用此硬盘(分配ID),且加入卷组(加入卷组才能被文件系统使用)
# chdev -l hdisk1 -a pv=yes

hdisk1 changed

# lspv
hdisk0          00f6ee8a7017d102                    rootvg          active
hdisk1          00f6ee8a7374ce47                    None           
hdisk2          00cc10bdfb23ea2a            None

4、创建VG,把硬盘加入到VG
# smit vg

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

F1=Help                       F2=Refresh                     F3=Cancel                     Esc+8=Image
Esc+9=Shell                   Esc+0=Exit                     Enter=Do

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

# smit vg

Add an Original 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

第一行填写VG名称
第二行填写VG的PP大小,未填写则使用默认值
第三回选择(esc+4)使用哪个pv来创建VG

创建完成查看VG
# lsvg
rootvg
testvg

5、有了VG,可以创建LV、创建fs、挂载fs

# smit lv

Add a Logical Volume

Type or select a value for the entry field.
Press Enter AFTER making all desired changes.
 
                                                        [Entry Fields]
* VOLUME GROUP name                                  [testvg]

选择要创建lv的vg,开始创建

Add a Logical Volume

Type or select values in entry fields.
Press Enter AFTER making all desired changes.
 
[TOP]                                                   [Entry Fields]
  Logical volume NAME                                []
* VOLUME GROUP name                                   testvg
* Number of LOGICAL PARTITIONS                       []                                                                 #
  PHYSICAL VOLUME names                              []                                                                +
  Logical volume TYPE                                []                                                                +
  POSITION on physical volume                         middle                                                           +
  RANGE of physical volumes                           minimum                                                          +
  MAXIMUM NUMBER of PHYSICAL VOLUMES                 []                                                                 #
    to use for allocation
  Number of COPIES of each logical                    1                                                                +
    partition
  Mirror Write Consistency?                           active                                                           +
  Allocate each logical partition copy                yes                                                              +
    on a SEPARATE physical volume?
  RELOCATE the logical volume during                  yes                                                              +
    reorganization?
  Logical volume LABEL                               []
  MAXIMUM NUMBER of LOGICAL PARTITIONS               [512]                                                              #
  Enable BAD BLOCK relocation?                        yes                                                              +
  SCHEDULING POLICY for reading/writing               parallel                                                         +
[MORE...5]

输入lv的name
可以使用的lp数量
使用的pv
lv type,文件系统类型   jfs2为日志文件系统

创建完成即可创建文件系统,挂载文件系统
                                                       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

# smit fs

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                                   testvg
  SIZE of file system
          Unit Size                                   Megabytes                                                        +
*         Number of units                            []                                                                 #
* MOUNT POINT                                        []
  Mount AUTOMATICALLY at system restart?              no                                                               +
  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?

填写此文件系统使用多少个M
选择挂载点

完成后挂载此文件系统即可

Mount a File System

Type or select values in entry fields.
Press Enter AFTER making all desired changes.
 
                                                        [Entry Fields]
  FILE SYSTEM name                                   []                                                                +
  DIRECTORY over which to mount                      []                                                                +
  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?

然后查看vg中的lv是否被创建(这里每个LP都对应有1个PV,说明此vg没有做镜像raid1.
如果有镜像,则会显示每个LP(逻辑分区)对应两倍的PP(物理分区),也就是PP是LP的两倍)
# lsvg -l testvg
testvg:
LV NAME             TYPE       LPs   PPs   PVs  LV STATE      MOUNT POINT
testlv1             jfs        2     2     2    closed/syncd  N/A
loglv00             jfs2log    1     1     2    open/syncd    N/A
fslv01              jfs2       16    16    2    open/syncd    /dir2
#

再查看hdisk2里面是否存在lv和文件系统
# lspv -l hdisk2
hdisk2:
LV NAME               LPs   PPs   DISTRIBUTION          MOUNT POINT
loglv00               1     1     00..01..00..00..00    N/A
fslv01                16    16    00..16..00..00..00    /dir2
testlv1               2     2     00..02..00..00..00    N/A
#

# df -m
Filesystem    MB blocks      Free %Used    Iused %Iused Mounted on
/dev/hd4         128.00    116.51    9%     1610     6% /
/dev/hd2        1280.00    110.46   92%    27968    51% /usr
/dev/hd9var      128.00    119.88    7%      348     2% /var
/dev/hd3        1152.00   1148.43    1%       63     1% /tmp
/dev/fwdump      384.00    319.45   17%        5     1% /var/adm/ras/platform
/dev/hd1         128.00    127.61    1%       11     1% /home
/proc                 -         -    -         -     -  /proc
/dev/hd10opt     128.00     55.39   57%     2320    16% /opt
/dev/fslv01     2048.00   2047.36    1%        5     1% /dir2
# mount
  node       mounted        mounted over    vfs       date        options      
-------- ---------------  ---------------  ------ ------------ ---------------
         /dev/hd4         /                jfs2   Jan 01 22:38 rw,log=/dev/hd8
         /dev/hd2         /usr             jfs2   Jan 01 22:38 rw,log=/dev/hd8
         /dev/hd9var      /var             jfs2   Jan 01 22:38 rw,log=/dev/hd8
         /dev/hd3         /tmp             jfs2   Jan 01 22:38 rw,log=/dev/hd8
         /dev/fwdump      /var/adm/ras/platform jfs2   Jan 01 22:40 rw,log=/dev/hd8
         /dev/hd1         /home            jfs2   Jan 01 22:40 rw,log=/dev/hd8
         /proc            /proc            procfs Jan 01 22:40 rw              
         /dev/hd10opt     /opt             jfs2   Jan 01 22:40 rw,log=/dev/hd8
         /dev/fslv01      /dir2            jfs2   Jan 01 23:26 rw,log=/dev/loglv00
#

文件系统是否存在且已经挂载

# df -m
Filesystem    MB blocks      Free %Used    Iused %Iused Mounted on
/dev/hd4         128.00    116.51    9%     1610     6% /
/dev/hd2        1280.00    110.46   92%    27968    51% /usr
/dev/hd9var      128.00    119.88    7%      348     2% /var
/dev/hd3        1152.00   1148.43    1%       63     1% /tmp
/dev/fwdump      384.00    319.45   17%        5     1% /var/adm/ras/platform
/dev/hd1         128.00    127.61    1%       11     1% /home
/proc                 -         -    -         -     -  /proc
/dev/hd10opt     128.00     55.39   57%     2320    16% /opt
/dev/fslv01     2048.00   2047.36    1%        5     1% /dir2
# mount
  node       mounted        mounted over    vfs       date        options      
-------- ---------------  ---------------  ------ ------------ ---------------
         /dev/hd4         /                jfs2   Jan 01 22:38 rw,log=/dev/hd8
         /dev/hd2         /usr             jfs2   Jan 01 22:38 rw,log=/dev/hd8
         /dev/hd9var      /var             jfs2   Jan 01 22:38 rw,log=/dev/hd8
         /dev/hd3         /tmp             jfs2   Jan 01 22:38 rw,log=/dev/hd8
         /dev/fwdump      /var/adm/ras/platform jfs2   Jan 01 22:40 rw,log=/dev/hd8
         /dev/hd1         /home            jfs2   Jan 01 22:40 rw,log=/dev/hd8
         /proc            /proc            procfs Jan 01 22:40 rw              
         /dev/hd10opt     /opt             jfs2   Jan 01 22:40 rw,log=/dev/hd8
         /dev/fslv01      /dir2            jfs2   Jan 01 23:26 rw,log=/dev/loglv00
#

/dev/fslv01就是我创建的大小为2G,挂载到/dir2目录下的文件系统

6、创建lvm镜像,保护文件系统,相当于raid1

把第三块盘hdisk2也加入到testvg,硬盘只有在同一个VG中才能相互做镜像

extendvg testvg hdisk2

查看下
# lspv
hdisk0          00cb5c8e000ce37c                    rootvg          active
hdisk1          00cb5c8e0014cf4b                    testvg          active
hdisk2          00cc10bdfb23ea2a                    testvg          active

开始做镜像
# smit mirrorvg

Mirror a Volume Group

Type or select a value for the entry field.
Press Enter AFTER making all desired changes.

[Entry Fields]
* VOLUME GROUP name                                  [testvg]

Mirror a Volume Group

Type or select values in entry fields.
Press Enter AFTER making all desired changes.

[Entry Fields]
* VOLUME GROUP name                                   testvg
  Mirror sync mode                                   [Foreground]                                                      +
  PHYSICAL VOLUME names                              []                                                                +
  Number of COPIES of each logical                    2                                                                +
    partition
  Keep Quorum Checking On?                            no                                                               +
  Create Exact LV Mapping?                            no                                                               +

完成以后再次查看vg详情

# lsvg -l testvg
testvg:
LV NAME             TYPE       LPs   PPs   PVs  LV STATE      MOUNT POINT
testlv1             jfs        2     4     2    closed/syncd  N/A
loglv00             jfs2log    1     2     2    open/syncd    N/A
fslv01              jfs2       16    32    2    open/syncd    /dir2
#

现在每个LP已经对应了两个PP,说明testvg已经存在副本(copies),已经做了raid1镜像。
这样,hdisk1或者hdisk2任意一个pv坏掉,都不影响数据访问。

7、实验:假设hdisk1坏掉,hdisk,/dir2中的file是否还存在。如何更换新硬盘,重建raid1

# lspv
hdisk0          00cb5c8e000ce37c                    rootvg          active
hdisk1          00cb5c8e0014cf4b                    testvg          active
hdisk2          00cc10bdfb23ea2a                    testvg          active
           
# lsvg -p testvg
testvg:
PV_NAME           PV STATE          TOTAL PPs   FREE PPs    FREE DISTRIBUTION
hdisk1            active            546         527         110..90..109..109..109
hdisk2            active            546         527         110..90..109..109..109
#

拔掉hdisk1
# lspv
hdisk0          00cb5c8e000ce37c                    rootvg          active
hdisk1          00cb5c8e0014cf4b                    testvg          active
hdisk2          00cc10bdfb23ea2a                    testvg          active
           
# lsvg -p testvg
testvg:
PV_NAME           PV STATE          TOTAL PPs   FREE PPs    FREE DISTRIBUTION
hdisk1            active            546         527         110..90..109..109..109
hdisk2            active            546         527         110..90..109..109..109
#
lvm中显示hdisk2还在。

# cat /dir2/file2

hi you
#

文件系统正常(因为已经在hdisk3中做了备份)

查看系统错误日志errpt

# errpt
IDENTIFIER TIMESTAMP  T C RESOURCE_NAME  DESCRIPTION
8647C4E2   0102004170 P H hdisk2         DISK OPERATION ERROR
8647C4E2   0102004170 P H hdisk2         DISK OPERATION ERROR
8647C4E2   0102004170 P H hdisk2         DISK OPERATION ERROR
8647C4E2   0102004170 P H hdisk2         DISK OPERATION ERROR

显示hdisk2不可操作

重新扫描设备

# cfgmgr

再查看testvg
# lsvg -p testvg
0516-034 : Failed to open VG special file. Probable causeis the VG was forced offline. Execute the varyoffvg and varyonvgcommands to bring the VG online.#

vg已经掉线

# lspv
hdisk0          00cb5c8e000ce37c                    rootvg          active
hdisk1          00cb5c8e0014cf4b                    datevg          active
hdisk2          00cc10bdfb23ea2a                    testvg          
hdisk3          00cc10bd0015b0e6                    testvg          
hdisk4          00cc10bd001c1225                    None

此时testvg下的文件系统已经只可读,不可写。

直接拔掉硬盘导致vg挂掉。(这不是硬盘坏掉更换硬盘的步骤)
正常步骤先去掉镜像,踢出vg再拔掉坏盘。

现在插回hdisk2,也已经无法回复vg了。

只有重启之后,VG才自带恢复正常。

再次测试更换1块硬盘,hdisk2
lspv
lspv -l hdisk2
lsvg -l testvg
lspv -p hdisk3
rmlvcopy fslv01 1 hdisk2    去掉hdisk2中做了镜像的lv及fs
rmlvcopy loglv00 1 hdisk2

查看是否已经去掉
# lslv -l fslv01
fslv01:/dir2
PV                COPIES        IN BAND       DISTRIBUTION  
hdisk3            016:000:000   100%          000:016:000:000:000
fslv01已经不存在hdisk2里面了
lspv -l hdisk2    
lsvg -l testvg

已经去掉了,可以把hdisk2踢出vg

reducevg testvg hdisk2

lsvg -l testvg

# lspv
hdisk0          00cb5c8e000ce37c                    rootvg          active
hdisk1          00cb5c8e0014cf4b                    datevg          active
hdisk2          00cc10bdfb23ea2a                    None            
hdisk3          00cc10bd0015b0e6                    testvg          active

再然后,从系统中删除hdisk2的磁盘定义

# rmdev -dl hdisk2                     
hdisk2 deleted
# lspv
hdisk0          00cb5c8e000ce37c                    rootvg          active
hdisk1          00cb5c8e0014cf4b                    datevg          active
hdisk3          00cc10bd0015b0e6                    testvg          active
           
# lsdev -Cc disk
hdisk0 Available 08-08-00-4,0 16 Bit LVD SCSI Disk Drive
hdisk1 Available 08-08-00-5,0 16 Bit LVD SCSI Disk Drive
hdisk3 Available 08-08-01-5,0 16 Bit LVD SCSI Disk Drive
hdisk4 Available 08-08-01-8,0 16 Bit LVD SCSI Disk Drive

现在,hdisk2可以从设备中拔出来了。
更换上新硬盘

让系统扫描设备,发现新硬盘

# cfgmgr -v
lspv
lsdev -Cc disk
就可以看到新硬盘

加入vg,创建镜像

extendvg testvg hdisk2
# mklvcopy loglv00 2 hdisk2
# lspv -l hdisk2
hdisk2:
LV NAME               LPs   PPs   DISTRIBUTION          MOUNT POINT
loglv00

分别把testvg中所有的lv和fs都mklvcopy一下。

查看状态,fslv01已经存在copies了,分别在hdisk2和hdisk3中
# lslv -l fslv01
fslv01:/dir2
PV                COPIES        IN BAND       DISTRIBUTION  
hdisk3            016:000:000   100%          000:016:000:000:000
hdisk2            016:000:000   100%          000:016:000:000:000
#

# lsvg -l testvg
testvg:
LV NAME             TYPE       LPs   PPs   PVs  LV STATE      MOUNT POINT
testlv1             jfs        2     4     2    closed/stale  N/A
loglv00             jfs2log    1     2     2    open/stale    N/A
fslv01              jfs2       16    32    2    open/stale    /dir2

此时LV state状态是stale,非正常的已经同步状态

接着需要同步lv镜像

# syncvg -p hdisk2

查看状态
# lsvg -l testvg
testvg:
LV NAME             TYPE       LPs   PPs   PVs  LV STATE      MOUNT POINT
testlv1             jfs        2     4     2    closed/syncd  N/A
loglv00             jfs2log    1     2     2    open/syncd    N/A
fslv01              jfs2       16    32    2    open/syncd    /dir2
#

此时已经VG中的LV已经恢复正常,同步完成。

到此更换硬盘的整个步骤以及完成。

other :
清除机器面板黄灯告警。
# /usr/lpp/diagnostics/bin/usysfault -s normal

时间: 2024-08-04 06:53:54

小型机IBM P550 AIX 更换硬盘步骤 操作LVM及文件系统的相关文章

IBM Aix系统 rootvg 镜像卷更换坏硬盘步骤

场景: 系统用hdisk0和hdiak1两块硬盘建立了rootvg的镜像 hdisk0故障需要更换的硬盘是hdisk0 步骤: 1. 把hdisk0从rootvg镜像中删除 #unmirrorvgrootvg hdisk0 如果在失效PV上有专用转储设备,那么可以使用mklv命令在现有PV上创建新的逻辑卷.使用sysdumpdev命令将新的逻辑卷设置为主转储设备.转储设备必须没有镜像,确保只有一个副本. mklv -t sysdump -y lg_dumplvrootvg 8 hdisk1 sy

(转)AIX下镜像制作与取消,更换硬盘问题

AIX下镜像制作与取消,更换硬盘问题 ROOTVG做镜像问题: 下面命令全部在AIX5.4上运行通过 # lspv hdisk0      000a1ddc7f36a2f0      rootvg      active hdisk1      none                            None         #chdev -l hdisk1 -a pv=clear #chdev -l hdisk1 -a pv=yes hdisk1 changed # lspv hdis

IBM DS4700存储更换控制器电池

存储控制器中都会使用电池来保证当发生意外断电时,cache中的数据可以写到硬盘上,而不会丢失.一般存储电池的寿命为3年. 今天为客户的 DS4700存储更换了电池,在这里记录一下更换步骤及注意事项 更换步骤: 使用SM软件登陆到DS4700的管理界面上,注意连接方式,DS4700 2个控制器的管理口都要连通,可以将2个控制器的管理口和笔记本都连接到1台傻瓜交换机上,能ping通默认的管理IP. 管理口 默认IP 控制器1管理口1 192.168.128.101 控制器1管理口2 192.168.

为安装有系统及应用程序的服务器更换硬盘方法一例

前几天给一个客户新配置了台服务器,该服务器配置了3块1 TB的7200转的SAS硬盘,该服务器外接了一个光纤存储.客户反应服务器很慢,主要是在数据拷贝时慢. 工程师到现场之后测试,发现在存储之间拷贝数据能到300-500MB/s,而在服务器本地硬盘拷贝数据只有30多MB/s.问题出在配置的这3块1TB的硬盘上(做的RAID5).客户有一台同型号的服务器,是2块600GB的15000转的SAS硬盘(RAID1),服务器本地硬盘速度在100-130MB之间. 看来问题是出在这3块7200转的磁盘上.

为安装有系统及应用的服务器更换硬盘方法一例

为安装有系统及应用的服务器更换硬盘方法一例 前几天给一个客户新配置了台服务器,该服务器配置了3块1 TB的7200转的SAS硬盘,该服务器外接了一个光纤存储.客户反应服务器很慢,主要是在数据拷贝时慢. 工程师到现场之后测试,发现在存储之间拷贝数据能到300-500MB/s,而在服务器本地硬盘拷贝数据只有30多MB/s.问题出在配置的这3块1TB的硬盘上(做的RAID5).客户有一台同型号的服务器,是2块600GB的15000转的SAS硬盘(RAID1),服务器本地硬盘速度在100-130MB之间

深入探析 Rational AppScan Standard Edition 多步骤操作

序言 IBM Rational AppScan Standard(下文简称 AppScan)作为面向 Web 应用安全黑盒检测的自动化工具,得到业界的广泛认可和应用.很多人使用 AppScan 时都采用其强大的手工探索加自动探测的方式,然而这种方式并不适用于所有场景.使用 AppScan 进行安全扫描时,我们必须保证 AppScan 探索出来的 URL 的有效性(尤其是用户想导出这些探索结果以供复用的情况下),有效性即指该 URL 对应的 HTTP 请求能被服务器端接受并按照期望的方式进行处理.

linux下硬盘的操作

linux的磁盘管理:他的目录和磁盘分区相互独立,用挂载相互关联,卸载取消关联. 1.fdisk fdisk -l     用来列出来我们硬盘的分区情况 fdisk /dev/sda 用来管理sda硬盘,比如说增.删等等操作,具体的可以用fdisk -m 来查看命令 2.mkfs 用来格式化分区,或者说是给分区格式化他的文件系统.用命令 ls /sbin/mkfs* 可以查看我们有那些可以使用的文件系统. 比如用命令  mkfs -t ext4 /dev/ext4   就可以给相应的分区make

HP DL580G7更换硬盘

一 故障现象:硬盘灯告警 二 故障分析:硬盘fault 三 处理过程: 现场查看发现主机配置两块300GB硬盘,且系统正常运行.判断主机应该做了riad 1(fdisk -l命令显示逻辑盘的大小为300GB) 在线更换硬盘 more /var/log/messages查看是否有卷组重建的日志

在按照ROS官方步骤操作,同时用Git管理整个过程,git clone的新catkin_ws报错: catkin_package() include dir 'include' does not exist relative to

在按照ROS官方步骤操作,同时用Git管理整个过程,git clone的新catkin_ws报错如下: CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkin_package.cmake:302 (message): catkin_package() include dir 'include' does not exist relative to '/home/username/catkin_ws/src/beginner_tutori