How to create logical volumes and increase logical volumes under Linux

Source: Internet
Author: User

The first step is to partition the hard disk
Fdisk/dev/sdb

The second step is to modify the hard drive ID number to 8e ID default to 83
Fdisk/dev/sdb
Press T to enter
Enter partition Table number
Input 8e

Step three Create the PV physical volume
Pvcreate/dev/sdb1

View PV Pvdisplay

Fourth Step create VG Volume group
Vgcreate the name of the volume group/DEV/SDB1

View VG Volume Group Vgdisplay

Fifth Step Expansion Volume group
First, the partition is made into PV pvcreate/dev/sdb2
Vgextend the name of the volume group/DEV/SDB2

Sixth step to create a logical volume
Lvcreate-l 100m-n first_lv FIRST_VG
-l Specifies the size of the logical volume
-N is the name of the specified logical volume

viewing logical volumes
Lvdisplay

The seventh step is to create a file system for the logical volume
Mkfs.ext3/dev/frist_vg/frist_lv

Eighth Step Mount Logical Volume
Mkdir/test Creating mount Points
Mount/dev/frist_vg/frist_lv/test

Nineth Step View Mount
Df-h

The tenth step will mount the write self-boot (two ways all Can)
echo "/dev/first_vg/first_lv/test ext3 defaults 0 0" >>/etc/fstab

echo "/dev/mapper/first_vg-first_lv/test ext3 defaults 0 0" >>/etc/fstab



How do I increase the size of a logical volume?

The first step is to partition the newly added hard disk and modify the partition ID number, please refer to the second step above.

The second step creates the newly created partition as a physical volume (PV)
Pvcreate/dev/sdd1

Third Step Expansion Volume group
Vgextend FIRST_VG/DEV/SDD1

Step fourth Unmount the mounted logical volumes
Umount/dev/mapper/first_vg-first_lv

Fifth step increase the size of the logical volume (LV)
Lvresize-l +257/DEV/FIRST_VG/FIRST_LV
+257 can be written as new disk capacity as +1G specific view can be viewed through vgdisplay see free pe/size 257/1.00 GiB

Sixth step, check the partition first with e2fsck.
E2fsck-f/DEV/FIRST_VG/FIRST_LV

Seventh step to increase file system capacity
Resize2fs/dev/first_vg/first_lv

The eighth step is to re-mount the logical volume and then view it through the df-h command to see that the volume of the logical volume becomes larger.


This article is from the "Dream Sail" blog, be sure to keep this source http://deeply.blog.51cto.com/4149057/1714851

How to create logical volumes and increase logical volumes under Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.