How to change the group id on a veritas Disk Group

Das geht ab der Version 3.5 mit folgendem Befehl:

Ab der Version 5.x geht das beim Importieren einer Diskgruppe!

Für ältere Versionen < 3.5 siehe nachfolgenden Beitrag:


On Fri, Feb 28, 2003 at 05:10:30PM -0700, Yves Dorfsman wrote:
> I am running in a bit of a problem here. We have an EMC Symetrix, two
> hosts plugged to it (actually more, but only two are relevant here), one
> for prod, one for pre-prod.
> We use the EMC BCV technology to copy the disks from prod to pre-prod. EMC
> BCV is a physical copy of the disks.
> We have one big database on prod, but need two separate copies of it in
> pre-prod. For some (valid) reason, we HAVE TO use veritas filesystem and
> lvm. The problem we run into here, is that both copies of prod are
> physical copies, therefore I can "vxdg import" only one of them at a time,
> even though I rename the disk group, when I try to import the second copy
> (from a different set of disk, but an identical copy), I get an error
> message telling me that this disk group has already been imported. It
> looks like the problem is that even when you rename the disk group, the
> disk group ID doesn't change.
> Anybody has run into this ? How did you solve it ?
> Or.... Any idea on how to change the DG ID on a veritas dg ?

Had the exact same situation on a previous site. A colleague of mine designed
our solution, which was to change the IDs after every import of the BCV disks,
in order to avoid future conflicts.


# Authors: Peter Bousfield <>, Carl Marino <>
# Date: Fri Sep 6 15:13:45 BST 2002
# Version: 1.1
# Description: This program is used to change the diskids and dgid of a given diskgroup. You will
# want to do this after taking a BCV copy to ensure that there are not id conflicts.
# Note diskgroup must be already imported (to get disk group info), and must be able
# to be deported (ie. volumes not in use, no file systems mounted).


if [[ -z ${DG} ]] ; then
print -u2 "Usage: ${Me} diskgroup"
exit 1
print "Changing disk/group ID of ${DG} ..."

vxprint -g ${DG} -hmvps > ${FILE}
if [[ ! -s ${FILE} ]] ; then
print -u2 "\nERROR - no configuration in ${FILE} - aborting!"
exit 1

print "\nRecreating ${DG} disks with existing regions"
set -A CTD $(vxprint -g ${DG} -dF '%assoc')
set -A NAME $(vxprint -g ${DG} -dF '%name')
vxdg deport ${DG}
(( i = 0 ))
while (( $i < ${#CTD[*]} )); do
print "\t- initializing ${CTD[$i]}"
vxdisk -f init ${CTD[$i]} $(vxdisk list ${CTD[$i]} | nawk '/^public:/ {printf("pub%s pub%s ", $3, $4)} /^private:/ {printf("priv%s priv%s", $3, $4)}')
(( i = $i + 1 ))

print "\nRecreating ${DG} with ${CTD[0]} as ${NAME[0]}"
vxdg init ${DG} ${NAME[0]}=${CTD[0]}
(( i = 1 ))
while (( $i < ${#CTD[*]} )); do
print "\t- adding disk ${CTD[$i]} as ${NAME[$i]}"
vxdg -g ${DG} adddisk ${NAME[$i]}=${CTD[$i]}
(( i = $i + 1 ))

print "\nRecreating ${DG} configuration"
vxmake -g ${DG} -d ${FILE}
for vol in $(vxprint -g ${DG} -vF %name) ; do
print "\t- initializing volume ${vol}"
vxvol -g ${DG} init active ${vol}

print "\n${Me} complete. Please check and then remove ${FILE}."
exit 0

Carl Marino <> $ perl -MTime::HiRes=usleep \