A disk has to be initialized before LVM can use it. The pvcreate command writes the PVRA
to the disk and such a disk is called a PV:
# pvcreate /dev/rdsk/c0t5d0
If there is a valid PVRA already on the disk (it could have been used wit LVM before) you
will get the following error message:
# pvcreate: The Physical Volume already belongs to a Volume Group
If you are sure the disk is free you can force the initialization using the -f option:
# pvcreate -f /dev/rdsk/c0t5d0
NOTE: For bootable disks you have to use the -B option additionally. This preserves the fixed 2912KB space
for the LVM header (see section LVM structural information). You can find the procedure how to make a
disk bootable in the section Mirroring the root disk later in this chapter.
To add the PV to an existing VG do:
# vgextend vg01 /dev/dsk/c0t5d0
# vgdisplay -v vg01
Adding a new VG
Here’s how to create a new VG with 2 disks:
1) initialize the disk if not yet done:
# pvcreate [-f] /dev/rdsk/c0t5d0
# pvcreate [-f] /dev/rdsk/c0t6d0
2) select a unique minor number for the VG:
# ll /dev/*/group
crw-r--r-- 1 root sys 64 0x000000 Apr 4 2001 /dev/vg00/group
crw-r--r-- 1 root sys 64 0x010000 Oct 26 15:52 /dev/vg01/group
crw-r--r-- 1 root sys 64 0x020000 Aug 2 15:49 /dev/vgsap/group
3) create the VG control file (group file):
# mkdir /dev/vgnew
# mknod /dev/vgnew/group c 64 0x030000
NOTE: Starting with LVM commands patch PHCO_24645 (UX 11.00) or PHCO_25814 (UX 11.11)
vgcreate and vgimport will check for the uniqueness of the group file's minor number.
Adding a new LV
The following creates a 500MB large LV named lvdata on any disk(s) of the VG vg01:
# lvcreate -n lvdata -L 500 vg01
You cannot specify a PV with lvcreate. If you like to place the LV on a specific PV, then first
create an LV of 0MB. It has no extents - it just exists.
# lvcreate -n lvdata vg01
Now extend the LV onto a certain disk:
# lvextend -L 500 /dev/vg01/lvdata /dev/dsk/c4t2d0
Now you can use newfs to put a FS onto the LV:
# newfs -F
where fstype is either hfs or vxfs.
NOTE: Nowadays it is recommended to use a VxFS (=JFS) file system.
No comments:
Post a Comment