溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

小型機(jī)IBM P550 AIX 更換硬盤步驟 操作LVM及文

發(fā)布時(shí)間:2020-08-03 14:04:27 來源:網(wǎng)絡(luò) 閱讀:7418 作者:redmaple34 欄目:系統(tǒng)運(yùn)維

1、列出系統(tǒng)上所有硬盤

# lspv
hdisk0          00f6ee8a7017d102                   rootvg          active


2、插入2塊新硬盤,再次查看

lspv 查看設(shè)備上所有的硬盤,顯示是否有ID,屬于哪個(gè)VG,是否激活

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

3、新硬盤換上去是none,需要啟用此硬盤(分配ID),且加入卷組(加入卷組才能被文件系統(tǒng)使用)
# chdev -l hdisk1 -a pv=yes

hdisk1 changed

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

4、創(chuàng)建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大小,未填寫則使用默認(rèn)值
第三回選擇(esc+4)使用哪個(gè)pv來創(chuàng)建VG


創(chuàng)建完成查看VG
# lsvg
rootvg
testvg

5、有了VG,可以創(chuàng)建LV、創(chuàng)建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]

選擇要?jiǎng)?chuàng)建lv的vg,開始創(chuàng)建

                                                   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數(shù)量
使用的pv
lv type,文件系統(tǒng)類型   jfs2為日志文件系統(tǒng)


創(chuàng)建完成即可創(chuàng)建文件系統(tǒng),掛載文件系統(tǒng)
                                                       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?  

填寫此文件系統(tǒng)使用多少個(gè)M
選擇掛載點(diǎn)

完成后掛載此文件系統(tǒng)即可

                                                   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是否被創(chuàng)建(這里每個(gè)LP都對應(yīng)有1個(gè)PV,說明此vg沒有做鏡像raid1.
如果有鏡像,則會(huì)顯示每個(gè)LP(邏輯分區(qū))對應(yīng)兩倍的PP(物理分區(qū)),也就是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和文件系統(tǒng)
# 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
#


文件系統(tǒng)是否存在且已經(jīng)掛載

# 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就是我創(chuàng)建的大小為2G,掛載到/dir2目錄下的文件系統(tǒng)




6、創(chuàng)建lvm鏡像,保護(hù)文件系統(tǒng),相當(dāng)于raid1

把第三塊盤hdisk2也加入到testvg,硬盤只有在同一個(gè)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
#

現(xiàn)在每個(gè)LP已經(jīng)對應(yīng)了兩個(gè)PP,說明testvg已經(jīng)存在副本(copies),已經(jīng)做了raid1鏡像。
這樣,hdisk1或者h(yuǎn)disk2任意一個(gè)pv壞掉,都不影響數(shù)據(jù)訪問。



7、實(shí)驗(yàn):假設(shè)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
#

文件系統(tǒng)正常(因?yàn)橐呀?jīng)在hdisk3中做了備份)

查看系統(tǒng)錯(cuò)誤日志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不可操作




重新掃描設(shè)備

# 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已經(jīng)掉線

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

此時(shí)testvg下的文件系統(tǒng)已經(jīng)只可讀,不可寫。



直接拔掉硬盤導(dǎo)致vg掛掉。(這不是硬盤壞掉更換硬盤的步驟)
正常步驟先去掉鏡像,踢出vg再拔掉壞盤。

現(xiàn)在插回hdisk2,也已經(jīng)無法回復(fù)vg了。

只有重啟之后,VG才自帶恢復(fù)正常。

再次測試更換1塊硬盤,hdisk2
lspv
lspv -l hdisk2
lsvg -l testvg
lspv -p hdisk3
rmlvcopy fslv01 1 hdisk2    去掉hdisk2中做了鏡像的lv及fs
rmlvcopy loglv00 1 hdisk2


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

已經(jīng)去掉了,可以把hdisk2踢出vg

reducevg testvg hdisk2

lsvg -l testvg

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


再然后,從系統(tǒng)中刪除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

現(xiàn)在,hdisk2可以從設(shè)備中拔出來了。
更換上新硬盤

讓系統(tǒng)掃描設(shè)備,發(fā)現(xiàn)新硬盤

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


加入vg,創(chuàng)建鏡像

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

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

查看狀態(tài),fslv01已經(jīng)存在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

此時(shí)LV state狀態(tài)是stale,非正常的已經(jīng)同步狀態(tài)


接著需要同步lv鏡像

# syncvg -p hdisk2

查看狀態(tài)
# 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
#

此時(shí)已經(jīng)VG中的LV已經(jīng)恢復(fù)正常,同步完成。

到此更換硬盤的整個(gè)步驟以及完成。



other :
清除機(jī)器面板黃燈告警。
# /usr/lpp/diagnostics/bin/usysfault -s normal

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI