How to increase disk space through LVM (repost)

Source: Internet
Author: User

Add a hard disk/dev/SDC
1. fdisk/dev/SDC

A toggle a bootable flag
B edit BSD disklabel
C toggle the DOS compatibility flag
D delete a partition
L List known partition types
M print this menu
N Add a new partition
O create a new empty DOS partition table
P print the Partition Table
Q quit without saving changes
S create a new empty sun disklabel
T change a partition's System ID
U change display/entry units
V verify the Partition Table
W write table to disk and exit
X extra functionality (experts only)
Select N-> T (select 8e as the type, that is, LVM format)-> W to complete the process. At this time,/dev/has one more/dev/sdc1;
Then run the sudo/sbin/partprobe-s command to notify the OS disk partition changes;

2. sudo/usr/sbin/pvcreate/dev/sdc1
Create a volume
3. sudo/usr/sbin/vgextend volgroup00/dev/sdc1
Drag the newly added hard disk to the volume group volgroup00
Sudo/usr/sbin/pvdisplay

--- Physical volume ---
PV name/dev/sda2
VG name volgroup00
PV size 9.90 GB/not usable 22.76 MB
Allocatable Yes (but full)
PE size (Kbytes) 32768
Total PE 316
Free pe 0
Allocated PE 316.
Pvuuid Kwxkl4-7LoP-Fn5g-AmxS-OCl7-KdYw-kp1FpN

--- Physical volume ---
PV name/dev/sdc1
VG name volgroup00
PV size 2.00 GB/not usable 31.32 MB
Allocatable Yes
PE size (Kbytes) 32768
Total PE 63
Free PE 31
Allocated PE 32
Pv uuid 3qq4425s11j-mxg4-qhky-cpwm-3sg9-52xzh1

4. Allocate space for the specified volume:
(Increase space) sudo/usr/sbin/lvextend-L + 500 m/dev/volgroup00/logvol00

(Space reduction) sudo/usr/sbin/lvreduce-L-500 m/dev/volgroup00/logvol00
[Wubingjie @ wubingjie ~] $ Sudo/usr/sbin/lvdisplay
--- Logical volume ---
LV name/dev/volgroup00/logvol00
VG name volgroup00
Lvuuid u8PCqg-6Gdz-GuHc-OkR7-UUgV-YhVn-Ag8MCx
LV write access read/write
LV status available
# Open 1
LV size 9.88 GB
Current le 316
Segments 2
Allocation inherit
Read ahead sectors 0
Block device 253: 0

--- Logical volume ---
LV name/dev/volgroup00/logvol01
VG name volgroup00
Lvuuid q2Oug1-vH8n-3d5c-mcFx-6o5V-RTbH-0YMUr1
LV write access read/write
LV status available
# Open 1
LV size 1.00 GB
Current le 32
Segments 1
Allocation inherit
Read ahead sectors 0
Blocks device 253: 1

5. Run the sudo/sbin/resize2fs/dev/volgroup00/logvol00 command.
Make the space adjustment take effect

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.