Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Minicomputer IBM P550 AIX steps to replace hard disk operation LVM and text

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1. List all hard drives on the system

# lspv

Hdisk0 00f6ee8a7017d102 rootvg active

2. Insert 2 new hard drives and check again

Lspv looks at all the hard drives on the device and shows whether there is ID, which VG it belongs to, and whether it is activated.

# lspv

Hdisk0 00f6ee8a7017d102 rootvg active

Hdisk1 None None

Hdisk2 None None

3. Replace the new hard disk with none. You need to enable this hard disk (assign ID) and join the volume group (join the volume group to be used by the file system).

# chdev-l hdisk1-a pv=yes

Hdisk1 changed

# lspv

Hdisk0 00f6ee8a7017d102 rootvg active

Hdisk1 00f6ee8a7374ce47 None

Hdisk2 00cc10bdfb23ea2a None

4. Create a VG and add the hard disk to the 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 +

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

Fill in the VG name on the first line

On the second line, fill in the PP size of VG. If it is left empty, use the default value.

Choose which pv to use to create the VG for the third time (esc+4)

# lsvg

Rootvg

Testvg

5. With VG, you can create LV, create fs, and mount 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]

Select the vg where you want to create the lv, and start creating the

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]

Enter the name of the lv

Number of lp that can be used

Pv used

Lv type. File system type jfs2 is journaled file system.

Once created, you can create a file system and mount the file system.

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?

Fill in how many Ms are used by this file system

Select mount point

When you are finished, mount this file system.

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?

Then check whether the lv in the vg has been created (here there is a PV for each LP, indicating that this vg is not a mirror raid1.

If there is a mirror, it will show that each LP (logical partition) corresponds to twice the PP (physical partition), that is, PP is twice as much as 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

#

Then check to see if lv and file system exist in hdisk2

# 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 per cent / var

/ dev/hd3 1152.00 1148.43 1% 63 1% / tmp

/ dev/fwdump 384.00 319.45 17% 51% / 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% 51% / 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

#

Whether the file system exists and has been mounted

# 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 per cent / var

/ dev/hd3 1152.00 1148.43 1% 63 1% / tmp

/ dev/fwdump 384.00 319.45 17% 51% / 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% 51% / 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 is the file system I created with a size of 2G and mounted to the / dir2 directory

6. Create a lvm image to protect the file system, which is equivalent to raid1

Add the third disk hdisk2 to the testvg. Hard drives can mirror each other only in the same VG.

Extendvg testvg hdisk2

Check it.

# lspv

Hdisk0 00cb5c8e000ce37c rootvg active

Hdisk1 00cb5c8e0014cf4b testvg active

Hdisk2 00cc10bdfb23ea2a testvg active

Start mirroring.

# 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 +

Check the vg details again when you are finished

# 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

#

Now there are two PP for each LP, which means that the testvg already has a copies and has been mirrored as a raid1.

In this way, the failure of either hdisk1 or hdisk2 pv does not affect data access.

7. Experiment: assuming that hdisk1 is broken, whether the file in hdisk,/dir2 still exists. How to replace a new hard disk and rebuild 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

#

Unplug the 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

#

The lvm shows that hdisk2 is still there.

# cat / dir2/file2

Hi you

#

The file system is normal (because it has been backed up in hdisk3)

View the system error log 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

Show that hdisk2 is not operable

# cfgmgr

Check testvg again.

# lsvg-p testvg

Probable causeis the VG was forced offline. Execute the varyoffvg and varyonvgcommands to bring the VG online.#

Vg has been dropped.

# lspv

Hdisk0 00cb5c8e000ce37c rootvg active

Hdisk1 00cb5c8e0014cf4b datevg active

Hdisk2 00cc10bdfb23ea2a testvg

Hdisk3 00cc10bd0015b0e6 testvg

Hdisk4 00cc10bd001c1225 None

At this point, the file system under testvg is only readable and unwritable.

Unplug the hard drive directly and cause the vg to hang up. (this is not a step to replace a hard drive when it is broken.)

The normal step is to remove the image, kick out the vg, and then unplug the bad disk.

Now that you plug it back into hdisk2, you can no longer reply to vg.

Only after rebooting will VG return to normal with its own.

Test and replace 1 hard drive again, hdisk2

Lspv

Lspv-l hdisk2

Lsvg-l testvg

Lspv-p hdisk3

Rmlvcopy fslv01 1 hdisk2 removes mirrored lv and fs from hdisk2

Rmlvcopy loglv00 1 hdisk2

Check to see if it has been removed

# lslv-l fslv01

Fslv01:/dir2

PV COPIES IN BAND DISTRIBUTION

Hdisk3 016Rd 000RU 000 100% 000R 016Rd 000RU 000RU 000

Lspv-l hdisk2

Lsvg-l testvg

It has been removed. You can kick hdisk2 out of vg.

Reducevg testvg hdisk2

Lsvg-l testvg

# lspv

Hdisk0 00cb5c8e000ce37c rootvg active

Hdisk1 00cb5c8e0014cf4b datevg active

Hdisk2 00cc10bdfb23ea2a None

Hdisk3 00cc10bd0015b0e6 testvg active

Then, delete the disk definition of hdisk2 from the system

# 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 hdisk0 Available 0 16 Bit LVD SCSI Disk Drive

Hdisk1 Available 08-08-00-5 hdisk1 Available 0 16 Bit LVD SCSI Disk Drive

Hdisk3 Available 08-08-01-5 hdisk3 Available 0 16 Bit LVD SCSI Disk Drive

Hdisk4 Available 08-08-01-8 hdisk4 Available 0 16 Bit LVD SCSI Disk Drive

Now the hdisk2 can be unplugged from the device.

Replace a new hard drive

Let the system scan the device and find a new hard drive

# cfgmgr-v

Lspv

Lsdev-Cc disk

You can see the new hard drive.

Join vg and create an image

Extendvg testvg hdisk2

# mklvcopy loglv00 2 hdisk2

# lspv-l hdisk2

Hdisk2:

LV NAME LPs PPs DISTRIBUTION MOUNT POINT

Loglv00

Mklvcopy all the lv and fs in the testvg respectively.

Check the status. Copies already exists in fslv01, which is in hdisk2 and hdisk3 respectively.

# lslv-l fslv01

Fslv01:/dir2

PV COPIES IN BAND DISTRIBUTION

Hdisk3 016Rd 000RU 000 100% 000R 016Rd 000RU 000RU 000

Hdisk2 016Rd 000RU 000 100% 000R 016Rd 000RU 000RU 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

At this time, the LV state status is stale, and the abnormal synchronized state

Then you need to synchronize the lv mirror

# syncvg-p hdisk2

View statu

# 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

#

At this point, the LV in the VG has returned to normal and the synchronization is complete.

At this point, the whole step of replacing the hard drive is completed.

Other:

Clear the yellow light alarm on the machine panel.

# / usr/lpp/diagnostics/bin/usysfault-s normal

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report