1. LUN partitioning
LUN is just a logical thing. Within the storage device, the relationship between the LUN and the physical hard disk is like the relationship between the logical volume and the physical hard disk in the host, that is, the relationship between the LV and PV, in different categories. It can be understood that LUN is the logic driver on the Logical Disk after RAID.
But the difference is that LUN is a physical hard disk on the host.
The LUN is definitely not a hard disk. It is in a raid group and connected to a host. NT is reflected as a disk and AIX is reflected as a pv.
A raid can be allocated to a maximum of 226 Luns in the emcstorage (the cx4-480 supports 4096 Luns), ranging in MB. Hundreds of GB.
LUN originated from SCSI: the Logical Unit Number, because the SCSI era has a maximum of 16 SCSI IDs, and the card itself occupies at least one. If there is no LUN, this means that each card can have up to 15 hard disks connected to a disk array-Incredible. Therefore, the scsi id + LUN (0-255) can have 15*256 = 3840 hard disks, enough.
After the storage server came out, it was virtualized. From the perspective of SCSI on the host side, it was represented by hard disks with different Luns (actually virtual, and the storage server became a black box ).
The relationship between the LUN and the physical hard disk is not regular. You can set the LUN on your own and do not have to perform RAID, but generally do it all.
2. Add a new PV
A hard disk must be initialized before it can be used by LVM. You can use the pvcreate command to write PVRA information to the hard disk. In this way, a hard disk written with PVRA information is called PV.
# Pvcreate/dev/rdsk/c0t5d0 if you already have PVRA information on this hard disk, that is, this hard disk may have been used by other lvms before, then you will get an error message: # pvcreate: The Physical Volume already belongs to a Volume Group. If you are sure to initialize this hard disk, you can use The-f parameter to forcibly execute it.
# Pvcreate-f/dev/rdsk/c0t5d0 Note: if it is a boot disk, add the-B option. In this way, the disk header will be retained with a space of KB to the LVM header. For more information, see LVM structure information.
If you want to create a boot disk image, refer to the "root disk image" section.
After the hard disk is initialized, you can add the PV to an existing VG: # vgextend vg01/dev/dsk/c0t5d0 # vgdisplay-v vg01
Note that during hard disk initialization (pvcreate/dev/rdsk/c0t5d0), the device used is "rdsk ", when adding a PV to an existing VG, the device used is "dsk ". You should have a clear understanding of the differences between "rdsk" and "dsk". If you are not clear about the differences, you can view relevant information. This is the most basic part of LVM operations.
3. Add a new VG
The following process demonstrates how to create a VG that contains two PVs:
A. initialize PV # pvcreate [-f]/dev/rdsk/c0t5d0 # pvcreate [-f]/dev/rdsk/c0t6d0
B. Select a unique number (minor number) for VG)
# Ll/dev/*/group
Crw-r -- 1 root sys 64 0x000000 Apr 4 2001/dev/vg00/group
Crw-r -- 1 root sys 64 0x010000 Oct 26/dev/vg01/group
Crw-r -- 1 root sys 64 0x020000 Aug 2/dev/vgsap/group
C. Create a VG control file (group file)
# Mkdir/dev/vgnew
# Mknod/dev/vgnew/group c 64 0x030000 Note: When Using vgcreate and vgimport commands, PHCO_24645 (UX 11.00) or PHCO_25814 (UX 11.11) check whether the VG control file is a unique number.
D. Create and display VG
# Vgcreate vgnew/dev/dsk/c0t5d0/dev/dsk/c0t6d0
# Vgdisplay-v vgnew
Note: When creating a VG, you must pay special attention to the max_pe parameter, which limits the maximum number of PES for each PV in the VG. The default value is 1016, and the maximum value is 65535.
Besides vgcreate, no other commands can adjust this parameter (max_pe ). This requires you to consider the possible growth of data in the future when creating a VG.
When vgcreate is used to create VG, the operating system will specify the PE size (4 MB by default) based on the current hard disk size and the default max_pe (1016 ).
If you want to add a larger hard disk in the future, this may waste extra space, because at this time, you cannot adjust the max_pe parameter.
A good experience is to specify a large max_pe Based on the possible growth in the future.
4. Add a new LV
Run the following command to create an LV That is 500 MB in size, named lvdata, and exists in vg01:
If you want to create a LV on a certain PV, You can first create a 0 mb lv, and then expand the LV space, so that you can specify:
# Lvcreate-n lvdata vg01 # lvextend-L 500/dev/vg01/lvdata/dev/dsk/c4t2d0 then you can use newfs to create a file system
# Newfs-F <fstype>/dev/vg01/rlvdata Description: fstype can be HFS or VxFS (or JFS)
5. Strip
In aix/hp, no strip is selected when the lv is created. The data written in the sequence is: write the first block and then write the second block until the last hard disk is fully written.
When creating a lv, select strip and write data to n hard disks at the same time. When dividing a LUN, multiple Luns are taken from multiple raid groups on average to improve performance.
Obviously, striping between the Luns of different RG will improve the performance. it is meaningless to strip the Luns of the same rg, it may even increase the unnecessary head locating time of the physical hard disk.