In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you how to use lvm to manage disk volumes. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
I. disk partition
1. Directly use fdisk-l to view the disk overview, and then use fdisk for traditional partitioning (disk sda-- partition sda1).
Fdisk
N create Partition
P main partition
W write
2. Partition by lvm logical volume (disk sda-- partition sda1 or md-- lv).
Pv= physical volumes = physical Partition
Vg= volume group
Lv= logical Volume
First, you need to convert the physical disk (physical partition) to pv, and then the new vg,vg on pv can be expanded across PV. For example, pv (sdb) can be expanded to vg (sda), and the new lv,LV on vg cannot be expanded across VG. LV can only expand in its own VG.
Lsblk-f check how many hard drives
Pvdisplay
Vgdisplay
Lvdisplay
# pvcreate / dev/sdb1 / dev/sdb2 / dev/sdb3 create pv (or # pvcreate / dev/sdb)
# pvcreate / dev/sda2-ff forcibly creates pv. Sometimes the centos system that automatically installs lvm will format sda2 into lvm format, and it is impossible to reformat sda2 into pv without adding-ff
# vgcreate vg1 / dev/sdb [1-3] create vg
# lvcreate-n lv1-L 1.5G vg1 create lv
Format Partition
# mkfs.xfs / dev/vg1/lv1
# pvs to view pv information
# vgs to view vg information
# lvs to view lv information
Internal expansion of vg and lv in this pv
# lvextend-L + 300m / dev/vg1/lv1 expands the lv1 under vg1 by 300m
# resize2fs / dev/Vg1/LV1 rhel6 update command
# xfs_growfs / dev/mapper/LV1 rhel7 update life
Yum-y install parted-y
# partprobe / dev/sdb refresh partition table
Expand vg and lv across pv
# vgextend vg1 / dev/sdb: expand the remaining space under pv2 (sdb) to vg1
# lvextend-L + 300m / dev/vg1/lv1: expand the lv1 under vg1 by 300m
# resize2fs / dev/Vg1/LV1 rhel6 update command
# xfs_growfs / dev/mapper/LV1 rhel7 update life
# partprobe / dev/sdb refresh partition table
Shrink
# vgextend vg1 / dev/sdb5
# lvreduce-L 1G / dev/vg1/lv1 # lv1 shrinks to 1G of space, which cannot be reduced if vga1 is in use
# vgreduce vg1 / dev/sdb1 # vg1 Delete sdb1, which cannot be deleted if sdb1 is in use
Delete
# umount / dev/vg1/lv1
# lvremove lv1 / dev/vg1
# vgremove / dev/vg1
# pvremove / dev/sdb [1-5]
Snapshot creation and restore
# lvcreate-s-n lv1_sp-L 1.5G / dev/vg1/lv1
# umount / dev/vg1/lv1
# mount / dev/vg1/lv1_sp / lv1
The above is how to use lvm to manage disk volumes. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.