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

VxVM User's Guide

Volume CLI Operations

Chapter 12


Introduction

This chapter provides instructions on performing the following volume 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 volume operations.

Creating a Volume

Volumes need to be created in order to take advantage of the Volume Manager concept of virtual disks. Once a volume exists, a file system can be placed on the volume to organize the disk space with files and directories. Alternatively, applications like databases might be used to organize data on volumes.

The Volume Manager allows you to create volumes with various layout types using the command line interface:

The vxassist command provides the simplest way to create new volumes.

When creating a volume, vxassist takes the following form:

	vxassist make volume_name length [attributes]
where make is the keyword for volume creation, volume_name is a name you give to the volume, and length specifies the number of sectors (by default) in the volume. The length can be specified in kilobytes, megabytes, or gigabytes by using a suffix character of k, m, or g, respectively. Refer to the vxintro(1M) manual page for more information on specifying units of length when creating volumes. Additional attributes can be specified, as appropriate.

By default, vxassist creates volumes in the rootdg disk group. Another disk group can be specified by including -g diskgroup in the vxassist command line.

Creating a volume in the disk group rootdg creates two device node files that can be used to access the volume:

For volumes in disk groups other than rootdg, these names include the disk group name, as follows:

"Creating a Concatenated Volume," describes the simplest way to create a (default) volume. Later sections describe how to create volumes with specific attributes.

Creating a Concatenated Volume

By default, vxassist creates a concatenated volume that uses one or more sections of disk space. On a fragmented disk, this allows you to put together a volume larger than any individual section of free disk space available.

If there is not enough space on a single disk, vxassist creates a spanned volume. A spanned volume is a concatenated volume with sections of disk space spread across more than one disk. A spanned volume can be larger than the single largest disk, since it takes space from more than one disk.

Creating a Concatenated Volume on Any Disk

If no disk is specified, the Volume Manager selects an appropriate disk on which to create the volume.

Create a concatenated, default volume as follows:

	vxassist make volume_name length 
where volume_name is a name of the volume and length specifies the length of the volume in sectors (unless another unit of size is specified with a suffix character).

To create the volume voldef with a length of 10 megabytes, enter:

	vxassist make voldef 10m 

Creating a Concatenated Volume on a Specific VM Disk

The Volume Manager automatically selects the disk(s) each volume will reside on, unless you specify otherwise. If you want a volume to reside on a specific disk, you must designate that disk for the Volume Manager. More than one disk can be specified.

Create a volume on a specific disk as follows:

	vxassist make volume_name length diskname [...] 
To create the volume volspec on disk03, enter:

	vxassist make volspec 3m disk03 

Creating a Striped Volume

A striped volume contains at least one plex that consists of two or more subdisks located on two or more physical disks. For more information on striping, refer to Chapter 1, "Description of the Volume Manager."

Create a striped volume as follows:

	vxassist make volume_name length layout=stripe 
To create the striped volume volzebra, enter:

	vxassist make volzebra 10m layout=stripe 
This creates a striped volume with the default stripe unit size on the default number of disks.

You can indicate the disks on which the volumes are to be created by specifying the disk names at the end of the command line. For example, to create a 30 megabyte striped volume on three specific disks (disk03, disk04, and disk05), enter:

	vxassist make stripevol 30m layout=stripe disk03 disk04\
 	disk05

Creating a RAID-5 Volume

A RAID-5 volume contains a RAID-5 plex that consists of two or more subdisks located on two or more physical disks. Only one RAID-5 plex can exist per volume. A RAID-5 volume may also contain one or more RAID-5 log plexes, which are used to log information about data and parity being written to the volume. For more information on RAID-5 volumes, refer to Chapter 1, "Description of the Volume Manager."

Create a RAID-5 volume as follows:

	vxassist make volume_name length layout=raid5
To create the RAID-5 volume volraid, enter:

	vxassist make volraid 10m layout=raid5
This creates a RAID-5 volume with the default stripe unit size on the default number of disks. It also creates a RAID-5 log by default.

Removing a Volume

Once a volume is no longer necessary (it is inactive and archived, for example), you can remove the volume and free up the disk space for other uses.

Before removing a volume, make sure you do the following:

1. Remove all references to the volume.

2. If the volume is mounted as a file system, unmount it with the command:

	umount /dev/vx/dsk/volume_name
3. If the volume is listed in /etc/vfstab, remove its entry.

4. Make sure that the volume is stopped with the command:

	vxvol stop volume_name
The vxvol stop command stops all Volume Manager activity to the volume.

After following these steps, remove the volume as follows:

	vxedit -rf rm volume_name 		
To remove the volume volspan, enter:

	vxedit -rf rm volspan 

Mirroring a Volume

A mirror is a copy of a volume. The mirror copy is not stored on the same disk(s) as the original copy of the volume. Mirroring a volume ensures that the data in that volume will not be lost if one of your disks fails.

Mirroring a New Volume

Create a new volume with a mirror as follows:

	vxassist make volume_name length layout=mirror 
To create the mirrored volume, volmir, enter:

	vxassist make volmir 5m layout=mirror 
To create a volume with Dirty Region Logging enabled, create a mirrored volume with a dirty region log as follows:

	vxassist make volume_name length layout=mirror,log 
This specifies that the volume layout must be both mirrored and contain a DRL log. vxassist creates one log plex per log subdisk, by default.

Mirroring an Existing Volume

Create a mirror for an existing volume as follows:

	vxassist mirror volume_name 
The following example creates a mirror of the volume voltest:

	vxassist mirror voltest 

Mirroring All Volumes

To mirror all existing volumes to available disk space, enter:

	/etc/vx/bin/vxmirror -a
You can also configure the Volume Manager to create mirrored volumes by default. To do this, enter the command:

	/etc/vx/bin/vxmirror -d yes
If you make this change, you can still make unmirrored volumes by specifying nmirror=1 as an attribute to the vxassist command. For example, to create an unmirrored 20-megabyte volume named nomirror, use the command:

	vxassist make nomirror 20m nmirror=1

Adding a RAID-5 Log

Only one RAID-5 plex can exist per RAID-5 volume. Any additional plexes become RAID-5 log plexes, which are used to log information about data and parity being written to the volume. When a RAID-5 volume is created using vxassist, a log plex is created for that volume, by default.

Add a RAID-5 log to an existing volume as follows:

	vxassist addlog volume_name 
The following example creates a log for the RAID-5 volume volraid:

	vxassist addlog volraid 

Adding and Removing a DRL Log

To put Dirty Region Logging into effect for a volume, a log subdisk must be added to that volume and the volume must be mirrored. Only one log subdisk can exist per plex.

Add a DRL log to an existing volume as follows:

	vxassist addlog volume_name 
The following example creates a log for the volume vol03:

	vxassist addlog vol03 
When vxassist is used to add a log subdisk to a volume, a log plex is also created to contain the log subdisk, by default.

Once created, the plex containing a log subdisk can be treated as a regular plex. Data subdisks can be added to the log plex. The log plex and log subdisk can be removed using the same procedures used to remove ordinary plexes and subdisks.

Removing a Mirror

You may have more than one mirror for each volume. If you find that you have more mirrors than you need, you can remove a plex.


Note: The last valid mirror associated with a volume cannot be removed.


Removing a mirror involves first dissociating the plex from its volume and then removing the plex and any associated subdisks completely.

Dissociate and remove the plex from its volume as follows:

	vxplex -o rm dis plex_name 
For example, the following output from vxprint -h shows that volume volmir is mirrored using plexes volmir-01 and volmir-02:

Disk group: rootdg

TY  NAME       ASSOC      KSTATE     LENGTH   PLOFFS  STATE   UTIL0   PUTIL0
v   volmir     fsgen      ENABLED    10240    -       ACTIVE  -       -
pl  volmir-01  volmir     ENABLED    10240    -       ACTIVE  -       -
sd  disk01-03  volmir-01  -          10240    0       -       -       -
pl  volmir-02  volmir     ENABLED    10240    -       ACTIVE  -       -
sd  disk02-02  volmir-02  -          10240    0       -       -       -

To disassociate and remove volmir-02 from volmir, enter:

	vxplex -o rm dis volmir-02 
The output of vxprint -h for volmir is now:

Disk group: rootdg

TY  NAME       ASSOC      KSTATE     LENGTH   PLOFFS  STATE   UTIL0   PUTIL0
v   volmir     fsgen      ENABLED    10240    -       ACTIVE  -       -
pl  volmir-01  volmir     ENABLED    10240    -       ACTIVE  -       -
sd  disk01-03  volmir-01  -          10240    0       -       -       -

Removing a RAID-5 Log

Removing a RAID-5 log involves first dissociating the log from its volume and then removing the log and any associated subdisks completely.

Dissociate and remove the log from its volume in one operation as follows:

	vxplex -o rm dis plex_name 
To identify the log plex, use the command:

	vxprint -ht volume_name
where volume_name is the name of the RAID-5 volume. This should result in output that lists a plex with the STATE field of LOG.

To disassociate and remove the log plex volraid-02 from volraid, enter:

	vxplex -o rm dis volraid-02 
The output of vxprint -h for volraid is now:

Disk group: rootdg

TY	NAME 		ASSOC 	KSTATE 	LENGTH	PLOFFS	STATE	TUTIL0		PUTIL0    
v	volraid 	raid5 	ENABLED	32 	-	ACTIVE	-		-
pl	volraid-01 	volraid	ENABLED	32	-	ACTIVE	-		-
sd	disk01-03 	volraid-01 - 	32 	0	-	-		-
sd	disk02-02 	volraid-01 -	32 	0	-	-		-

Extending a Volume

If the volume is not large enough for the amount of data that needs to be stored in it, you need to extend the volume's length.

Extending to a Given Length

Extend a volume to a specific length as follows:

	vxassist growto volume_name length 
To extend volcat to 2000 sectors, enter:

	vxassist growto volcat 2000 

Extending by a Given Length

Extend a volume by a specific length as follows:

	vxassist growby volume_name length
To extend volcat by 100 sectors, enter:

	vxassist growby volcat 100 

Shrinking a Volume

If you find that your volume is much larger than you really need it to be, you can shrink the volume's size.


CAUTION! Do not shrink a volume below the size of the file system. If you have a VxFS file system, you can shrink the file system and then shrink the volume. If you do not shrink the file system first, you risk unrecoverable data loss.


Shrinking to a Given Length

Shrink a volume to a specific length as follows:

	vxassist shrinkto volume_name length 
Make sure you do not shrink the volume below the current size of the file system or database using the volume. This command can be safely used on empty volumes.

To shrink volcat to 1300 sectors, enter:

	vxassist shrinkto volcat 1300 

Shrinking by a Given Length

Shrink a volume by a specific length as follows:

	vxassist shrinkby volume_name length 
To shrink volcat by 300 sectors, enter:

	vxassist shrinkby volcat 300 

Preparing a Volume for Online Backup

It is important to make backup copies of your volumes. This provides a copy of the data as it stands at the time of the backup. Backup copies are used to restore volumes lost due to disk failure, or data destroyed due to human error. The Volume Manager allows you to back up volumes with minimal interruption of the volume's availability for users.


Note: The volume backup described here does not apply to RAID-5 volumes.


Backing up a volume with vxassist involves the following procedure:

1. Create a snapshot mirror of the volume to be backed up.

The vxassist snapstart operation creates a write-only backup mirror, which is attached to and synchronized with the volume to be backed up. When synchronized with the volume, the backup mirror is ready to be used as a snapshot mirror. However, it continues being updated until it is detached during the actual snapshot portion of the procedure. This may take some time, depending on the volume size.

2. Choose a suitable time to create a snapshot volume.

If possible, plan to take the snapshot at a time when users are accessing the volume as little as possible.

3. Create a snapshot volume that reflects the original volume at the time of the snapshot.

The online backup procedure is completed by running the vxassist snapshot command on the volume with the snapshot mirror. This operation detaches the finished snapshot mirror, creates a new normal volume, and attaches the snapshot mirror to it. The snapshot then becomes a read-only volume. This step should only take a few minutes.

The snapshot volume can now be used by backup utilities while the original volume continues to be available for applications and users.

Create a snapshot mirror for a volume as follows:

	vxassist snapstart volume_name 
To create a snapshot mirror of a volume called voldef, enter:

	vxassist snapstart voldef 
After creating the snapshot mirror, create a snapshot volume that reflects the original volume as follows:

	vxassist snapshot volume_name new_volume_name 
To create a snapshot volume of voldef, enter:

	vxassist snapshot voldef snapvol 
You can now back up the snapshot volume by whatever means you prefer. To avoid wasting space, you can then remove the snapshot volume, which occupies as much space as the original volume.

Displaying Volume Configuration Information

The vxprint command can be used to display information about how a volume is configured.

Display the volume, mirror, and subdisk record information for all volumes as follows:

	vxprint -ht 
This displays output such as the following:


Disk group: rootdg

DG NAME      NCONFIG  NLOG    MINORS   GROUP-ID
DM NAME      DEVICE   TYPE    PRIVLEN  PUBLEN   STATE
V  NAME      USETYPE  KSTATE  STATE    LENGTH   READPOL    PREFPLEX
PL NAME      VOLUME   KSTATE  STATE    LENGTH   LAYOUT     NCOL/WID  MODE
SD NAME      PLEX     DISK    DISKOFFS LENGTH   [COL/]OFF  DEVICE    MODE

dg rootdg    759096729.1025.tweety

dm disk10    c1b0t0d0s0 sliced  559    1044400  -
dm disk20    c2b0t0d0s0 sliced  559    1044400  -

v  pubs      fsgen    ENABLED ACTIVE   2288     SELECT     -
pl pubs-01   pubs     ENABLED ACTIVE   2288     CONCAT     -          RW
sd disk10-01 pubs-01  disk10  0        2288     0          c1b0t0d0   ENA

v  voldef    sgen     ENABLED ACTIVE   20480    SELECT     -
pl voldef-01 voldef   ENABLED ACTIVE   20480    CONCAT     -          RW
sd disk10-02 voldef-0 disk10  2288     20480    0          c2b0t1d0   ENA

where dg is a disk group, dm is a disk, v is a volume, pl is a plex, and sd is a subdisk. The top few lines indicate the headers that match each type of output line that follows. Each volume is listed along with its associated plex(es) and subdisk(s).

Display volume-related information for a specific volume as follows:

	vxprint -t  volume_name 
To display information about voldef, enter:

	vxprint -t voldef 
This displays output similar to the following:

	Disk group: rootdg

	V  NAME    USETYPE  KSTATE   STATE    LENGTH  READPOL  PREFPLEX

	v  voldef  fsgen    ENABLED  ACTIVE   20480   SELECT   -  


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