LVM
Features
Logical Volume Manager (LVM)
is a storage management system that lets you allocate and manage disk space for
file systems or raw data. Historically, you treated your disks individually and
in terms of fixed-sized partitions; each disk or partition held a file system,
swap space, boot area, or raw data. With LVM, you do not need to assign a disk
or fixed-sized partition to a single purpose. Instead, consider the disks as a
pool (or volume) of data storage, consisting of equal-sized extents. Extents
are allocated into virtual storage devices known as logical volumes, which can
be treated as disks.
LVM provides the following capabilities:
• A logical volume size can be dynamically
reduced or expanded to meet changing data needs. For example, a logical volume
can be as small or large as the file system mounted to it requires. The file
system can be extended without rebuilding it or the logical volume; reducing a
file system is more complex, and may require recreating the file system.
• Small chunks of unused space from several
disks can be combined to create a usable volume. • A logical volume can exceed
the size of a single physical disk. This feature is called disk spanning,
because a single file system (and individual files) can span disks.
• Up to six copies of identical data can be
stored and updated simultaneously using LVM. This feature is called mirroring a
logical volume, and requires an optional product, HP Mirror Disk/UX.
• Mirrored data can be configured to
automatically create a new mirror to a separate disk when one of the mirror
copies fails. This feature is called sparing, and requires an optional product,
HP Mirror Disk/UX.
• A logical volume can be created so that
logically contiguous data blocks (for example, chunks of the same file) are
distributed across multiple disks, which speeds I/O throughput for large files
when they are read and written sequentially. This feature is called striping.
Striping can be used in conjunction with mirroring.
• A point-in-time image of a
logical volume can be created, called a snapshot logical volume.
• Devices accessed through multiple links can
be configured to improve availability. If the primary link to a device fails,
LVM can switch automatically to an alternate link. This feature is called
multipathing.
Create a
new physical volume, volume group, logical volume and file system:
1.After
creating a new disk from SAN storage. Then we have to present it on desired
Server where
We
want to create a new file system.
2.
Now login into server and run below commands step by step:
first
of all, we have to detect newly created disk by using below command: -
# ls -ltr /dev/rdisk/*
crw-r----- 1 bin
sys 13 0x000001 Nov 21
14:51 /dev/rdisk/disk1
crw-r----- 1 bin
sys 13 0x000002 Nov 21
14:51 /dev/rdisk/disk1_p1
crw-r----- 1 bin
sys 13 0x000003 Nov 21
14:51 /dev/rdisk/disk1_p2
crw-r----- 1 bin
sys 13 0x000004 Nov 21 14:51
/dev/rdisk/disk8
3.Next step to create physical volume by using below
command: -
# pvcreate /dev/rdisk/disk8
Physical volume "/dev/rdisk/disk8" has
been successfully created.
4. Now we have to create volume group by using below
command: -
# vgcreate -s 32 /dev/vg02/
/dev/disk/disk8
Increased
the number of physical extents per physical volume to 25599.
Volume
group "/dev/vg02" has been successfully created.
Volume
Group configuration for /dev/vg02 has been saved in /etc/lvmconf/vg02.conf
#
Note: -
(Where –s is used to define physical extents per
physical volume. Because if you want to create a more than size of volume group
300 GB. Then 4,8 PE size is not supported so you can take 16 or 32.)
5. Now you can see the details of created volume group:
-
# vgdisplay -v /dev/vg02
---
Volume groups ---
VG
Name /dev/vg02
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 25599
VGDA 2
PE
Size (Mbytes) 32
Total
PE 25599
Alloc
PE 0
Free
PE 25599
Total
PVG 0
Total
Spare PVs 0
Total
Spare PVs in use 0
VG Version 1.0
VG
Max Size 13106688m
VG
Max Extents 409584
--- Physical volumes ---
PV Name /dev/disk/disk8
PV Status available
Total PE 25599
Free PE 25599
Autoswitch On
Proactive Polling On
#
(Optional)
------------------------------------------------------------------------------------------------------------------------
- If you want to upgrade your VG version then use below command: -
# vgversion -V 2.1 -r /dev/vg02
Volume
Group version can be successfully changed to 2.1
Review
complete. Volume group not modified.
# vgversion -V 2.1 /dev/vg02
vgversion:
The volume group "/dev/vg02" is active on this system.
Can
not perform the requested change.
- Above error comes due to volume group is active. So we have to deactivate first it by using below command: -
# vgchange -a n /dev/vg02
Volume
group "/dev/vg02" has been successfully changed.
# vgversion -V 2.1 /dev/vg02
Performing
"vgchange -a y -l -p -s /dev/vg02" to collect data
Activated
volume group.
Volume
group "/dev/vg02" has been successfully activated.
Old
Volume Group configuration for "/dev/vg02" has been saved in
"/etc/lvmconf/vgversion_vg02/vg02_1.0.conf"
Deactivating
Volume Group "/dev/vg02"
Volume
group "/dev/vg02" has been successfully deactivated.
New
Volume Group configuration for "/dev/vg02" has been saved in
"/etc/lvmconf/vgversion_vg02/vg02_2.1.conf"
Removing
the Volume Group /dev/vg02 from /etc/lvmtab
Applying
the configuration to all Physical Volumes from
"/etc/lvmconf/vgversion_vg02/vg02_2.1.conf"
Volume
Group configuration has been restored to /dev/rdisk/disk8
Creating
the Volume Group of version 2.1 with minor number 0x2000.
Adding
the Volume Group /dev/vg02 to /etc/lvmtab_p
Original
Volume Group Version was 1.0
New
Volume Group Version is 2.1
Volume
Group version has been successfully changed to 2.1
Volume
Group configuration for /dev/vg02 has been saved in /etc/lvmconf/vg02.conf
#
- After that activate the volume group: -
# vgchange -a y /dev/vg02
Activated
volume group.
Volume
group "/dev/vg02" has been successfully changed.
- Now volume group version successfully changed. You can check: -
#
vgdisplay -v /dev/vg02
---
Volume groups ---
VG
Name /dev/vg02
VG
Write Access read/write
VG
Status available
Max
LV 2047
Cur
LV 0
Open
LV 0
Max
PV 2048
Cur
PV 1
Act
PV 1
Max
PE per PV 409584
VGDA 2
PE
Size (Mbytes) 32
Total
PE 25599
Alloc
PE 0
Free
PE 25599
Total
PVG 0
Total
Spare PVs 0
Total
Spare PVs in use 0
VG Version 2.1
VG
Max Size 13106688m
VG
Max Extents 409584
--- Physical volumes ---
PV Name /dev/disk/disk8
PV Status available
Total PE 25599
Free PE 25599
Autoswitch On
Proactive Polling On
#
Volume
group version has been updated successfully from 1.0 to 2.1.
6.
Now create a logical volume: -
# lvcreate -l 4000 -n personal
/dev/vg02
Logical
volume "/dev/vg02/personal" has been successfully created with
character
device "/dev/vg02/rpersonal".
Logical
volume "/dev/vg02/personal" has been successfully extended.
Volume
Group configuration for /dev/vg02 has been saved in /etc/lvmconf/vg02.conf
#
7.
Now format the created disk: -
#newfs –F vxfs –o largefiles
/dev/vg02/rpersonal/
Successfully
created
8.After
that create a directory for mount: -
#mkdir /text
#mount –F vxfs /dev/vg02/personal/
/test
9.Now
make and entry in /etc/fstab for mount automatic after reboot: -
/dev/vg02/personal
/Text vxfs defaults 0 2
/etc/fstab
contains 6 parameters per row. Each row represents one file system details.
They are as below:
1.
Volume /dev/vg02/personal
2.
Mount point /test
3.
File system type vxfs
4.
Options defaults
5.
Dump 1,0 (for backup dump in
failure)
6.
Pass 0,1,2 (for fsck sequence
top or bottom)
No comments:
Post a Comment