VxVM-TIPS

13
TIPS FOR VXVM ADMIN COMMANDS : 1) To start up Volume Manager from the command line - vxiod set 10 - vxconfigd -d - vxdctl init - vxdctl enable 2) Un-mirror the rootdisk using VMSA: - Start-up Veritas Volume Manager - Select the root volume - Right click, and select mirror - Then select disable - Choose rootvol-02 to disable - Do the same steps for /usr, and any swap volumes that are mirrored - Then get out of Volume Manager 3) Unmirror the roort disk using command line run: - vxplex -o rm dis rootvol-01 - vxplex -o rm dis swapvol-01 (if needed) - vxplex -o rm dis usrvol-01 (if needed) 4) Un-Encapsulate root disk 1. boot single user mode from cdrom or net ok> boot cdrom -s or boot net -s 2. fsck the root filesystem # fsck -y /dev/rdsk/c0t0d0s0 3. mount the root filesystem on /a # mount /dev/dsk/c0t0d0s0 /a 4. cp /a/etc/system /a/etc/system.vxvm 5. vi /a/etc/system and remove the following 2 entries rootdev:/pseudo/vxio@0:0 set vxio:vol_rootdev_is_volume=1

description

vxvm

Transcript of VxVM-TIPS

TIPS FOR VXVM ADMIN COMMANDS :

TIPS FOR VXVM ADMIN COMMANDS :

1) To start up Volume Manager from the command line

- vxiod set 10

- vxconfigd -d

- vxdctl init

- vxdctl enable

2) Un-mirror the rootdisk using VMSA:

- Start-up Veritas Volume Manager

- Select the root volume

- Right click, and select mirror

- Then select disable

- Choose rootvol-02 to disable

- Do the same steps for /usr, and any swap volumes that are mirrored

- Then get out of Volume Manager

3) Unmirror the roort disk using command line run:

- vxplex -o rm dis rootvol-01

- vxplex -o rm dis swapvol-01 (if needed)

- vxplex -o rm dis usrvol-01 (if needed)

4) Un-Encapsulate root disk

1. boot single user mode from cdrom or net

ok> boot cdrom -s or boot net -s

2. fsck the root filesystem

# fsck -y /dev/rdsk/c0t0d0s0

3. mount the root filesystem on /a

# mount /dev/dsk/c0t0d0s0 /a

4. cp /a/etc/system /a/etc/system.vxvm

5. vi /a/etc/system and remove the following 2 entries

rootdev:/pseudo/vxio@0:0

set vxio:vol_rootdev_is_volume=1

6. cp /a/etc/vfstab /a/etc/vfstab.vxvm

7. cp /a/etc/vfstab.prevm /a/etc/vfstab

8. rm /a/etc/vx/reconfig.d/state.d/root-done

9. touch /a/etc/vx/reconfig.d/state.d/install-db

10. reboot

*** install your new key

11. run commands below to start vxvm

vxiod set 10

vxconfigd-m disable

vxdctl init

vxdctl enable

12. At this point you need to make sure all the volumes are

ENABLED ACTIVE and detach all the plexes on your root mirror.

5) Can't mount encapsulated swap during boot

- boot from CD or net

- mount your root drive to a temporary location like /tmp/mnt or /a (/a for

our example) (mount /dev/dsk/c0t0d0s2 /a

- cd /a/etc

- cp vfstab vfstab.hold

- cp vfstab.prevm vxfstab

- comment out these two lines in /a/etc/system

- rootdev:/pseudo/vxio@0:0

- set vxio:vol_rootdev_is_volume=1

- cd /a/etc/vx/reconfig.d/state.d

- remove root-done

- touch install-db

- umount /a

- init 6

- start up Volume manager (see documentation above)

- remove volumes

- vxedit -rf rm

- remove rootdisk

- vxedit -rf rm rootdisk

- vi /etc/vfstab and add any additional file systems you may need

- boot from the net or cdrom

- mount the drive, in our example we'll mount c0t0d0s2 on /a

- mount /dev/dsk/c0t0d0s2 /a

- set the vtoc back to its original state

- vi /a/etc/vx/reconfig.d/disk.d/c0t0d0/vtoc

- remove the 1st two lines in the file, both should be commented out

- remove the "0x" in the second column from each row.

- remove the first three characters from the third column

- fmthard -s /a/etc/vx/reconfig.d/disk.d/c0t0d0/vtoc /dev/rdsk/c0t0d0s2

- reboot (init 6)

- reinstall VXVM and remirror your drives.

- This should include encapsilating your root drive.

- Veritas File Manager GUI

- /opt/VRTSvmsa/bin/vmsa

- Installation located on cidcsssp0:/jsid/veritas

- Technote for the required patches and SUN package for VxVM 3.2

http://seer.support.veritas.com/docs/240304.htm- Upgrade procedure

http://seer.support.veritas.com/docs/240006.htm- To see newly added disks - vxdctl enable

DISPLAY & MONITORING COMMAND

1 ) vxdisk list

List all disks used by Veritas (VX).

2) vxdisk list

Display detailed information about a

single disk, including mutlipathing

information, size, type, Vx version,

and more.

3) vxprint

Display report style information about

the current status of all Vx componants,

including disks, subdisks, plexes, and

volumes.

4) vxprint

Display report style information about

the current status of ONLY the componant

you request. So for instance,

"vxprint vol01" shows information about

all subcomponants of vol01. This works

for plexes, disk groups, etc.

5) vxprint -hrt

Display detailed information about all

Vx componanats, including stwdith,

ncolumns, offsets, layout type, read-

policy, and more. This is best for

a true picture of your configuration.

6) vxdg list

Display listing and state information

of all Disk Groups.

7) vxdg list

Display detailed information about

a diskgroup, including flags, version,

logs status, etc.

8) vxinfo

Display volume status and volume type.

By default, only displays "rootdg",

to display a different Disk Group,

use "vxinfo -g ".

9) vxassist maxgrow

This command will output the maximum size

the volume specified can increased by,

specified in sectors.

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

DISK TASKS and COMMANDS

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

1) vxdiskadd

Adds a disk to Vx by Initializing and Encapsolating

it. Specified by its device name (ex: c0t1d0s2).

NOTE: You'll need to reboot to finalize the

disk addition!

This command, can also be used to add a disk to

a specified disk group. Just follow the prompts.

No reboots needed for changing DG's.

2) vxedit rename

Rename a Vx disk. Ex: "vxedit rename disk01 disk05"

3) vxedit set reserve=on

Sets the "reserve" flag to a Vx disk. This

is used to keep specific disks from being

accidentally, or generally used.

4) vxdisk offline

Used to "offline" a disk. The disk should

be removed from its diskgroup before being

offlined.

5) vxdisk rm

Used to remove disks from Vx control completely.

Ex: "vxdisk rm c0t1d0s2" Make sure to

removed the disk from its diskgroup, and offline

the disk before removing it.

6) vxedit set spare=on

Sets the "spare" flag to a Vx disk. This is used

to make the specified disk a hot spare, which

is then added to the "hot spare pool".

7) vxedit set spare=off

Same as above but removes the disk from the

"hot spare pool".

DISK GROUPS and COMMANDS

1) vxdg init =

Creates a new disk group, and assigns the naming

scheme to the first disk added to the group.

ex: "vxdg init newdg newdg01=c0t10d0s2".

NOTE: This is kinda tricky because the disk that

you're adding can't be a member of ANY DG, but

must be initialized. It's easier to use

"vxdiskadd", and add the disk to a newdg by

specifying a new DG name for the DG field.

2) vxdg deport

Disabled a diskgroup, but doesn't remove it. Often

used as an organized pool of disk to realocate, and

to moved DG's from one system to another.

3) vxdg import

Reverse of above. Enables local access to the specified

disk group.

4) vxdg -n

Change a Disk Groups name.

5) vxdg list

Use this to check the version numbers of Disk

Groups. Shows other details about the DG too.

6) vxdg destroy

Removes the specified DG, and frees all its disks

back to general use by Vx.

SUBDISKS and COMMANDS

1) vxmake sd ,,

Creates a subdisk with the specified name,

and by the offset and length specified.

ex: "vxmake sd disk02-01 disk02,0,8000"

NOTE: If you are going to add this subdisk

to a plex, its good to check the other

subdisks in that plex to see what their

lengths and offsets are, use the command:

"vxprint -st"

2) vxedit rm

Removes a subdisk.

3) vxsd assoc ,....

Associates the specified subdisks to

the specified plex. Example:

"vxsd assoc vol01-03 disk01-01,disk02-01"

NOTE: Striped volumes are different,

you need to specify the column# so

use the following:

4) vxsd -l assoc ,...

Same as above, but used for associating

subdisks to a striped plex. Use the command

"vxprint -st" to see what other subdisk

in the plex look like, and then set the

new subdisks column number and offset

(found in the seventh column of output)

to the appropriate value.

5) vxsd aslog

Adds a log subdisk to the specified plex.

Ex: "vxsd aslog vol01-02 disk03-01"

vxsd dis

Disassociates the specified subdisk from its

current plex.

PLEXS and COMMANDS

1) vxmake plex sd=,,....

Creates a new plex by the name specified and

assigns the specified subdisks to it.

vxmake plex layout= stwidth= ncolumn= sd=...

Like above command, but specifies layout type

as defined by , which is used for creation

of striped and RAID5 plexes. The layout is

constrained by the defined number of columns,

and stripe width. Subdisks specified are

added to the created plex.

2) vxplex att

Associates specified plex with specified volume.

(Adds a mirror)

NOTE: Attachment will take a while. Watch

it with Vxtask, or via vxprint

3) vxplex dis

Disassociate specified plex from its connected

volume.

4) vxedit -r rm

Remove the plex.

5) vxmend off

Offlines a plex for repair to it's disks.

6) vxplex det

Detaches specified plex from its connected

volume, but maintians association with it's

volume. The plex is no longer used

for I/O untill it is (re)attached.

7) vxmend fix clean

Used to clean plexes that are in the

"unclean" state. Used with unstartable

volumes.

8) vxplex mv

Moves the data content from the origonal

plex onto a new plex.

NOTE: The old plex must be active (ENABLED).

The new plex should be the same length, or

larger than the old plex. The new plex

must not be associated with another volume.

(duh)

9) vxplex cp

Copies the data from the specified volume

to a new plex.

NOTE: The new plex cannot be associated

with any other volume. The new plex,

further, will NOT be attached to

the specified volume. (Also, see notes

from above)

VOLUMES and COMMANDS

1) vxassist make

Creates a new volume with the name specified

and is made to the length specified.

Ex: "vxassist make newvol 10m"

NOTE: This command will pull disk space

from the generally avalible Vx disk space.

vxassist make layout= ....

Like the above command, but with layout specified.

The most common layouts are: striped and raid5

ex: "vxassist make newvol 100m layout=raid5 disk01 disk02 disk03"

NOTE: See the vxassist(1M) man page for more information.

2) vxmake vol len= plex=,...

Creates a new volume of specified length (usually

in sectors), and attachs the specified plexes to that

volume. Useful for creating volumes to house

copied or moved plexes.

NOTE: See the vxmake(1M) man page for more information.

vxvol init [plexname]

Manually sets the state of a volume.

NOTE: Not for the squimish.

3) vxassist maxsize [layout=raid5]

Returns the maximum size avalible via Vx to create

a new volume. By adding "layout=raid5" to the command

the calulations take into account losse due

to raid5. Output is in sectors and Megs.

4) vxassist maxgrow

Returns the maximum ammount of Vx space that

can be added to the specified volume.

5) vxassist mirror

Creates a mirror for the specified volume.

NOTE: Think of this as "handsfree plex creation".

This is fast, but the disks you want used

may not be used... often best to do manually.

6) vxassist addlog

Adds a Dirty Region Log (DRL) for the specified volume.

vxassist remove log

Reverse of above.

7 ) vxvol start

Starts a volume

8 )vxvol stop

Stops a volume. Alternately you can use command as

such: "vxvol stopall" in order to stop all volumes.

9) vxassit growto/growby/shrinkto/shrinkby

Resizes the volume specified. Use one of the

following: growto, growby, shrinkto, and shrinkby

in order to descide what specifies.

By default length is specified in sectors.

This does not resize the filesystem inside the volume.

NOTE: Don't shrink volumes to be less that

its contained filesystem! (duh)

10) vxvol set len=

An alternate to above command. Sets the absolute

lenths of the specified volume to the length

specified, by default, in sectors. This

does not resize the filesystem inside the volume.

NOTE: There is also a resize(1M) command, used

for resizing both volume AND filesytem. See

the man page for that one.

11) vxedit rm

Removes the specified volume. (poof!)

NOTE: If the volume specified is in the ENABLED

state, you will need to use the command

"vxedit -f ". Also, using the "r"

with "f" will remove all plexes and subdisks

with the volume. If you didn't guess, "r"

is Recursive, and "f" is Force.

Misc Stuff:

To calculate the size of a filesystem inside a volume, use

the command:

fstyp -v | head -30 | grep ncg

Ignore the errors. Output will look this this:

# fstyp -v /dev/vx/rdsk/datadg/vol01 | head -30 | grep ncg

ncg 17152 size 70254592 blocks 65863396

# Broken Pipe

Unknown_fstyp (no matches)

The size found after the label "size" is presented in kilobytes.

You can convert to sectors by multiplying by 2.

-----------

To calculate the size of a volume, use vxprint, and look for the

"len". The volume length is in sectors. Convert to kilobytes

by dividing by 2.

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

Volume Growth Procudure:

1) You can use vxassist to estimate the max size of

a given volume based on the disks you wish to add:

ex: # vxassist -g rootdg maxgrow vol01 disk01 disk02 disk03

2) Next, actually grow the volume (NOT THE FS) via the

command (assuming maxgrow outputed 10639360 as the maxsize):

ex:# vxassist -g rootdg growto vol01 10639360 disk01 disk02 disk03

3) Now VxVM grinds away, monitor with vxtask.

4) Now Grow the Filesystem, for UFS use:

# /usr/lib/fs/ufs/mkfs -F ufs -M /export /dev/vx/rdsk/rootdg/vol01 10639360

for VXFS ufs:

# /usr/lib/fs/vxfs/fsadm -b 10639360 -r /dev/vx/rdsk/rootdg/vol01 /mnt

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

5) Done!

Changing User/Group of a Raw Volume: (ex:)

vxedit -g xxxdg set group=dba data_vol_123

vxedit -g xxxdg set user=oracle data_vol_123