9/24/2012

HP-UX: Disk and Filesystem tasks



  Search for attached disk
                ioscan -fnC disk
   Initialize a disk for use with LVM
                pvcreate -f /dev/rdsk/c0t1d0
   Create the device structure needed for a new volume group.
                 cd /dev
                 mkdir vgdata
                 cd vgdata
                 mknod group c 64 0x010000

  Create volume group vgdata
                 vgcreate vgdata  /dev/dsk/c0t1d0 { if your expecting to use more than 16 physical disks use the -p option, range from 1 to 256 disks. }
   Display volume group vgdata
                 vgdisplay -v vg01
   Add another disk to volume group
                 pvcreate -f /dev/rdsk/c0t4d0
                 vgextend vg01 /dev/dsk/c0t4d0
    Remove disk from volume group
                 vgreduce vg01 /dev/dsk/c0t4d0
     Create a 100 MB logical volume lvdata
                 lvcreate -L 100 -n lvdata vgdata
                 newfs -F vxfs  /dev/vgdata/rlvdata

      Extend logical volume to 200 MB
                 lvextend -L 200 /dev/vgdata/lvdata
      Extend file system to 200 MB
                 { if you don't have Online JFS  installed volumes must be unmounted before you can extend the file system.  }
                 fuser -ku /dev/vgdata/lvdata                        { kill all process that has open files on this volume. }
                 umount /dev/vgdata/lvdata
                 extendfs /data

                 { for  Online JFS,     200 MB  / 4 MB  = 50 LE; 50 x 1024 = 51200 blocks }
                  fsadm -F vxfs -b 51200 /data
        Set largefiles to support files greater than 2GB
                  fsadm -F vxfs -o largefiles /data
 
Exporting and Importing disks across system.

        1.  make the volume group unavailable
               vgchange -a n /dev/vgdata
        2. Export the the disk while creating a logical volume map file.
                vgexport -v -m data_map vgdata
        3.  Disconnect the drives and move to new system.
        4.   Move the data_map file to the new system.
        5.  On the new system recreate the volume group directory
                 mkdir /dev/vgdata
                 mknod /dev/vgdata/group c 64 0x02000

        6. Import the disks to the new system
                  vgimport -v -m data_map /dev/vgdata  /dev/dsk/c2t1d0 /dev/dsk/c2t2d0
        7.  Enable the new volume group
                  vgchange -a y /dev/vgdata
 Renaming a logical volume
          /dev/vgdata/lvol1  -> /dev/vgdata/data_lv
         umount /dev/vgdata/lvol1
         ll  /dev/vgdata/lvol1                                      take note of the minor ( e.g 0x010001 )
                        brw-r-----   1 root       root        64 0x010001 Dec 31 17:59 lvol1

         mknod  /dev/vgdata/data_lv b 64 0x010001       create new logical volume name
         mknod  /dev/vgdata/rdata_lv c 64 0x010001

         vi /etc/fstab                                               { reflect the new logical volume  }
         mount -a
 
         rmsf /dev/vgdata/lvol1
         rmsf /dev/vgdata/rlvol1

No comments:

Post a Comment

Popular Posts