Use
Using a logical volume manager allows you to distribute partitions (logical volumes) across several disks (physical volumes). The individual logical volumes are grouped together into volume groups.
File systems can be larger than physical disks, but not larger than the volume group.
Procedure
1. Examine device configuration
Enter the command:
ioscan -f -C disk
This command provides the logical unit (LU) number and the hardware addresses of all
available devices, using the device class disk.
The following command scans all disks for logical volumes:
vgscan -pv
Make sure you use option -p (preview), otherwise /etc/lvmtab will be updated.
LVM can coexist in a system that uses fixed partitions.
2. Prepare disks
To assign an unused disk to a physical volume, enter:
pvcreate /dev/rdsk/<diskdevice>
3. Create volume group directory <VG Name> and group device file (for example SAPR3).
For each volume group in the system, there must be a volume group directory that has a
character device file named group in it:
mkdir /dev/<VG Name>
mknod /dev/<VG Name>/group c 64 0x<nn>0000
4. Create the volume group
To create a volume group, you specify which physical volumes (disks) belong to the
group:
vgcreate /dev/<VG Name> /dev/dsk/<diskdevice>
To add another disk to an existing volume group, enter:
vgextend /dev/<VG Name> /dev/dsk/<diskdevice>
5. Examine the size of volume group
To see how many physical disks you have in a volume group, enter:
vgdisplay /dev/<VG Name>
6. Calculate the free space in the volume group:
FREE_Space = Free physical extents (PEs) * PE_Size
7. Create one logical volume for each file system listed in SAPFS.PAR:
lvcreate /dev/<VG Name>
Allocate the logical volume to a disk with the command:
lvextend -L <size in MB> /dev/<VGName>/<LVName>
/dev/dsk/<diskdevice>
SAPFS.PAR lists the required size for each file system. The size <in MB> should be a
multiple of PE_Size, or the size will be rounded up.
You can find out the size of the logical volume with either of these commands:
vgdisplay -v /dev/<VG Name>
lvdisplay /dev/<VG Name>/<LV Name>
Write down the device names of the logical volumes (for example, lv12).
You will need the device names when creating and mounting the file systems.
The following steps are only needed for file systems, not for raw devices. If
you set up raw devices, see section Accessing Raw Devices for more
information.
8. Determine the disk type with the command:
diskinfo /dev/rdsk/<diskdevice>
9. Create the file systems required by SAP.
For sapdata1 to sapdata<n> enter:
− HFS:
newfs -L -i 20000 -F hfs -b 8192 -f 8192 -m 1
/dev/<VG Name>/r<LV Name>
− JFS:
newfs -F vxfs -b 8192 /dev/<VG Name>/r<LV Name>
For all others, enter:
− HFS:
newfs -L -F hfs /dev/<VG Name>/r<LV Name>
− JFS:
newfs -F vxfs /dev/<VG Name>/r<LV Name>
The logical volume is identified by the device file that you defined when you created the
logical volume.
10. Create mount directories.
11. Add the new file system to the /etc/fstab.
HFS:
/dev/<VG Name>/<LV Name> /<mountdir> hfs defaults 0 2
JFS:
/dev/<VG Name>/<LV Name> /<mountdir> vxfs delaylog,
nodatainlog 0 2
12. Mount the file systems using the command:
mount -a
The mount sequence is determined via the file /etc/fstab
.
HP-UX: Setting up File Systems using SAM
Use
SAM is not able to build file systems with 8 K fragment size.
Procedure
1. Enter the command
/usr/sbin/sam
2. Select
Disks and Filesystems → File Systems → Actions
→ Add Local File System → Using the LVM
3. Add all disks.
4. Select
Disks and Filesystems → Volume Groups → Actions → Create
5. Create all volume groups.
6. Select
Disks and Filesystems → Logical Volumes → Actions → Create
7. Create all logical volumes.
8. Exit SAM.
SAM already creates filesystems with the newfs command, but the
filesystems for sapdata1 to sapdata<n> have to be rebuild with special
options.
9. Perform the steps 9 to 12 of Setting up File Systems Using LVM
− Create the file system required by SAP
− Create mount Directories
− Add the new file system to the /etc/fstab
− Mount the file system using the command