Tuesday, September 1, 2009

root disk or root mirror disk with Veritas Volume Manager (tm) 3.5 and above on HP-UX 11i

1. Remove the disk with option 3 of vxdiskadm

Volume Manager Support Operations
Menu: VolumeManager/Disk

1 Add or initialize one or more disks
2 Remove a disk
3 Remove a disk for replacement
4 Replace a failed or removed disk
5 Mirror volumes on a disk
6 Move volumes from a disk
7 Enable access to (import) a disk group
8 Remove access to (deport) a disk group
9 Enable (online) a disk device
10 Disable (offline) a disk device
11 Mark a disk as a spare for a disk group
12 Turn off the spare flag on a disk
13 Remove (deport) and destroy a disk group
14 Unrelocate subdisks back to a disk
15 Exclude a disk from hot-relocation use
16 Make a disk available for hot-relocation use
17 Prevent multipathing/Suppress devices from VxVM's view
18 Allow multipathing/Unsuppress devices from VxVM's view
19 List currently suppressed/non-multipathed devices
20 Change the disk naming scheme
list List disk information

? Display help about menu
?? Display help about the menuing system
q Exit from menus

Select an operation to perform:
3

Remove a disk for replacement
Menu: VolumeManager/Disk/RemoveForReplace

Use this menu operation to remove a physical disk from a disk
group, while retaining the disk name. This changes the state
for the disk name to a "removed" disk. If there are any
initialized disks that are not part of a disk group, you will be
given the option of using one of these disks as a replacement.

Enter disk name [,list,q,?] list

Disk group: rootdg

DM NAME DEVICE TYPE PRIVLEN PUBLEN STATE

dm rootdisk01 c0t1d0 simple 1024 4188096 -
dm rootdisk02 c0t2d0 simple 1024 4188096 -

Enter disk name [,list,q,?]
rootdisk01

The following volumes will lose mirrors as a result of this
operation:

rootvol standvol swapvol

No data on these volumes will be lost.

The following devices are available as replacements:

c0t3d0

You can choose one of these disks now, to replace rootdisk01.
Select "none" if you do not wish to select a replacement disk.

Choose a device, or select "none"
[,none,q,?] (default: c0t3d0)
none


The requested operation is to remove disk rootdisk01 from disk group
rootdg. The disk name will be kept, along with any volumes using
the disk, allowing replacement of the disk.

Select "Replace a failed or removed disk" from the main menu
when you wish to replace the disk.

Continue with operation? [y,n,q,?] (default: y) y

Removal of disk rootdisk01 completed successfully.

Remove another disk? [y,n,q,?] (default: n) n


2. Rescan the devices and initialize the replaced disk:

# vxdctl enable
# /etc/vx/bin/vxdiskunsetup -C

For VxVM 3.5 on HP-UX 11iv1:

# /etc/vx/bin/vxdisksetup -iB

For VxVM 4.1/5.0 on HP-UX 11iv2 and 11iv3:

# /etc/vx/bin/vxdisksetup -iB format=hpdisk


Note: The -B option is necessary to initialize the bootable Veritas Volume Manager (VxVM) disk. Refer to the
vxdisksetup man page for details


3. Replace the failed disk with option 4
of vxdiskadm

Menu: VolumeManager/Disk

1 Add or initialize one or more disks
2 Remove a disk
3 Remove a disk for replacement
4 Replace a failed or removed disk
5 Mirror volumes on a disk
6 Move volumes from a disk
7 Enable access to (import) a disk group
8 Remove access to (deport) a disk group
9 Enable (online) a disk device
10 Disable (offline) a disk device
11 Mark a disk as a spare for a disk group
12 Turn off the spare flag on a disk
13 Remove (deport) and destroy a disk group
14 Unrelocate subdisks back to a disk
15 Exclude a disk from hot-relocation use
16 Make a disk available for hot-relocation use
17 Prevent multipathing/Suppress devices from VxVM's view
18 Allow multipathing/Unsuppress devices from VxVM's view
19 List currently suppressed/non-multipathed devices
20 Change the disk naming scheme
list List disk information

? Display help about menu
?? Display help about the menuing system
q Exit from menus

Select an operation to perform:
4

Replace a failed or removed disk
Menu: VolumeManager/Disk/ReplaceDisk

Use this menu operation to specify a replacement disk for a disk
that you removed with the "Remove a disk for replacement" menu
operation, or that failed during use. You will be prompted for
a disk name to replace and a disk device to use as a replacement.
You can choose an uninitialized disk, in which case the disk will
be initialized, or you can choose a disk that you have already
initialized using the Add or initialize a disk menu operation.

Select a removed or failed disk [,list,q,?] list

Disk group: rootdg

DM NAME DEVICE TYPE PRIVLEN PUBLEN STATE

dm rootdisk01 - - - - REMOVED

Select a removed or failed disk [,list,q,?]
rootdisk01

The following devices are available as replacements:

c0t1d0 c0t3d0

You can choose one of these disks to replace rootdisk01.
Choose "none" to initialize another disk to replace rootdisk01.

Choose a device, or select "none"
[,none,q,?] (default: c0t1d0)
c0t1d0

The requested operation is to use the initialized device c0t1d0
to replace the removed or failed disk rootdisk01 in disk group rootdg.

Continue with operation? [y,n,q,?] (default: y) y

Use a default private region length for the disk?
[y,n,q,?] (default: y) y

Replacement of disk rootdisk01 in group rootdg with disk device
c0t1d0 completed successfully.

Replace another disk? [y,n,q,?] (default: n) n


Now
vxrecover is in process ...

You can find out the remaining
vxrecover run time with the follow command:

# vxtask -l list

Task: 164 RUNNING
Type: PARENT
Operation: VXRECOVER DM rootdisk01
Started: Mon Sep 2 12:59:24 2002
Progress: 0.00% (1 job active)

Task: 165 RUNNING (Parent: 164)
Type: ATCOPY
Operation: PLXATT Vol rootvol Plex rootvol-01
Started: Mon Sep 2 12:59:24 2002
Throttle: 0
Progress: 63.52% 2182784 of 3436544 Blocks
Work time: 20 minutes, 50 seconds (11:57 remaining)


4. Verify the status of all volumes:

# vxprint -g rootdg -ht

dm rootdisk01 c0t1d0 simple 1024 4188096 -
dm rootdisk02 c0t2d0 simple 1024 4188096 -

v rootvol - ENABLED ACTIVE 3436544 SELECT - root
pl rootvol-01 rootvol ENABLED ACTIVE 3436544 CONCAT - RW
sd rootdisk01-03 rootvol-01 rootdisk01 729088 3436544 0 c0t1d0 ENA
pl rootvol-02 rootvol ENABLED ACTIVE 3436544 CONCAT - RW
sd rootdisk02-03 rootvol-02 rootdisk02 729088 3436544 0 c0t2d0 ENA

v standvol - ENABLED ACTIVE 204800 SELECT - fsgen
pl standvol-01 standvol ENABLED ACTIVE 204800 CONCAT - RW
sd rootdisk01-01 standvol-01 rootdisk01 0 204800 0 c0t1d0 ENA
pl standvol-02 standvol ENABLED ACTIVE 204800 CONCAT - RW
sd rootdisk02-01 standvol-02 rootdisk02 0 204800 0 c0t2d0 ENA

v swapvol - ENABLED ACTIVE 524288 SELECT - swap
pl swapvol-01 swapvol ENABLED ACTIVE 524288 CONCAT - RW
sd rootdisk01-02 swapvol-01 rootdisk01 204800 524288 0 c0t1d0 ENA
pl swapvol-02 swapvol ENABLED ACTIVE 524288 CONCAT - RW
sd rootdisk02-02 swapvol-02 rootdisk02 204800 524288 0 c0t2d0 ENA


5. Verify the Logical Interchange Format (LIF) and Volume Manager label information on the replaced disk:

# lifls -l /dev/rdsk/c0t1d0
lifls: Can't list /dev/rdsk/c0t1d0; not a LIF volume

# vxvmboot -v /dev/rdsk/c0t1d0
vxvmboot: Disk /dev/rdsk/c0t1d0 does not contain a valid LIF volume.


6. Write Volume Manager volume information to the
LABEL file:

# /opt/VRTS/bin/vxbootsetup rootdisk01


7. Display the LIF and Volume Manager label information:

# vxvmboot -v /dev/rdsk/c0t1d0

LIF Label File @ (1k) block # 1178 on VxVM Disk /dev/rdsk/c0t1d0:
Label Entry: 0, Boot Volume start: 3168; length: 200 MB
Label Entry: 1, Root Volume start: 732256; length: 3356 MB
Label Entry: 2, Swap Volume start: 207968; length: 512 MB
Label Entry: 3, Dump Volume start: 207968; length: 512 MB

# lifls -l /dev/rdsk/c0t1d0
volume ISL10 data size 7984 directory size 8 02/05/10 16:25:44
filename type start size implement created
===============================================================
ODE -12960 584 848 0 02/07/08 12:33:46
MAPFILE -12277 1432 128 0 02/07/08 12:33:46
SYSLIB -12280 1560 353 0 02/07/08 12:33:46
CONFIGDATA -12278 1920 235 0 02/07/08 12:33:46
SLMOD2 -12276 2160 141 0 02/07/08 12:33:46
SLDEV2 -12276 2304 135 0 02/07/08 12:33:46
SLDRV2 -12276 2440 205 0 02/07/08 12:33:46
SLSCSI2 -12276 2648 131 0 02/07/08 12:33:46
MAPPER2 -12279 2784 142 0 02/07/08 12:33:46
IOTEST2 -12279 2928 411 0 02/07/08 12:33:46
PERFVER2 -12279 3344 124 0 02/07/08 12:33:46
PVCU -12801 3472 64 0 02/07/08 12:33:46
SSINFO -12286 3536 2 0 02/07/08 12:33:46
ISL -12800 3544 306 0 02/05/10 16:25:44
HPUX -12928 3856 848 0 02/05/10 16:25:44
AUTO -12289 4704 1 0 02/05/10 16:25:44
LABEL BIN 4712 8 0 02/09/02 10:38:27


8. Boot the machine off the replaced disk

Saturday, August 22, 2009

RENAMING A LOGICAL VOLUME

RENAMING A LOGICAL VOLUME

Step 1: Identify the Logical Volume that needs to be changed

# vgdisplay -v /dev/vg01 | grep "LV Name"

LV Name /dev/vg01/lvol01

# bdf /dev/vg01/lvol01

Filesystem kbytes used avail %used Mounted on

/dev/vg01/lvol01 102400 1133 94945 1% /opt/test

# umount /opt/test

# ll /dev/vg01

total 0

crw------- 1 root sys 64 0x010000 Nov 5 12:18 group

brw------- 1 root sys 64 0x010001 Nov 5 12:19 lvol01

crw------- 1 root sys 64 0x010001 Nov 5 12:19 rlvol01

# cd /dev/vg01

# mv lvol01 lvol01_renamed

# mv rlvol01 rlvol01_renamed

# vgdisplay -v /dev/vg01 | grep "LV Name"

LV Name /dev/vg01_renamed/lvol01_renamed

VGEXPORT & VGIMPORT

VGEXPORT & VGIMPORT

Following example shows, how vgexport/vgimport can be used to change the Volume Group Names

# bdf /opt/test

Filesystem kbytes used avail %used Mounted on

/dev/vg01/lvol01 102400 1133 94945 1% /opt/test

# umount /opt/test

Step 1: Create a mapfile in the preview mode

# vgexport -p -v -s -m /tmp/vg01.map /dev/vg01

Beginning the export process on Volume Group "/dev/vg01".

Volume group "/dev/vg01" is still active.

/dev/dsk/c0t9d0

# vgchange -a n /dev/vg01

Volume group "/dev/vg01" has been successfully changed.

Step 2: Export the Volume Group

# vgexport /dev/vg01

# ll /dev/*/group

crw-r----- 1 root sys 64 0x000000 Oct 31 13:15 /dev/vg00/group

# mkdir /dev/vg01_renamed

# mknod /dev/vg01_renamed/group c 64 0x010000

Step 2: Import the Volume Group with a new name

# vgimport -v -s -m /tmp/vg01.map /dev/vg01_renamed

Beginning the import process on Volume Group "/dev/vg01_renamed".

Logical volume "/dev/vg01_renamed/lvol01" has been successfully created

with lv number 1.

Volume group "/dev/vg01_renamed" has been successfully created.

# vgchange -a y /dev/vg01_renamed

Activated volume group

Volume group "/dev/vg01_renamed" has been successfully changed.

# vgdisplay -v | grep "VG Name"

VG Name /dev/vg00

VG Name /dev/vg01_renamed

REMOVING A LOGICAL VOLUME

REMOVING A LOGICAL VOLUME

Step 1: Identify the Logical Volume(s) to remove

# bdf /opt/test

Filesystem kbytes used avail %used Mounted on

/dev/vg01/lvol01 102400 1133 94945 1% /opt/test

# umount /opt/test

# vgdisplay -v vg01 | grep "LV Name"

LV Name /dev/vg01/lvol01

# lvremove /dev/vg01/lvol01

The logical volume "/dev/vg01/lvol01" is not empty;

do you really want to delete the logical volume (y/n) : y

Logical volume "/dev/vg01/lvol01" has been successfully removed.

Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf

REDUCING A LOGICAL VOLUME

REDUCING A LOGICAL VOLUME

[CAUTION : DATA LOSS WILL OCCUR]

Step 1: Check the current size of the Logical Volume

# lvdisplay /dev/vg01/lvol01

--- Logical volumes ---

LV Name /dev/vg01/lvol01

VG Name /dev/vg01

LV Permission read/write

LV Status available/syncd

Mirror copies 0

Consistency Recovery MWC

Schedule parallel

LV Size (Mbytes) 120

Current LE 30

Allocated PE 30

Stripes 0

Stripe Size (Kbytes) 0

Bad block on

Allocation strict

IO Timeout (Seconds) default


# bdf /dev/vg01/lvol01

Filesystem kbytes used avail %used Mounted on

/dev/vg01/lvol01

122880 1133 114145 1% /opt/test

^

|

# fsadm -b 100m -F vxfs /opt/test

fsadm: /dev/vg01/rlvol01 is currently 122880 sectors - size will be reduced

# lvreduce -L 100 /dev/vg01/lvol01

When a logical volume is reduced useful data might get lost;

do you really want the command to proceed (y/n) : y

Logical volume "/dev/vg01_renamed/lvol01" has been successfully reduced.

Volume Group configuration for /dev/vg01_renamed has been saved in /etc/lvmconf/vg01_renamed.conf

# bdf /opt/test

Filesystem kbytes used avail %used Mounted on

/dev/vg01_renamed/lvol01

102400 1133 94945 1% /opt/test

^


# lvdisplay /dev/vg01/lvol01

--- Logical volumes ---

LV Name /dev/vg01/lvol01

VG Name /dev/vg01

LV Permission read/write

LV Status available/syncd

Mirror copies 0

Consistency Recovery MWC

Schedule parallel

LV Size (Mbytes) 100

Current LE 25

Allocated PE 25

Stripes 0

Stripe Size (Kbytes) 0

Bad block on

Allocation strict

IO Timeout (Seconds) default