Thursday, September 21, 2006

Some HP/UX LVM notes

  • To make volume groups by hand
    mkdir /dev/vg01 /dev/vg02
    /usr/sbin/mknod /dev/vg01/group c 64 0x010000
    /usr/sbin/mknod /dev/vg02/group c 64 0x020000
  • Create physical volumes
    /usr/sbin/pvcreate /dev/rdsk/c5t0d0
    /usr/sbin/pvcreate /dev/rdsk/c6t0d0
  • Add the disks to the volume groups (remember to make sure the max extents per disk are large enough for future larger disks, it can't be changed in the future)
    /usr/sbin/vgcreate -e 15000 /dev/vg01 /dev/dsk/c5t0d0
    /usr/sbin/vgcreate -e 15000 /dev/vg02 /dev/dsk/c6t0d0
  • Create some logical volumes
    /usr/sbin/lvcreate -L 23436 -s y /dev/vg01
    /usr/sbin/lvcreate -L 2604 -s y /dev/vg01
    /usr/sbin/lvcreate -L 23436 -s y /dev/vg02
    /usr/sbin/lvcreate -L 2604 -s y /dev/vg02
  • To recreate /etc/lvmtab
    mv /etc/lvmtab /etc/lvmtab.old
    vgscan -av
  • To import disks into a volume group with
    vgimport -v /dev/vg01 /dev/dsk/c4t5d0 /dev/dsk/c4t12d0
    don't worry if you get the disks wrong. vgimport checks the disk to see if they are all in the same LV you might be able to find which disks belong in which VG from strings /etc/lvmtab but only if they've been on that system before.
  • Net recovery does these things to import VG's after a recovery
    /usr/sbin/vgimport -v -m /etc/lvmconf/vg01.mapfile /dev/vg01 /dev/dsk/c3t15d0
    /usr/sbin/vgchange -a r vg01
    test -d /dev/vg00 && /usr/sbin/vgcfgbackup /dev/vg00
    test -d /dev/vg01 && /usr/sbin/vgcfgbackup /dev/vg01
  • this will create the map file for use in the above
    /usr/sbin/vgexport -p -m /etc/lvmconf/vg01.mapfile /dev/vg01
  • if restoring a vg config to a new disk (make sure the SCSI ID is the same)
    vgcfgrestore -n /dev/ /dev/dsk/
    then activate the VG
    vgchange -a y

No comments: