Drucken

Anlegen einer neuen Volume Group und Logical Volumes

Physical disks initialisieren

pvcreate /dev/rdisk/disk11
pvcreate /dev/rdisk/disk12

Volume Group anlegen

erstelle eine Volume Group (Version 2.1) vg40 mit einer maximalen Volume Group Size von 4Terabyte und einer Physical Extend size (PE size) von 32MByte
mkdir /dev/vg40
mknod /dev/vg40/group  c 128 0x280000 #0x28 (hex) = 40 (dez)

NOTE: Notice that the major number for a volume group version 2.0
or higher is 128 while the major number for a volume group
version 1.0 is 64. Also, the volume group number occupies the
high order 12 bits of the minor number rather than the high order
8 bits as in volume groups version 1.0.

vgcreate -V 2.1 -S 4t -s 32m vg40 /dev/disk/disk11 /dev/disk/disk12

Anlegen der logical volumes

Volumes definiert anlegen nach dem Muster:
volume:mount point:LV Size[MB]:BLK Size[bytes]:disk1:mirror disk2 lvol6:6400:8192:/test/vol4:disk11:disk12

Mit Hilfe folgender Syntax:
VG=vg40
IFS=":"
for volume in \
lvol1:/test/vol1:640::disk11:disk12 \
lvol2:/test/vol2:320::disk11:disk12 \
lvol3:/test/vol3:64::disk11: \
lvol4:/test/vol3:64::disk12: \
lvol5:/test/vol3:640:8192:disk11: \
lvol6:/test/vol4:6400:8192:disk12: \
lvolret::640:8192:disk11:disk12
do
   set -A VAL $(print "$volume")
   lvcreate -n ${VAL[0]} /dev/$VG
   lvextend -L ${VAL[2]} /dev/$VG/${VAL[0]} /dev/dsk/${VAL[4]}
   if [ ! -z "${VAL[5]}" ] ; then
      lvextend -m 1 /dev/$VG/${VAL[0]} /dev/dsk/${VAL[5]}
   fi
   newfs -F vxfs -o largefiles ${VAL[3]:+"-b ${VAL[3]}"} /dev/$VG/r${VAL[0]}
   if [ ! -z "${VAL[1]}" ] ; then
      mkdir -p ${VAL[1]}
      echo "/dev/$VG/${VAL[0]} ${VAL[1]} vxfs delaylog 0 2">> /etc/fstab
   fi
done
unset IFS