One 、 Problems with traditional disk management
When the partition size is not enough, its size cannot be expanded , Only by adding disks 、 Create new partitions to expand space , But the newly added hard disk exists as a separate file system , The original file system has not been expanded , The upper application can only access one file system many times . Only existing disks can be taken offline , After replacing with a new disk , Then import the original data into .
Two 、LVM The basic concept of logical volume
LVM(Logical volume Manager) Logical volume management encapsulates the underlying physical hard disk abstractly , In the form of logical volume, it is presented to the upper system , The size of the logical volume can be adjusted dynamically , And there's no loss of existing data . The newly added hard disk will not change the existing upper level logical volume .
As a dynamic disk management mechanism , Logical volume technology greatly improves the flexibility of disk management .
PE(physical extend) The default is 4MB The basic block of
PV(physical volume) Hard disk or partition
VG(volume group) By one or more PV The whole of composition
LV(logical volume) from VG The space cut out in is used to create a file system
3、 ... and 、LVM The creation process
- The physical disk is formatted as PV, Space is divided into one by one PE
- It doesn't work PV Join the same VG, Different PV Of PE All in VG Of PE In the pool
- LV be based on PE establish , The size is PE Integer multiple , form LV Of PE Probably from different physical disks
- LV Now you can directly format it and mount it
- LV The expansion and reduction of is actually to increase or decrease the composition of the LV Of PE The number of . The process does not lose the original data
Four 、 establish LVM
Initialize the physical disk device as a physical volume
pvcreate /dev/sdb /dev/sdc
Create a volume group , And will PV Join the volume group
vgcreate vg0 /dev/sdb /dev/sdc
Create logical volumes based on volume groups
lvcreate -n lv0 -L 5G vg0
Create a file system for the created logical volume
mkfs.ext4 /dev/vg0/lv0
Mount and use the formatted logical volume
mount /dev/vg0/lv0 /mnt/
Write the mount information to /etc/fstab Medium restart still works
echo "/dev/vg0/lv0 /mnt ext4 defaults 0 0 " >> /etc/fstab
5、 ... and 、 see LVM
View physical volume information :pvs、pvdisplay( detailed )
View volume group information :vgs、vgdisplay( detailed )
View logical volume information :lvs、lvdisplay( detailed )
6、 ... and 、 Delete LVM
Delete LV:lvremove /dev/vg0/lv0
Delete VG:vgremove vg0
Delete PV:pvremove /dev/sdb
7、 ... and 、 Stretch a logical volume
The stretch operation of the logical volume can be performed online , No need to unmount logical volumes
Guarantee VG There is enough free space in
vgs、vgdisplay
Expand logical volume
lvextend -L +5G /dev/vg0/lv0
After viewing the expansion LV size
lvs、lvdisplay
Update the file system
resize2fs /dev/vg0/lv0
View the updated file system
df –h
8、 ... and 、 Stretch a roll group
Will be added to VG The hard disk of is formatted as PV
pvcreate /dev/sdd
New PV Add to specified volume group
vgextend vg0 /dev/sdd
After viewing the expansion VG size
vgs、vgdisplay
Nine 、 Shrink a logical volume
The shrink operation of the logical volume must be performed offline , To unmount a logical volume
Unmount logical volumes that have already been mounted
umount /dev/vg0/lv0
Shrink the file system ( primary lv0 by 10G)
e2fsck -f /dev/vg0/lv0
resize2fs /dev/vg0/lv0 3G
narrow LV
lvreduce -L -7G /dev/vg0/lv0
Look at the reduced LV
lvs、lvdisplay
mount
mount /dev/vg0/lv0 /mnt
Ten 、 Reduce the volume group
Will a PV Remove... From the specified group
vgreduce vg0 /dev/sdd
View the reduced volume group size
vgs、vgdisplay
remove PV
pvremove /dev/sdd
LVM Basic concepts 、 More articles on Management
- LVM Basic concept and working principle
LVM Basic concept and working principle Background knowledge : Always confused about LVM, I've been looking for information , Finally right LVM Have a deep understanding of the concept and working principle of . Next, record . New technology must come out to change the existing shortcomings , therefore LVM The emergence of the magnetic field is due to the influence of the existing magnetic field ...
- 18 LVM Logical volume management
According to the previous section , We know md This kernel module can be used to do soft RAID Management of . meanwhile RAID Realized two functions :1. Improve the read and write ability of disk :2. Redundant backup of data : however , If the data is manually deleted by the Administrator , You can't find ...
- centos Next LVM Configuration and management
centos Next LVM Configuration and management LVM It's logical volume management (Logical Volume Manager) For short , It is Linux It is a mechanism to manage disk partition in environment ,LVM It's a logical layer built on hard disks and partitions , ...
- Linux: Use LVM Do disk management
LVM The concept of LVM It can realize the dynamic management of disk , Dynamically adjust the size of the file system without re partitioning the disk Small , utilize LVM Managed file systems can span disks . "/boot" Partition is used to store system boot files ...
- 【 Reprint 】Linux Disk management :LVM Logical volume management
Linux learning CentOS( twenty-five )--Linux Disk management :LVM Basic concepts of logical volume and LVM How it works This essay will explain in detail Linux In disk management mechanism LVM The basic concept of logical volume and LVM How it works !!! One . ...
- linux LVM Logical volume management
What is? LVM LVM It's logical volume management (Logical Volume Manager) For short , It's an abstraction layer built on top of physical storage devices , Allows you to generate logical storage volumes , Compared with using physical storage directly in Management , Provides better flexibility . ...
- linux Storage management (RALD) LVM Logical volume management Virtual array
Disk storage management LVM Logic volume Virtual array 1.Linux In the system Disk usage There is 3 A big question : 1. flexibility 2. Security 3. performance 2. terms of settlement RAID Redundant array of independent disks RAID(Redundant Arra ...
- LVM Logical volume management
One .LVM brief introduction LVM(Logic Volume Manager) Logical volume management , A simple understanding is to logically assemble the partitions of one or more hard disks , When a large hard disk is used . Its characteristics are : 1. Can achieve online dynamic expansion , It can also be reduced 2 ...
- Linux LVM Volume group management
Linux LVM Volume group management Because the traditional disk management can't manage the disk , So it was born LVM technology ,LVM The biggest feature of technology is the dynamic management of disk . because LVM The size of logical volume can be adjusted dynamically , And there will be no lost numbers ...
- LVM Logical volume management test —— Logical volume expansion 、 shrinkage 、 Snapshot and delete
One . Logical volume expansion [[email protected] /]# umount /testLVM/ [[email protected] /]# df -h Filesystem Size Used Avail Use% M ...
Random recommendation
- [deviceone Development ]- A simple example of a shopping cart
One . brief introduction It's mainly a demonstration listview Where ui And template cell Where ui The interaction between data , Click on a line , You can add and subtract quantities , Automatically display all selected car prices at the bottom . Two . design sketch 3、 ... and . The sample address : http://sou ...
- abap--How to debug backgroud job
Recently, a friend asked me how to debug the background process ( One abap The interview questions ), I don't know how to answer at the moment , He later told me to sdn Find out the answer , Now I will collect the answers for your reference :Steps 1. Create variant called ...
- NSJSONSerialization
/* summary : json Format reading and writing : analysis : data = NSData dataWithContentsOfUrl:XXX id obj = [ NSJsonSerializat ...
- In depth understanding of java Garbage collection mechanism
In depth understanding of java Garbage collection mechanism ---- One . The significance of garbage collection mechanism Java A remarkable feature of language is the introduction of garbage collection mechanism , send c++ The biggest memory management problem for programmers is solved , It makes the Java Programmers don't write programs anymore ...
- dev c++ Some of the shortcuts
Ctrl+N New source code Ctrl+O Open a project or source file Ctrl+S preservation Ctrl+Alt+S Save as Ctrl+W close Ctrl+P Print Ctrl+Z reply Ctrl+Y redo Ctrl+Q Switch head / Source file Ctrl+. notes C ...
- linux shell Parameter passing
stay shell When programming . You can use parameters .Shell There are position parameters and internal parameters 1. Positional arguments The parameters provided by the system are called position parameters . The value of the positional parameter can be used $N obtain ,N It's a number , If 1, namely $1. similar C Arrays in languages ,Linu ...
- MVC Small series ( 6、 ... and )【 No refresh captcha 】
Do a no refresh captcha function : First step : First , Create a type to generate captcha in the public project ValidateCode /// <summary> /// Generate captcha object /// </summar ...
- Suppose my friends' accounts are v{1,2,3,4,5}, And these five people want to share a directory , So you should join the same group , Let's say this group is vbird, And the passwords of these five accounts are password. How to set up these five accounts ?
Suppose my friends' accounts are v{1,2,3,4,5}, And these five people want to share a directory , So you should join the same group , Let's say this group is vbird, And the passwords of these five accounts are password. How to set up these five accounts ?#!/bin ...
- Luogu P3927 Factorial
Title Description SOL Jun likes factorial very much . and SOL Bacteria like to study . This day ,SOL Jun heel SOL It's amazing , I figured out n The factorial . SOL I'm not satisfied , We need to calculate this number immediately k Decimal means the end of the next 0 The number of . however SOL The mushroom is too delicious, so please ...
- css+js Adjust the background volume of the current interface
Show the effect html Code : <div> <audio id="audio" controls src="https://dbl.5518pay.com/r ...