1832999 Members
2387 Online
110048 Solutions
New Discussion

LVM cookbook

 
SOLVED
Go to solution
Mike Ingram_1
Frequent Advisor

LVM cookbook

I am going round in circles trying to get a disk added to my HP system.
I have used SAM and a number of commands like pvcreate, vgcreate, lvcreate etc. etc. but cannot get the logical volume created.
Is there any simple step by step guide or information that could assist me here?
Many thanks.
5 REPLIES 5
Karthik S S
Honored Contributor
Solution

Re: LVM cookbook

To see the list of disks

# ioscan -fnC disk
Class I H/W Path Driver S/W State H/W Type Description
==========================================================================
disk 0 1/0/0/3/0.6.0 sdisk CLAIMED DEVICE HP 73.4GATLAS10K3_73_SCA
/dev/dsk/c0t6d0 /dev/rdsk/c0t6d0
disk 1 1/0/0/3/1.2.0 sdisk CLAIMED DEVICE HP DVD-ROM 305
/dev/dsk/c1t2d0 /dev/rdsk/c1t2d0
disk 2 1/0/1/0/0/1/1.6.0 sdisk CLAIMED DEVICE HP 73.4GATLAS10K3_73_SCA
/dev/dsk/c3t6d0 /dev/rdsk/c3t6d0

To view the existing Volume Groups in the system
# strings /etc/lvmtab
/dev/vg00
/dev/dsk/c0t6d0

Select a free disk and create physical volume
# pvcreate /dev/rdsk/c3t6d0
Physical volume "/dev/rdsk/c3t6d0" has been successfully created.

Create a directory and group file for the VG (make sure the minor number is unique by checking other VGs)

# cd /dev
# ll /dev/vg00/group
crw-r----- 1 root sys 64 0x000000 Feb 12 20:37 /dev/vg00/group
#
# mkdir vg01
# cd vg01
# mknod group c 64 0x010000

Create a Volume Group
# vgcreate vg01 /dev/dsk/c3t6d0
Increased the number of physical extents per physical volume to 17501.
Volume group "/dev/vg01" has been successfully created.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf

To review the VG that you have created
# vgdisplay vg01
--- Volume groups ---
VG Name /dev/vg01
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 0
Open LV 0
Max PV 16
Cur PV 1
Act PV 1
Max PE per PV 17501
VGDA 2
PE Size (Mbytes) 4
Total PE 17499
Alloc PE 0
Free PE 17499
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0

Create a logical volume and filesystem
# lvcreate -l 17499 vg01
Logical volume "/dev/vg01/lvol1" has been successfully created with
character device "/dev/vg01/rlvol1".
Logical volume "/dev/vg01/lvol1" has been successfully extended.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf

# newfs /dev/vg01/rlvol1
newfs: /etc/default/fs is used for determining the file system type
version 4 layout
71675904 sectors, 8959488 blocks of size 8192, log size 256 blocks
unlimited inodes, largefiles not supported
8959488 data blocks, 8958864 free data blocks
274 allocation units of 32768 blocks, 32768 data blocks
last allocation unit has 13824 data blocks


Mount the filesystem and make it persistent by adding an entry to /etc/fstab
# mkdir /vg01
# mount /dev/vg01/lvol1 /vg01

# bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 67158016 1793808 64854248 3% /
/dev/vg00/lvol1 298928 28376 240656 11% /stand
/dev/vg01/lvol1 71675904 4472 71111512 0% /vg01
#

# cat /etc/fstab
# System /etc/fstab file. Static information about the file systems
# See fstab(4) and sam(1M) for further details on configuring devices.
/dev/vg00/lvol3 / vxfs delaylog 0 1
/dev/vg00/lvol1 /stand hfs defaults 0 1
/dev/vg01/lvol1 /vg01 vxfs defaults 0 1
#

-Karthik S S
For a list of all the ways technology has failed to improve the quality of life, please press three. - Alice Kahn
Mark Grant
Honored Contributor

Re: LVM cookbook

Can you explain exactly what the problem is?

In general, the steps are as folloes.

1) Make disk available to lvm
"pvcreate /dev/rdsk/cXtXdX

2a)Create a volume group (assuming you are not adding this to an existing cvolume group)
"mkdir /dev/vgnewvg" (call it what you fancy)
"mknod group c 64 0x010000" (that last number needs to be unique for your system/cluster where ls /dev/vg*/group will show you what you already have)
"vgcreate vgnewvg /dev/dsk/cXtXdX"


2b) If adding disk to existing volume group
"vgextend vgexisting /dev/dsk/cXtXdX"

3) Create a logical volume on it
"lvcreate -LXXX /dev/vgnewvg" (XXX is the size in megabytes)

4) Make a filesystem on your shiny neew logical volume
"newfs -F vxfs /dev/vgnewvg/rlvol1"

5) Mount it somewhere
"mount /dev/vgnewvg/lvol1 /somedirectory"

6) Add the above to /etc/fstab

7) Make a cup of coffee and get all your managers to pat you on the back for a job well done (yeah right!)

Never preceed any demonstration with anything more predictive than "watch this"
Steve Steel
Honored Contributor

Re: LVM cookbook

Hi

http://strc.comet.ucar.edu/unix/right.htm

http://strc.comet.ucar.edu/unix/textfiles/device_manipulation_hpux1020.htm

Will help


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
T G Manikandan
Honored Contributor

Re: LVM cookbook

Mike Ingram_1
Frequent Advisor

Re: LVM cookbook

Many thanks to all you guys.
The problem was that the disk was faulty. Once I used a new disk, it all worked easily, and I found SAM the easiest way to create the new logical volume and volume group etc.