Professional Documents
Culture Documents
This document is intended to provide some command line examples for commonly-used Veritas commands.
• Volume Manager/FileSystem
◦ Change the length of a volume containing a file system
◦ Creating concatenated volumes, file systems, and mounting them
◦ Creating mirrored volumes, file systems, and mounting them
◦ Disk space
◦ How to fsck a vxfs filesystem
◦ Move a disk group to another system
◦ Removing a volume
◦ What are the read policies for plexes in VERITAS Volume Manager?
◦ How to assign specific disks to specific plexes when growing the size of a mirror volume and the file system underneath it
◦ How to check for/enable largefile support on vxfs
◦ Remove a mirror from a volume
• NetBackup
◦ Installing the NetBackup Client on a Solaris server
Volume Manager/FileSystem
# /etc/vx/bin/vxresize [-bfsx] [-F fstype] [-g diskgroup] [-t tasktag] volume new_length [medianame...]
OPTIONS
-b
Performs the resize operation in the background. The command returns quickly, but the resize will be in progress. Use the vxprint
command to determine when the operation completes.
-f
Forces a operation that is usually disallowed by vxresize.
-F fstype
Supplies the type of the file system to be resized.
-g diskgroup
Limits operation of the command to the given disk group, as specified by disk group ID or disk group name. The volume operand is
evaluated relative to the given disk group.
-s
Requires that the operation represent a decrease in the volume length.
-t tasktag
If any tasks are registered to track the progress of the operation, mark them with the tag tasktag. The tag specified by tasktag is a sequence
of up to 16 alphanumeric characters.
-x
Requires that the operation represent an increase in the volume length. Fail the operation otherwise.
# mkdir mount_point
http://www.hyborian.demon.co.uk/notes/vx_cli.html 12/7/2010
Veritas Command Line Interface : Useful Commands Page 2 of 5
# mkdir mount_point
Disk space
There is no simple command to display the total amount of VxVM disk space (i.e., the total size of all the public regions or the sum of the
free and allocated disk space under VxVM control).
Listed below are a few examples of how it is possible to use the vxprint and vxdisk commands to find the amount of VxVM disk space:
1.) To find the total amount of VxVM disk space (free and used) in a particular disk group, expressed in 512K blocks:
# vxprint -g name_of_disk_group -dF "%publen" | awk 'BEGIN {s = 0} {s += $1} END {print s, "512K blocks"}'
Henceforth all output will be in GigaBytes. Adjust the commands for blocks if you wish.
2.) To find the total amount of VxVM disk space for all disk groups:
# vxprint -AQqdF "%publen" | awk 'BEGIN {s = 0} {s += $1} END {print s/2097152, "GB"}'
3.) To include the space on disks that were in a disk group that was deported, or space that was not associated with any disk groups but
were already under VxVM or in other words, to find out the total space or capacity of all VxVM disks, use vxdisk:
# vxdisk -q list | awk '{ if ($5 == "online") print $1}' | xargs vxdisk list | grep "^public:" | awk -F'='
'BEGIN {s=0} {s+=$NF} END {print s/2097152, "GB"}'
vxfs contains a filesystem log that will vastly reduce the time required to fsck a filesystem. When checking the filesystem using the
command:
# fsck -F vxfs <path_to_raw_device>
the log will be the only thing checked.
There are times that the log will check cleanly, but the filesystem is still dirty. To check the filesystem directly, the following options need
to be added to fsck:
# fsck -F vxfs -o nolog,full <path_to_raw_device>
The nolog option tells fsck to bypass the log and go directly to the filesystem. The full option tells fsck to check the entire filesystem.
Using these options will take much longer, but you will be able to fsck the filesystem directly.
1. Unmount and stop all volumes in the disk group on the first system:
# umount /mntdir
# vxvol -g <diskgroup> stopall
2. Deport (disable all local access to) the disk group to be moved with this command:
# vxdg deport <diskgroup>
3. Import (enable local access to) the disk group and its disks from the second system with:
# vxdg import <diskgroup>
4. After the disk group is imported, start all volumes in the disk group with this command:
# vxrecover -g <diskgroup> -sb
The options here indicate that VERITAS Volume Manager will start all the disabled volumes (-s) in the background (-b).
http://www.hyborian.demon.co.uk/notes/vx_cli.html 12/7/2010
Veritas Command Line Interface : Useful Commands Page 3 of 5
Remove 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.
After following these steps, remove the volume with this command:
vxedit rm volume_name
or
vxedit -rf rm volume_name
The -r option indicates recursive removal, which means the removal of all plexes associated with the volume and all subdisks associated
with those plexes. The -f option forces removal, and is necessary if the volume is enabled.
Note: The -r option of vxedit removes multiple objects. Exercise caution when using it.
You can also remove an entire volume with the vxassist command. Use the keywords remove and volume and provide the volume name on
the command line as shown in this example:
vxassist remove volume volume_name
What are the read policies for plexes in VERITAS Volume Manager?
When a volume has more than one enabled associated plex, VERITAS Volume Manager (VxVM) can distribute reads between the plexes
to distribute the I/O load and thus increase total possible bandwidth of reads through the volume. The read policy can be set by the
administrator. Possible policies are:
1. Preferred plex
This read policy specifies a particular named plex that is used to satisfy read requests. In the event that a read request cannot be
satisfied by the preferred plex, this policy changes to round-robin.
2. Round-robin
For every other read operation, distribute the operation across all of the available plexes. Given three plexes, this switches between
each of the three plexes, so each plex gets one third of the read requests.
3. Select
This read policy is the default policy, and adjusts to use an appropriate read policy based on the set of plexes associated with the
volume. If exactly one enabled read-write striped plex is associated with the volume, then that plex is chosen automatically as the
preferred plex; otherwise, the round-robin policy is used. If a volume has one striped plex and one non-striped plex, preferring the
striped plex often yields better throughput.
For example, to set the read policy for volume vol01 in disk group datadg to round-robin, use the following command:
# vxvol -g datadg rdpol round vol01
How to assign specific disks to specific plexes when growing the size of a mirror volume and the file system underneath it
The recommended and practical method to grow a volume and the file system underneath it is either to use the GUI, Volume Manager
Storage Administrator (VMSA) or the vxresize command (if using a VxFS file system).
In both cases you can control the disks used to grow the volume, but not how they will be assigned to plexes. In some environments, it may
be necessary to control which disk can be used by Volume Manager (VxVM) to grow a particular plex.
This can be achieved by manually creating the subdisk from a chosen disk and associating it to the required plex.
http://www.hyborian.demon.co.uk/notes/vx_cli.html 12/7/2010
Veritas Command Line Interface : Useful Commands Page 4 of 5
The volume, for example, is to be grown by 50Mb using a disk called disk2 to grow the testvol-01 plex and a disk called disk3 to grow the
testvol-02 plex.
Note: a useful method to determine the free space on a disk and the offset to use in the vxmake command is to use the vxdg free
command.
The output shows that the size of the plexes increased (307600 blocks), but it is also necessary to grow the volume to the new size of
the plex (volume size remains 204800 blocks).
4. Set the new size of the volume by getting the contig_len value for one of the plexes:
# vxprint -g testdg -m testvol-01 | grep contig_len
contig_len=307600
Use this value to set the volume length using the following command:
# vxvol -g testdg -o force set len=307600 testvol
5. If the file system is VxFS type, resize it using the fsadm command:
# fsadm -F vxfs -b 307600 /test_mnt
UX:vxfs fsadm: INFO: /dev/vx/rdsk/testdg/testvol is currently 204800 sectors - size will be increased
/dev/vx/dsk/testdg/testvol
153800 1141 143125 1% /test_mnt
If the file system is UFS type, please refer to Sun Microsystems documentation for the command to grow the file system.
Unlike ufs, you can enable vxfs largefile support on the fly with fsadm:
# /usr/lib/fs/vxfs/fsadm -o largefiles /mount/point
This command will remove the mirror (plex) and all associated subdisks.
http://www.hyborian.demon.co.uk/notes/vx_cli.html 12/7/2010
Veritas Command Line Interface : Useful Commands Page 5 of 5
NetBackup
List available backup policies, and select a suitable one for the client:
# /usr/openv/netbackup/bin/admincmd/bppllist
Cougar-Servers
Development-Oracle
Development-Servers
INFINITY
NetBackup-Servers
Off-Site
Off-Site-Oracle
Production-Oracle
Production-Servers
Test-backup
Vault-Jobs
You can determine the syntax for the hardware and OS by listing existing clients within a particular policy:
# bpplclients Development-Servers
Hardware OS Client
--------------- --------------- --------------
Solaris Solaris8 redback-g
Solaris Solaris8 tarantula-g
Solaris Solaris8 incywincy-g
... ... ...
Solaris Solaris8 melrose-g
Solaris Solaris8 aspen-g
Solaris Solaris7 lasvegas-g
So, to add a Solaris 8 host called fortuna, (using it's gigabit interface) to the Development-Servers policy, you would use the command:
# /usr/openv/netbackup/bin/admincmd/bpplclients Development-Servers -add fortuna-g Solaris Solaris8
After this, the last line of the output from bpplclients Development-Servers should now read:
Solaris Solaris8 fortuna-g
Remove
sirius-g root
from /.rhosts.
http://www.hyborian.demon.co.uk/notes/vx_cli.html 12/7/2010