当前位置:网站首页>LVM logical volume
LVM logical volume
2022-07-28 20:32:00 【Operation and maintenance log of Panax notoginseng】
Logic volume
It is a logical collection of one or more hard disk partitions , It's equivalent to a big hard disk to use . When the hard disk is not enough , You can continue to add new hard disk partitions . You can flexibly use disk partitions
advantage
- Capacity can be increased and reduced at any time
- Multiple hard disks are more cost-effective
technological process
First convert the hard disk into a physical volume pv
Make a volume group vg( The space of the two hard disks is merged and reorganized by pe As a basic component ( Every pe4M perhaps 4 Multiple ))
Logic volume lv Divide ( Repartition )pe Integer multiple Increase in excess pe No reduction
command

Format
pvcreate
pvcreate /dev/sdb1 /dev/sdb2
Volume group path
/dev/ Volume group name
Logical volume path
/dev/ Volume group name / Logical volume name
perform
Ready to have sdb1-6 There are eleven partitions , among 4 Partition No. is an extended partition and is not available
Look at the partition format
[[email protected] ~]# fdisk -l | grep sdb
disk /dev/sdb:10.7 GB, 10737418240 byte ,20971520 Sectors
/dev/sdb1 2048 2099199 1048576 fb VMware VMFS
/dev/sdb2 2099200 4196351 1048576 fb VMware VMFS
/dev/sdb3 4196352 6293503 1048576 fb VMware VMFS
/dev/sdb4 6293504 20971519 7339008 5 Extended
/dev/sdb5 6295552 8392703 1048576 fb VMware VMFS
/dev/sdb6 8394752 10491903 1048576 fb VMware VMFS
Use fidsk, adopt t The command changes all partition types to 8e(Linux lvm)
fdisk /dev/sdb
Welcome to use fdisk (util-linux 2.23.2).
Changes will stay in memory , Until you decide to write changes to disk .
Think twice before using the write command .
command ( Input m get help ):t
Zone number (1-11, Default 11):1
Hex Code ( Input L List all codes ):8e
Partition already “VMware VMFS” The type of is changed to “Linux LVM”
command ( Input m get help ):w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Synchronizing disk .
Make physical volumes
[[email protected] ~]# pvcreate /dev/sdb1 /dev/sdb2 /dev/sdb3 /dev/sdb5 /dev/sdb6
Physical volume "/dev/sdb1" successfully created.
Physical volume "/dev/sdb2" successfully created.
Physical volume "/dev/sdb3" successfully created.
Physical volume "/dev/sdb5" successfully created.
Physical volume "/dev/sdb6" successfully created.
View physical volumes
[[email protected] ~]# pvscan
PV /dev/sda2 VG centos lvm2 [<19.00 GiB / 0 free]
PV /dev/sdb3 lvm2 [1.00 GiB]
PV /dev/sdb2 lvm2 [1.00 GiB]
PV /dev/sdb1 lvm2 [1.00 GiB]
PV /dev/sdb5 lvm2 [1.00 GiB]
PV /dev/sdb6 lvm2 [1.00 GiB]
Total: 6 [<24.00 GiB] / in use: 1 [<19.00 GiB] / in no VG: 5 [5.00 GiB]
Delete physical volume
pvremove /dev/sdb1
Labels on physical volume "/dev/sdb1" successfully wiped
Make volume group
vgcreate Volume group name Disk character Disk character
vgcreate vg1 /dev/sdb1 /dev/sdb2 /dev/sdb3 /dev/sdb5 /dev/sdb6
Volume group "vg1" successfully created
View volume groups
vgscan
vgdisplay
Remove the volume group
vgremove Volume group name
vgremove vg1
Volume group capacity increase , The partition to be added must first be made into a physical volume
vgextend Volume group name Partition to add
vgextend jz1 /dev/sdb3
Volume group "jz1" successfully extended
Volume group shrink
vgreduce Volume group name Partitions to be reduced
vgreduce jz1 /dev/sdb3
Removed "/dev/sdb3" from volume group "jz1"
Logical volume management :
Partition logic volume -L pe Capacity size of -l pe The number of
lvcreate -L Capacity size (4M) -n Logical volume name Volume group name
lvcreate -L 200M -n lv1 jz1
lvcreate -l 20 -n lv2 jz1
Increase and decrease capacity , Plus sign capacity increase The minus sign shrinks the volume
lvextend -L + size (+10M) /dev/ Volume group name / Logical volume name
-l +pe Number
lvextend -L +100M /dev/jz1/lv1
lvextend -l -10 /dev/mapper/jz1/lv1
( Increased capacity and pe The number of cannot exceed the number of volume groups )
Format logical volume
xfs File system types can only be resized, not resized
xfs Format does not format data , Formatting is not allowed when mounted
mkfs -t xfs Path drive letter
mkfs -t xfs /dev/jz1/lv1
meta-data=/dev/jz1/lv1 isize=512 agcount=4, agsize=21760 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=87040, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=855, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
View the logical volume
blkid /dev/jz1/lv1
/dev/jz1/lv1: UUID="0ab5594e-1c7f-4314-af82-6af068c4b212" TYPE="xfs"
mount
mount /dev/jz1/lv1 /mnt/lv1
Or use the configuration file to permanently mount
blkid /dev/jz1/lv1
/dev/jz1/lv1: UUID=“0ab5594e-1c7f-4314-af82-6af068c4b212” TYPE=“xfs”
mount
mount /dev/jz1/lv1 /mnt/lv1
Or use the configuration file to permanently mount
边栏推荐
- C language - pointer
- [POC - proof of concept]
- Item exception handling in SSM
- What is the variance?
- Raspberry pie 4B deploy yolov5 Lite using ncnn
- Multi-Modal Knowledge Graph Construction and Application: A Survey
- Linux Installation MySQL (pit filling version)
- [C language] 5000 word super detailed explanation of various operations of the sequence table
- [C language] use function pointers to make a different calculator
- Use of DDR3 (axi4) in Xilinx vivado (3) module packaging
猜你喜欢

Torch. NN. Linear() function

83. (cesium home) how the cesium example works

Windows系统下Mysql数据库定时备份

Product manager interview | innovation and background of the fifth generation verification code
![[task02: SQL basic query and sorting]](/img/10/c2a936c882cd77f422396840282ed5.png)
[task02: SQL basic query and sorting]
![[task01: getting familiar with database and SQL]](/img/de/c1370461d8c2561c4dfd0ff5c7e830.png)
[task01: getting familiar with database and SQL]

Who cares about the safety of the battery when it ignites in a collision? SAIC GM has something to say

【实验分享】CCIE—BGP反射器实验

为什么客户支持对SaaS公司很重要?

Scheduled backup of MySQL database under Windows system
随机推荐
太空射击第15课: 道具
太空射击第16课: 道具(Part 2)
Soft raid
About IP address
超大模型工程化实践打磨,百度智能云发布云原生AI 2.0方案
Power Bi 2021 calendar DAX code
通配符 SSL/TLS 证书
Raspberrypico analytic PWM
[experiment sharing] CCIE BGP reflector experiment
上海交大牵手淘宝成立媒体计算实验室:推动视频超分等关键技术发展
Raspberry pie 3b ffmpeg RTMP streaming
[task02: SQL basic query and sorting]
Pop up modal box
Solve the cookie splitting problem (DP)
长轮询,iframe和sse三种web消息实时推送demo实践
Solve the brick stacking problem (DP)
Raspberry connects EC20 for PPP dialing
How can Plato obtain premium income through elephant swap in a bear market?
Item exception handling in SSM
Residual network RESNET source code analysis - pytoch version