DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
[Next] [Previous] [Top] [Contents] [Index]

VxVM User's Guide

Disk CLI Operations

Chapter 10


Introduction

This chapter provides instructions on performing the following disk operations using the command line interface:

Refer to the VERITAS Volume Manager System Administrator's Guide for additional information and examples on using the command line interface to perform disk operations. For more information about physical disks, VM disks, and disk groups, see Chapter 1, "Description of the Volume Manager."

Physical Disk Operations

Physical disk operations are described in the following sections.

Bringing a Physical Disk Under Volume Manager Control

When you add a disk to a system that is running the Volume Manager, you may wish to put the disk under control of the Volume Manager so that it can control the space allocation on the disk. If the disk was previously in use, but not under Volume Manager control, then you may wish to preserve existing data on the disk while still letting the Volume Manager take control of the disk. This can be accomplished using the encapsulation function of the Volume Manager. If the disk is new, then it will need to be initialized. If a disk was previously not under Volume Manager control, but no data is required to be preserved, an initialization operation should also be performed.

Add a disk by entering the command:

	vxdiskadd devname 
where devname is the device name of the disk to be added.

To add the device c1b0t0d0 to Volume Manager control, do the following:

1. Enter the following to start vxdiskadd:

	vxdiskadd c1b0t0d0 
Notice that the s0 suffix is not used here.

2. To continue with the operation, enter y (or press Return) at the following prompt:

		Add or initialize disks
		Menu: VolumeManager/Disk/AddDisks

		 Here is the disk selected.  Output format: [Device_Name]
 
		  c1b0t0d0
 
		Continue operation? [y,n,q,?] (default: y) y 

3. At the following prompt, specify the disk group to which the disk should be added or press Return to accept rootdg:

		You can choose to add this disk to an existing disk group, a
 		new disk group, or leave the disk available for use by future
 		add or replacement operations.  To create a new disk group,
 		select a disk group name that does not yet exist.  To leave the
	 	disk available for future use, specify a disk group name of
 		"none". 
	Which disk group [<group>,none,list,q,?] (default: rootdg) 

4. At the following prompt, either press Return to accept the default disk name or enter a disk name:

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

5. When prompted whether this disk should become a hot-relocation spare, enter n (or press Return):

		Add disk as a spare disk for rootdg? [y,n,q,?] (default: n) n 
6. To continue with the operation, enter y (or press Return) at the following prompt:

		The selected disks will be added to the disk group rootdg with
 		default disk names.

		c1b0t0d0

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

7. If there is data on this disk that needs to be preserved, enter y to select encapsulation:

		The following disk device has a valid VTOC, but does not appear
 		to have been initialized for the Volume Manager.  If there is
 		data on the disk that should NOT be destroyed you should
 		encapsulate the existing disk partitions as volumes instead of
 		adding the disk as a new disk Output format: [Device_Name]

		c1b0t0d0

	Encapsulate this device? [y,n,q,?] (default: y) y 

8. To continue the operation, press Return at the following prompt:

		The following disk has been selected for encapsulation.
		Output format: [Device_Name  c1b0t0d0]

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

A message similar to the following indicates that the disk is being encapsulated for VxVM use:

		The disk device c1b0t0d0 will be encapsulated and added to the
 		disk group rootdg with the disk name disk01.

		The c1b0t0d0 disk has been configured for encapsulation.

		The first stage of encapsulation has completed successfully.
 		You should now reboot your system at the earliest possible
 		opportunity.

		The encapsulation will require two or three reboots which will
 		happen automatically after the next reboot.  To reboot execute
 		the command:

	shutdown -g0 -y -i6

		This will update the /etc/vfstab file so that volume devices
 		are used to mount the file systems on this disk device.  You
 		will need to update any other references such as backup scripts,
 		databases, or manually created swap devices.

	Goodbye.

Remember to perform a shutdown and reboot as soon as convenient.

Reserving Physical Disks

By default, vxassist allocates space from any disk that has free space. You may wish to reserve some set of disks for special purposes, such as to avoid general use of a particularly slow or a particularly fast disk.

To reserve a disk for special purposes, enter:

	vxedit set reserve=on diskname 
After you enter this command, vxassist will not allocate space from the selected disk unless that disk is specifically mentioned on the vxassist command line. For example, if disk disk03 is reserved, the command:

	vxassist make vol03 20m disk03 
overrides the reservation and creates a 20 megabyte volume on disk03. However, the command:

	vxassist make vol04 20m 
does not use disk03, even if there is no free space on any other disk.

To turn off reservation of a disk, enter:

	vxedit set reserve=off diskname 

Adding a Physical Disk to a Disk Group

You may wish to add a new disk to an already established disk group. Perhaps the current disks have insufficient space for the application or work group requirements, especially if these requirements have changed.

To add an initialized disk to a disk group, enter:

	vxdiskadd devname
To add device c1b0t1d0 to rootdg, do the following:

1. Enter the following to start vxdiskadd:

		vxdiskadd c1b0t1d0 
vxdiskadd displays the following message:

		Add or initialize disks
		Menu: VolumeManager/Disk/AddDisks

		Here is the disk selected.  Output format: [Device_Name]

			c1b0t1d0

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

2. At the following prompt, specify the disk group to which the disk should be added or press Return to accept rootdg:

		You can choose to add this disk to an existing disk group, a
 		new disk group, or leave the disk available for use by future
 		add or replacement operations.  To create a new disk group,
	 	select a disk group name that does not yet exist.  To leave the
 		disk available for future use, specify a disk group name of
 		"none".

	Which disk group [<group>,none,list,q,?] (default: rootdg) 

3. At the following prompt, either press Return to accept the default disk name or enter a disk name:

		Use a default disk name for the disk? [y,n,q,?] (default: y) 
4. When vxdiskadd asks whether this disk should become a hot-relocation spare, enter n (or press Return):

		Add disk as a spare disk for rootdg? [y,n,q,?] (default: n) n 
5. To continue with the operation, enter y (or press Return) at the following prompt:

		The selected disks will be added to the disk group rootdg with
 		default disk names.

		c1b0t1d0

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

6. The following prompt indicates that this disk has been previously initialized for future VxVM use; enter y to confirm that you now want to use this disk:

		The following disk device appears to have been initialized
 		already. The disk is currently available as a replacement disk.
		Output format: [Device_Name]

		c1b0t1d0

	Use this device? [y,n,q,?] (default: y) y 
7. To reinitialize the disk, enter y (or press Return) at the following prompt:

		The following disk you selected for use appears to already have
 		been initialized for the Volume Manager.  If you are certain
		the disk has already been initialized for the Volume Manager,
 		then you do not need to reinitialize the disk device.
		Output format: [Device_Name]

		c1b0t1d0

	Reinitialize this device? [y,n,q,?] (default: y) y 

Messages similar to the following should now confirm that this disk is being reinitialized for VxVM use. You are also given the option of performing surface analysis.

		Initializing device c1b0t1d0.

		Perform surface analysis (highly recommended)
		[y,n,q,?] (default: y) n

		Adding disk device c1b0t1d0 to disk group rootdg with disk name
 		disk03. 

To confirm that the disk has been added to the disk group, enter:

	vxdisk list 
The Volume Manager returns a listing similar to the following:

	
	DEVICE      TYPE    DISK      GROUP    STATUS 

	c0b0t0d0s0  sliced  rootdisk  rootdg   online 

	c1b0t0d0s0  sliced  disk01    rootdg   online 

	c1b0t1d0s0  sliced  disk03    rootdg   online 

Taking a Physical Disk Offline

Occasionally, you may need to take a physical disk offline. If the disk is corrupted, you need to disable it and remove it. You also must disable a disk before moving the physical disk device to another location to be connected to another system.

To take a physical disk offline, first remove the disk from its disk group. Then place the disk in an ''offline'' state as follows:

	vxdisk offline devname 
To take the device c1b0t1d0s0 off line, enter:

	vxdisk offline c1b0t1d0s0 

Note: The device name is used here because the disk is no longer in a disk group and so does not have an administrative name.


Removing a Physical Disk

You can remove a disk to move it to another system or you may remove the disk because the disk is failing or has failed. However, before removing the disk from the current system, you must:

1. Unmount any file systems on the volumes.

2. Stop the volumes.

3. Move the volumes to other disks or back up the volumes to tape. To move a volume, mirror the volume on one or more other disks, then remove the original copy of the volume.

Alternatively, if the volumes are no longer needed, they can be removed.

Removing a disk involves the following steps:

1. Remove a disk from a disk group as follows:

	vxdg [-g groupname] rmdisk diskname 
where groupname is the name of the group to which the disk belongs and diskname is the name of the disk to be removed.

For example, to remove disk01 from rootdg, enter:

	vxdg rmdisk disk01 
Since rootdg is the default disk group, you do not need to specify it.

2. Remove the disk from Volume Manager control as follows:

	vxdisk rm devname 
For example, to remove c1b0t0d0 from Volume Manager control, enter:

	vxdisk rm c1b0t0d0s0 

VM Disk Operations

VM disk operations are described in the following sections.

Displaying Disk Information

Before you use a disk, you need to know if it has been initialized and placed under Volume Manager control. You also need to know if the disk is part of a disk group, since you cannot create volumes on a disk that is not part of a disk group. The vxdisk list command displays device names for all recognized disks, the disk names, the disk group names associated with each disk, and the status of each disk.

To display information on all disks that are defined to the Volume Manager, enter:

	vxdisk list 
The Volume Manager returns the following display:

DEVICE     TYPE    DISK      GROUP   STATUS 

c0b0t0d0s0  sliced  rootdisk  rootdg  online 

c1b0t0d0s0  sliced  disk01    rootdg  online 

c1b0t1d0s0  sliced  -         -       online 

To display details on a particular disk defined to the Volume Manager, enter:

	vxdisk list disk01 

Adding a VM Disk to the Hot-Relocation Pool

Hot-relocation is the ability of a system to automatically react to I/O failure by relocating redundant subdisks to other disks and restoring the affected VxVM objects and data. If a disk has already been designated as a spare in the disk group, the subdisks from the failed disk are relocated to the spare disk. Otherwise, any suitable free space in the disk group is used. Refer to Chapter 1, "Description of the Volume Manager" for more information.

To designate a disk as a hot-relocation spare, enter:

	vxedit set spare=on diskname
For example, to designate disk disk01 as a spare, enter:

	vxedit set spare=on disk01 
You can use the vxdisk list command to confirm that this disk is now a spare; disk01 should be listed with a spare flag.

Any VM disk in this disk group can now use this disk as a spare in the event of a failure. If a disk fails, hot-relocation should automatically occur (if possible). You should be notified of the failure and relocation via electronic mail. After successful relocation, you may want to replace the failed disk.

Removing a VM Disk From the Hot-Relocation Pool

While a disk is designated as a spare, the space on that disk is not used as free space for the creation of VxVM objects within its disk group. If necessary, you can free a spare disk for general use by removing it from the pool of hot-relocation disks.

To determine which disks are currently designated as spares, use the command vxdisk list. The output of this command should list any spare disks with the spare flag.

To remove a spare from the hot-relocation pool, enter:

	vxedit set spare=off diskname
For example, to make disk disk01 available for normal use, enter:

	vxedit set spare=off disk01 

Renaming a VM Disk

It is not necessary to give your disks special names. The Volume Manager gives the disk a default name when you add the disk to Volume Manager control. The disk name is used by the Volume Manager to identify the disk's location or type. If you wish to change the disk name to reflect a change of ownership or use, enter:

vxedit rename old_diskname new_diskname
To rename disk01 to disk03, enter:

	vxedit rename disk01 disk03 
To see if the name change took place, enter:

	vxdisk list 
The Volume Manager returns the following:


	DEVICE      TYPE    DISK      GROUP   STATUS 

	c0b0t0d0s0  sliced  rootdisk  rootdg  online 

	c1b0t0d0s0  sliced  disk03    rootdg  online 

	c1b0t1d0s0  sliced  -         -       online 


Note: By default, VxVM names subdisk objects after the VM disk on which they are located. Renaming a VM disk does not automatically rename the subdisks on that disk.


Mirroring the Boot Disk

To mirror your boot (root) disk onto another disk, use either the steps outlined here or vxdiskadm (see Chapter 13, "Menu Interface Operations"). This makes it possible to recover from failure of your boot disk by replacing it with the mirror of the boot disk.

To mirror your boot disk, do the following:

1. Select a disk that is at least as large as your boot disk.

2. Use the vxdiskadd command to add the selected disk as a new disk (if it is not already added).

3. Execute the following command:

	/etc/vx/bin/vxrootmir alternate_disk
where alternate_disk is the disk name assigned to the disk.

vxrootmir creates a mirror for rootvol (the volume for the root file system).

The alternate boot disk is configured to enable booting from it if the primary boot disk fails.

There may be other volumes on the boot disk, such as volumes for /home or /tmp file systems. These can be mirrored separately using the vxassist utility. For example, if you have a /home file system on a volume homevol, you can mirror it to alternate_disk using the command:

	vxassist mirror homevol alternate_disk
If you do not have space for a copy of some of these file systems on your alternate boot disk, you can mirror them to other disks. You can also span or stripe these other volumes across other disks attached to your system.

To list all volumes on your primary boot disk, use the command:

	vxprint -t -v -e 'aslist.aslist.sd_disk="boot_disk_name"'
To mirror all of the simple volumes on this disk to your alternate boot disk, use the command:

	/etc/vx/bin/vxmirror boot_disk_name alternate_disk
On an IBM PC or compatible machine, the system normally can be booted only from one of two drives: drive C or drive D. Your disk controllers define which drive is C and which is D. Some disk controllers allow you to configure which disks are drive C and D. Most disk controllers configure drive C to be the disk on controller 0 with SCSI target ID 0, and drive D to be the disk with SCSI target ID 1 (or the lowest SCSI target ID on the next controller if the first has only one disk connected).

If you choose an alternate boot disk that corresponds to the disk controller's recognition of drive D, you may be able to boot on that drive without having to reconfigure the hardware. Depending on the disk controller and the type of failure for the primary boot disk, booting from drive D may happen automatically.

If you do not choose drive D as the alternate boot disk, you may need to renumber the disks attached to your system to be able to boot from the alternate disk (refer to Appendix B, "Recovery," in the VERITAS Volume Manager System Administrator's Guide).


Note: The Adaptec 1542C controller can be configured to boot from any drive attached to the first controller, as long as you use the special Volume Manager boot floppy for booting from alternate drives.


Disk Group Operations

Disk group operations are described in the following sections.

Initializing a New Disk Group

There can be situations in which all data related to a particular set of applications or a particular group of users needs to be made accessible on another system. Examples of this are:

In such cases, it is important that the data related to particular application(s) or users be located on an identifiable set of disk drives, so that when these drives are moved, all data of the application(s) or group of users, and no other data, is moved.


Note: The Volume Manager supports a default disk group, rootdg, in which all volumes are created if no further specification is given. All commands will default to rootdg as well.


To create the disk group newdg associated with a disk, do the following:

1. Enter the following to start vxdiskadd:

		vxdiskadd c1b0t1d0 
2. At the following prompt, press Return to continue:

		Add or initialize disks
		Menu: VolumeManager/Disk/AddDisks

		Here is the disk selected.  Output format: [Device_Name]

			c1b0t1d0

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

3. At the following prompt, specify the disk group to which the disk should be added (newdg, in this case):

		You can choose to add this disk to an existing disk group, a
 		new disk group, or leave the disk available for use by future
 		add or replacement operations.  To create a new disk group,
 		select a disk group name that does not yet exist.  To leave the
 		disk available for future use, specify a disk group name of
 		"none".

	Which disk group [<group>,none,list,q,?] (default: rootdg) newdg
4. vxdiskadd confirms that no active disk group currently exists with the same name and prompts for confirmation that you really want to create this new disk group:

		There is no active disk group named newdg.

		Create a new group named newdg? [y,n,q,?] (default: y) y 

Enter y to continue.

5. At the following prompt, either press Return to accept the default disk name or enter a disk name:

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

6. When vxdiskadd asks whether this disk should become a hot-relocation spare, enter n (or press Return):

		Add disk as a spare disk for newdg? [y,n,q,?] (default: n) n 

7. To continue with the operation, enter y (or press Return) at the following prompt:

		A new disk group will be created named newdg and the selected
 		disks will be added to the disk group with default disk names.

		c1b0t1d0

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

Messages similar to the following should now confirm that this disk is being initialized for VxVM use:

		Initializing device c1b0t1d0.

		Creating a new disk group named newdg containing the disk device
 		c1b0t1d0 with the name newdg01.

8. To see if the disk group was created, enter:

		vxdisk list 

The Volume Manager returns the following: 

	DEVICE      TYPE    DISK      GROUP    STATUS 

	c0b0t0d0s0  sliced  rootdisk  rootdg   online 

	c1b0t0d0s0  sliced  disk03    rootdg   online 

	c1b0t1d0s0  sliced  newdg01   newdg    online 

Moving Disk Groups

A disk group can be moved between systems, along with its VxVM objects. In this way, the disk group's configuration is relocated to a new system.

Move a disk group across systems as follows:

1. Unmount and stop all volumes in the disk group on the first system.

2. Deport (disable local access to) the disk group to be moved with the command:

		vxdg deport diskgroup  
3. Import (enable local access to) the disk group and its disks from the second system with the command:

		vxdg import diskgroup
4. After the disk group is imported, start all volumes in the disk group with the command:

		vxrecover -g diskgroup -sb   

Renaming Disk Groups

Since only one disk group of a given name can exist per system, you must rename a disk group if you want to move it to a system already containing a disk group with the same name.

Every system running the Volume Manager must have a single rootdg disk group. rootdg can therefore only be moved across systems if it is renamed.

The following set of steps can be used to temporarily move the rootdg disk group from one host to another (for repair work on the root volume, for instance) and then move it back:

1. On the original host, identify the disk group ID of the root disk group to be imported:

		vxdisk -s list
This command results in output that includes the following.

		dgname: rootdg
		dgid:   774226267.1025.tweety 

2. On the importing host, import and rename the rootdg disk group as follows:

		vxdg -tC -n newdg_name import diskgroup 
where -t indicates a temporary import name; -C clears import locks (and should only be used if you are certain that the disks are not being used by any other hosts); -n specifies a temporary name for the rootdg to be imported (so that it does not conflict with the existing rootdg); and diskgroup is the ID of the rootdg disk group being imported.

If a crash or reboot occurs at this point, the temporarily-imported disk group will become unimported and will require a reimport.

3. After the necessary work has been done on the imported rootdg, deport it back to its original host as follows:

		vxdg -h hostname deport diskgroup 
where hostname is the name of the system whose rootdg is being returned (the system's name can be confirmed with the command uname -n). This command removes the imported rootdg from the importing host and returns locks to its original host. The original host will then autoimport its rootdg on its next reboot.

Displaying Disk Group Information

To use disk groups, you need to know their names and what disks belong to each group.

Display information on existing disk groups as follows:

	vxdg list 
The Volume Manager returns the following listing of current disk groups:

	NAME    STATE     ID 
	rootdg  enabled   730344554.1025.tweety 
	newdg   enabled   731118794.1213.tweety 

Display more detailed information on a specific disk group (such as rootdg) as follows:

	vxdg list rootdg 
The Volume Manager returns output such as the following for rootdg:

	Group:     rootdg
	dgid:      730344554.1025.tweety
	import-id: 0.1
	flags:    
	copies:    nconfig=default nlog=default
	config:    seqno=0.94553 permlen=795 free=768 templen=16 loglen=8
	config disk c2b0t2d2s0 copy 1 len=795 disabled
	config disk c2b0t2d3s0 copy 1 len=795 disabled
	config disk c2b0t2d4s0 copy 1 len=795 disabled
	config disk c2b0t3d0s0 copy 1 len=795 state=clean online
	log disk c2b0t2d2s0 copy 1 len=120 disabled
	log disk c2b0t2d3s0 copy 1 len=120 disabled
	log disk c2b0t2d4s0 copy 1 len=120 disabled
	log disk c2b0t3d0s0 copy 1 len=120 

If you need to verify the disk group ID and name associated with a specific disk (to import the disk group, for example), use the following command:

	vxdisk -s list devicename
This command provides output that includes the following information for the specified disk:

	dgname: rootdg
	dgid:   774226267.1025.tweety 


[Next] [Previous] [Top] [Contents] [Index]