Retrieve 10 Gb of volume group (VG) from/dev/sdc and/dev/sdd disks, and then extract 15 GB of logical volume (LV) from the VG ). The process of creating a logical volume is to create PV & mdash; Create VG & mdash; Create LV & mdash; mount. Delete as unmount & mdash; Delete lv & mdash; Delete VG & mdash; Delete PV. Partition two disks. T command to change the partition type to 8e. Use l to view the ID of the system partition type. Save and exit before updating the partition table. [Root @ loca
Retrieve 10 Gb of volume group (VG) from/dev/sdc and/dev/sdd disks, and then extract 15 GB of logical volume (LV) from the VG ). When creating a logical volume, create PV-create VG-create LV-mount. Delete as unmount-delete lv-delete VG-delete PV.
Partition two disks. T command to change the partition type to 8e. Use l to view the ID of the system partition type. Save and exit before updating the partition table.
[Root @ localhostaudisp] # fdisk/dev/sdc
[Root @ localhostaudisp] # fdisk/dev/sdd
Command (m for help): n
Commandaction
E extended
P primary partition (1-4)
P
Partitionnumber (1-4): 1
Firstcylinder (1-2610, default 1 ):
Usingdefault value 1
Lastcylinder or + size or + sizeM or + sizeK (1-2610, default 2610): + 10G
Command (m for help): p
Disk/dev/sdc: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Device Boot Start End Blocks Id System
/Dev/sdc1 1 1217 9775521 83 Linux
Command (m for help): t
Selectedpartition 1
Hex code (type L to list codes): 8e
Changedsystem type of partition 1 to 8e (Linux LVM)
Command (m for help): w
[Root @ localhostaudisp] # partprobe
Create PV
[Root @ localhostaudisp] # pvcreate/dev/sdc1
Writing physical volume data todisk "/dev/sdc1"
Physical volume "/dev/sdc1" successfully created
[Root @ localhostaudisp] # pvcreate/dev/sdd1
Writing physical volume data to disk "/dev/sdd1"
Physical volume "/dev/sdd1" successfully created
Create a VG. You can specify the PE size during VG creation. The option is-s.
[Root @ localhostaudisp] # vgcreate vg-data/dev/sdc1/dev/sdd1
Volume group "vg-data" successfullycreated
Create an LV. You can also select the capacity based on the number of PES to create the LV. The option is-l.
[Root @ localhostaudisp] # lvcreate-L 15G-n lv-data/dev/vg-data
Logical volume "lv-data" created
View LV.
[Root @ localhostaudisp] # lvdisplay
--- Logical volume ---
LV Name/dev/vg-data/lv-data
VG Name vg-data
Lvuuid rSCcPQ-3b29-TiQC-14cG-PA3o-8xac-Dg3Rvf
LV Write Access read/write
LV Status available
# Open 0
LVSize 15.00 GB
Current LE 3840
Segments 2
Allocation inherit
Read ahead sectors auto
-Currently sets to 256
Block device 253: 0
Format the logical volume and mount it to the/home directory. Df-h to view disk information.
[Root @ localhostaudisp] # mkfs. ext3/dev/vg-data/lv-data
[Root @ localhostaudisp] # mount/dev/vg-data/lv-data/home/
[Root @ localhostaudisp] # df-h
File System capacity used available % mount point
/Dev/sda3 95G 2.5G 88G 3%/
/Dev/sda2 95G 582 M 90G 1%/data
/Dev/sda1 99 M 12 M 82 M 13%/boot
Tmpfs 500 M 0 500 M 0%/dev/shm
/Dev/sdb1 20G 173 M 19G 1%/mytest/abc
/Dev/mapper/vg -- data-lv -- data
15G 166 M 14G 2%/home
Logical volumes can be expanded online without affecting your use.
If the VG space is insufficient, expand the VG first.
[Root @ localhostaudisp] # vgextend vg-data/dev/sda6
No physical volume label read from/dev/sda6
Writing physical volume data to disk "/dev/sda6"
Physical volume "/dev/sda6" successfully created
Volume group "vg-data" successfullyextended
LV extension as needed
[Root @ localhostaudisp] # lvextend-L + 50G/dev/vg-data/lv-data
Extending logical volume lv-data to 65.00 GB
Logical volume lv-data successfully resized
Update the LV File System
[Root @ localhostaudisp] # resize2fs/dev/vg-data/lv-data
[Root @ localhostaudisp] # df-h
File System capacity used available % mount point
/Dev/sda3 95G 2.5G 88G 3%/
/Dev/sda2 95G 582 M 90G 1%/data
/Dev/sda1 99 M 12 M 82 M 13%/boot
Tmpfs 500 M 0 500 M 0%/dev/shm
/Dev/sdb1 20G 173 M 19G 1%/mytest/abc
/Dev/mapper/vg -- data-lv -- data
64G 177 M 61G 1%/home
Related reading:
Http://www.linuxidc.com/Linux/2013-09/90382.htm for mysqldump and LVM logical volume Snapshot
LVM Introduction and implementation of http://www.linuxidc.com/Linux/2013-03/81482.htm
For more information about RedHat, see RedHat topic page http://www.linuxidc.com/topicnews.aspx? Tid = 10