当前位置:网站首页>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
边栏推荐
- Raspberry pie CM4 -- using metartc3.0 to integrate ffmpeg to realize webrtc push-pull streaming
- Usage Summary of thymeleaf
- Array out of bounds
- MySQL startup error 1607 unexpected process termination
- Solve the kangaroo crossing problem (DP)
- Scheduled backup of MySQL database under Windows system
- The product power is greatly improved, and the new Ford Explorer is released
- Use of DDR3 (axi4) in Xilinx vivado (5) board test
- Linxu 【基本指令】
- WUST-CTF2021-re校赛wp
猜你喜欢
![[fasttext -- Summary notes]](/img/4d/2871b2525bf0ea75ee958338b18013.png)
[fasttext -- Summary notes]

Usage Summary of thymeleaf

Extract China map from global.Nc data and calculate regional CO2 value based on acgis

Torch. NN. Linear() function

Durham High Lord (classic DP)

Use of DDR3 (axi4) in Xilinx vivado (2) read write design

Data mining (data preprocessing) -- Notes

Zfoo adds routes similar to mydog

Linux Installation MySQL (pit filling version)

Pop up modal box
随机推荐
Clock distribution of jesd204 IP core (ultrascale Series)
树行表达方式
Common instructions of vim software
Multi-Modal Knowledge Graph Construction and Application: A Survey
LVS deployment Dr cluster
Simple use of robobrowser
The product power is greatly improved, and the new Ford Explorer is released
Common commands of raspberry pie
Use of DDR3 (axi4) in Xilinx vivado (4) incentive design
[experiment sharing] CCIE BGP reflector experiment
[detailed use of doccano data annotation]
【CodeForces】Educational Codeforces Round 132 (Rated for Div. 2)
Who cares about the safety of the battery when it ignites in a collision? SAIC GM has something to say
Scheduled backup of MySQL database under Windows system
数据挖掘(数据预处理篇)--笔记
Solve the kangaroo crossing problem (DP)
GRU神经网络
C language - data storage
flask_ Mail source code error
Representation of base and number 2