LVM Logical Volume Manager
LVM Overview
LVM
Is the Linux
operating system on a logical disk partition management mechanism, which is based on the hard disk and the partition, a file system under the logical layer, the lower shielding disk partition layout when a file system, it is possible in dynamic adjustment disk capacity while keeping unchanged the existing data, thereby enhancing the flexibility of disk management.
To create LVM partition management mechanism, first of all, ordinary partitions or entire hard drive to create a physical volume; then, the physical storage space scattered each physical volumes make up a logical whole, that is, the volume group; and finally, based on the volume group this whole , divided different data storage space, forming the logical volume. Logical Volume is the end-user can format and mount the storage unit to use.
1、PV(Physical Volume,物理卷)
Physical volume is LVM
the basic storage mechanism, generally corresponding to a normal hard disk or the entire partition. When creating a physical volume will be created in the head of a hard disk partition or reserved blocks, used for recording attributes of the LVM, and the storage space into a default size of 4MB
the basic unit (Physical Extent,PE)
, so as to constitute the physical volume.
Partition for conversion into ordinary physical volumes, it is recommended to use the fdisk
tool to partition type of ID
serial number changed 8e
. If the entire hard drive, all disk space can be divided into a primary partition and then adjust accordingly.
2、VG(Volume Group,卷组)
By one or more physical volumes as a whole, is called volume group can be dynamically added or removed physical volumes in the volume group, they can be composed of a plurality of physical volumes of different volume groups respectively, their own volume group name by the user definition.
3、LV(Logical Volume,逻辑卷)
Logical volume group is built on, and not directly related to the physical volume. For the logical volume, the volume of each group is a whole, this whole "cut out" a little space, as the basis for creating the user file system, this small space called logical volumes,
LVM administration commands
LVM
Management commands mainly include three 物理卷(PV)管理
categories: 卷组(VG)管理
, , 逻辑卷(LV)管理
, command corresponding to each program file pv
, vg
, lv
at the beginning.
Features | PV管理命令 |
VG管理命令 |
LV管理命令 |
---|---|---|---|
Scan(扫描) |
pvscan |
vgscan |
lvscan |
Create(建立) |
pvcreate |
vgcreate |
lvcreate |
Display(显示) |
pvdisplay |
vgdisplay |
lvdisplay |
Remove(移除) |
pvremove |
vgremove |
lvremove |
Extend(扩展) |
vgextend |
lvextend |
|
Reduce(减少) |
vgreduce |
lvreduce |
A description of each of the write command to use; First, we now add the VMware virtual machine every three hard drives 20G, and restart the Linux operating system, recognize the newly added hard drive; then, the newly added disk using the fdisk
command partition management (created because of the small hard disk, each partition on the hard disk only one partition), and modify the partition number is 8e
( Linux LVM
).
Physical Volume Management
-
pvcreate
commandFor converting the entire hard disk partition or physical volume.
[root@localhost dev]# pvcreate /dev/sd{b..d}1 //将分区sdb1、sdc1、sdd1转化为物理卷
Physical volume "/dev/sdb1" successfully created.
Physical volume "/dev/sdc1" successfully created.
Physical volume "/dev/sdd1" successfully created.
-
pvscan
commandFor all physical volume scanning system, and outputs the information.
[root@localhost ~]# pvscan
PV /dev/sdd1 lvm2 [<20.00 GiB]
PV /dev/sdb1 lvm2 [<20.00 GiB]
PV /dev/sdc1 lvm2 [<20.00 GiB]
Total: 3 [<60.00 GiB] / in use: 0 [0 ] / in no VG: 3 [<60.00 GiB]
-
pvdisplay
commandDetails for displaying physical volume, physical volume required to specify the command as a parameter, default displays information for all physical volumes.
[root@localhost ~]# pvdisplay /dev/sdb1
"/dev/sdb1" is a new physical volume of "<20.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb1
VG Name
PV Size <20.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID mnXUmC-NyMw-QaKv-Z6Ig-46wX-O8N1-i1gd5d
-
pvremove
commandFor physical volume is reduced to normal or disk partition, not a
LVM
system, physical volume to be removed can not bepvscan
identified.
[root@localhost ~]# pvremove /dev/sdb1
Labels on physical volume "/dev/sdb1" successfully wiped.
[root@localhost ~]# pvscan
PV /dev/sdd1 lvm2 [<20.00 GiB]
PV /dev/sdc1 lvm2 [<20.00 GiB]
Total: 2 [<40.00 GiB] / in use: 0 [0 ] / in no VG: 2 [<40.00 GiB]
Volume Group Management
-
vgcreate
commandMeans for creating one or more physical volumes to a volume group, a first command for setting a parameter name of the new volume group, followed by addition of required specified volume group to the physical volume as a parameter.
[root@localhost ~]# vgcreate siti /dev/sd{b..d}1 //将物理卷sdb1、sdc1、sdd1转创建为卷组
Volume group "siti" successfully created
-
vgscan
commandFor scanning system established
LVM
Volume Group and related information.
[root@localhost ~]# vgscan
Reading volume groups from cache.
Found volume group "siti" using metadata type lvm2
-
vgdisplay
commandThe detailed information display system for each volume group, use of the specified volume group name as a command parameter (unspecified displays information about all volume groups volume group).
[root@localhost ~]# vgdisplay siti
--- Volume group ---
VG Name siti
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 3
Act PV 3
VG Size <59.99 GiB
PE Size 4.00 MiB
Total PE 15357
Alloc PE / Size 0 / 0
Free PE / Size 15357 / <59.99 GiB
VG UUID 30M0xz-z17t-iJE0-vSR8-cj0Y-tTXh-c2kO8E
-
vgremove
commandSo used to delete the specified volume group, the volume group name is specified as a parameter.
[root@localhost ~]# vgremove siti
Volume group "siti" successfully removed
[root@localhost ~]# vgscan
Reading volume groups from cache.
-
vgextend
commandDisk space to extend the volume group.
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name siti
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 1
...//...省略部分内容...
Free PE / Size 10238 / 39.99 GiB
VG UUID dhPgdF-TJmR-tT6H-u9AO-Oxn2-i2bX-PObnr3
[root@localhost ~]# vgextend siti /dev/sdb1 //添加sdb1物理卷
Physical volume "/dev/sdb1" successfully created.
Volume group "siti" successfully extended
[root@localhost ~]# vgdisplay siti
--- Volume group ---
VG Name siti
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 2
...//...省略部分内容...
Alloc PE / Size 0 / 0
Free PE / Size 15357 / <59.99 GiB
VG UUID dhPgdF-TJmR-tT6H-u9AO-Oxn2-i2bX-PObnr3
Logical Volume Management
-
lvcreate
commandFor dividing the space from the specified volume group.
lvcreate –L 容量大小 -n 逻辑卷名 卷组名
[root@localhost ~]# lvcreate -L 15G -n si siti
Logical volume "si" created.
-
lvscan
commandAnd related information for the logical volume scanning system has been established.
[root@localhost ~]# lvscan
ACTIVE '/dev/siti/si' [15.00 GiB] inherit
-
lvdisplay
commandDetails for displaying the logical volume, the logical volume device file can be specified as a parameter, the volume group name may be used as a parameter to display information for all the logical volumes in the volume group.
[root@localhost ~]# lvdisplay /dev/siti/si
--- Logical volume ---
LV Path /dev/siti/si
LV Name si
VG Name siti
LV UUID awrGhu-Mq8p-G7uZ-IZkE-mkv3-NezU-KflFbz
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2019-08-23 14:40:59 +0800
LV Status available
# open 0
LV Size 15.00 GiB
Current LE 3840
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
-
lvextend
commandMake space for the dynamic expansion of the logical volume, the logical volume when there is insufficient space currently in use, you can split the extra space to expand from where the volume group. Provided that the volume group still has not been allocated disk space, otherwise you need to expand the capacity of the volume group.
lvextend -L +大小 /dev/卷组名/逻辑卷名
[root@localhost ~]# lvextend -L +25G /dev/siti/si
Size of logical volume siti/si changed from 15.00 GiB (3840 extents) to 40.00 GiB (10240 extents).
Logical volume siti/si successfully resized.
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/siti/si
LV Name si
VG Name siti
LV UUID awrGhu-Mq8p-G7uZ-IZkE-mkv3-NezU-KflFbz
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2019-08-23 14:40:59 +0800
LV Status available
# open 0
LV Size 40.00 GiB
Current LE 10240
Segments 3
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
-
lvremove
commandTo delete the specified logical volume, the logical volume file directly using the device as a parameter.
[root@localhost ~]# lvremove /dev/siti/si
Do you really want to remove active logical volume siti/si? [y/n]: y
Logical volume "si" successfully removed
[root@localhost ~]# lvdisplay
[root@localhost ~]#
-
The disk created
lvm
after the disk we can create and mount the file system, so that we can properly use disk space.1、接上面的操作,从新创建逻辑卷si、ti分别设定25G、30G,并使用lvdispaly命令查看列表。
[root@localhost ~]# lvcreate -L 25G -n si siti
Logical volume "si" created.
[root@localhost ~]# lvcreate -L 30G -n ti siti
Logical volume "ti" created.
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/siti/si
LV Name si
VG Name siti
...//省略部分内容...
LV Size 25.00 GiB
...//省略部分内容...
Read ahead sectors auto
- currently set to 8192
Block device 253:0
--- Logical volume ---
LV Path /dev/siti/ti
LV Name ti
VG Name siti
...//省略部分内容...
LV Size 30.00 GiB
...//省略部分内容...
Read ahead sectors auto
- currently set to 8192
Block device 253:1
2、创建文件系统。
[root@localhost ~]# mkfs.xfs /dev/siti/si
meta-data=/dev/siti/si isize=512 agcount=4, agsize=1638400 blks
= sectsz=512 attr=2, projid32bit=1
...//省略部分内容...
realtime =none extsz=4096 blocks=0, rtextents=0
[root@localhost ~]# mkfs.xfs /dev/siti/ti
meta-data=/dev/siti/ti isize=512 agcount=4, agsize=1966080 blks
= sectsz=512 attr=2, projid32bit=1
...//省略部分内容...
realtime =none extsz=4096 blocks=0, rtextents=0
3、将si、ti进行挂载,这我们就可以正常使用磁盘空间了。(我这里做的是自动挂载)
[root@localhost ~]# mkdir /opt/siti{1..2} //创建siti1、siti2目录
[root@localhost ~]# ls /opt //查看是否创建成功
rh siti1 siti2
[root@localhost ~]# vim /etc/fstab //编辑配置文件
#
# /etc/fstab
# Created by anaconda on Fri Aug 9 11:45:58 2019
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=2e181f68-3027-48da-a779-ac380076d6f3 / xfs defaults 0 0
UUID=0de201d1-2be8-4457-a420-78547726c995 /boot xfs defaults 0 0
UUID=8ac2bc9f-2520-410e-9408-c462d1bd249f /home xfs defaults 0 0
UUID=22d52505-e702-48db-a1ed-f82cb4b1feca swap swap defaults 0 0
/dev/siti/si /opt/siti1 xfs defaults 0 0
/dev/siti/ti /opt/siti2 xfs defaults 0 0
~
:wq //保存退出
[root@localhost ~]# mount -a
[root@localhost ~]# df -hT
文件系统 类型 容量 已用 可用 已用% 挂载点
/dev/sda2 xfs 20G 4.3G 16G 22% /
devtmpfs devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs tmpfs 1.9G 9.0M 1.9G 1% /run
tmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda5 xfs 10G 50M 10G 1% /home
/dev/sda1 xfs 2.0G 174M 1.9G 9% /boot
tmpfs tmpfs 378M 12K 378M 1% /run/user/42
tmpfs tmpfs 378M 0 378M 0% /run/user/0
/dev/mapper/siti-si xfs 25G 33M 25G 1% /opt/siti1 //成功挂载
/dev/mapper/siti-ti xfs 30G 33M 30G 1% /opt/siti2
Disk quotas
To avoid the problem of insufficient disk space on the server, we can enable disk quota feature, the user specified file system (partition) manipulation
of disk space used, to limit the number of files to prevent malicious individual users or inadvertently take up a lot disk space, so as to maintain system stability and continuous availability of storage space.
In the CentOS
system, the kernel has been customized to support Linux
disk quota feature of the file system, and configure and manage disk quotas by the tool in the system xfsgrogs
package xfs_quota
provides quota management program.
First, let's see Linux
whether the system installation xfsgrogs
package, and see if there are quotas components in the package
[root@localhost ~]# rpm -q xfsprogs
xfsprogs-4.5.0-12.el7.x86_64
[root@localhost ~]# rpm -ql xfsprogs | grep "xfs_quota"
/usr/sbin/xfs_quota
/usr/share/man/man8/xfs_quota.8.gz
Then place the Linux operating system, enhanced security features turned off
[root@localhost ~]# setenforce 0
Disk quotas overview
1、磁盘配额作用范围
xfs_quota
Disk quota feature set is only valid for a specified file system (partition), you use other file systems are not set quotas, it will not be restricted.
2、磁盘配额的限制对象
xfs_quota
The main restrictions for systems specified user account, group account is not set user or group quotas will not be affected. After setting the quota for group accounts, disk capacity used by all users in the group, the total number of documents can not exceed the limit.
3.磁盘配额的限制类型
- Disk capacity: limiting the size of the user data block disk can be used, i.e. limiting disk space, default unit is KB.
- Number of files: limit the number of files a user can have.
4、磁盘配额的限制方法
- Soft limit: a soft quota specified value (e.g., 480MB of disk space, files 180), the grace period is fixed (default seven days) to allow the temporarily exceeding this limit, the system gives a warning message.
- Hard limit: a rigid quota specified value (such as 500MB of disk space, 200 files), is absolutely prohibited user exceeds the limit value, and when it reaches the hard limit value, the system will give a warning and prohibiting further write data. Hard limit quota value should be greater than the corresponding value of the soft limit, the soft limit would otherwise fail.
Disk quota management
1、以支持配额功能的方式挂载文件系统
In addition to the core and xfs_quota
outside support software, enforce disk quotas features include a precondition that the specified partition must already mounted disk quotas and support functions. In the configuration of the debugging process can be used with -o usrquota,grpquota
the options of mount
command to mount the specified partition, in order to increase support for user, group quota function.
- First of all, I am here first before mounting the two
lvm
uninstall (added to the configuration automatically mount entries should be deleted).
[root@localhost ~]# umount /dev/siti/si
[root@localhost ~]# umount /dev/siti/ti
[root@localhost ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda2 20G 4.3G 16G 22% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 9.0M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda5 10G 50M 10G 1% /home
/dev/sda1 2.0G 174M 1.9G 9% /boot
tmpfs 378M 12K 378M 1% /run/user/42
tmpfs 378M 0 378M 0% /run/user/0
- Then, way further support the quota function mount, I am here in two different ways to mount (mount automatically, manually mount).
[root@localhost ~]# mount -o usrquota,grpquota /dev/siti/si /opt/siti1 //手动挂载
[root@localhost ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda2 20G 4.3G 16G 22% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 9.0M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 2.0G 174M 1.9G 9% /boot
/dev/sda5 10G 50M 10G 1% /home
tmpfs 378M 12K 378M 1% /run/user/42
tmpfs 378M 0 378M 0% /run/user/0
/dev/mapper/siti-si 25G 33M 25G 1% /opt/siti1
[root@localhost ~]# vim /etc/fstab //进入编辑,设置自动挂载
#
# /etc/fstab
# Created by anaconda on Fri Aug 9 11:45:58 2019
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=2e181f68-3027-48da-a779-ac380076d6f3 / xfs defaults 0 0
UUID=0de201d1-2be8-4457-a420-78547726c995 /boot xfs defaults 0 0
UUID=8ac2bc9f-2520-410e-9408-c462d1bd249f /home xfs defaults 0 0
UUID=22d52505-e702-48db-a1ed-f82cb4b1feca swap swap defaults 0 0
/dev/siti/ti /opt/siti2 xfs defaults,usrquota,grpquota 0 0
~ :wq
[root@localhost ~]# mount -a
[root@localhost ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda2 20G 4.3G 16G 22% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 9.0M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 2.0G 174M 1.9G 9% /boot
/dev/sda5 10G 50M 10G 1% /home
tmpfs 378M 12K 378M 1% /run/user/42
tmpfs 378M 0 378M 0% /run/user/0
/dev/mapper/siti-si 25G 33M 25G 1% /opt/siti1
/dev/mapper/siti-ti 30G 33M 30G 1% /opt/siti2
2、编辑用户和组账号的配额设置
-
xfs_quota -x -c 'limit -u bsoft=N bhard=N isoft=N ihard=N 用户名' 挂载点
-
Common options
-x:启用专家模式
-c:使用命令执行
-u:指定用户
-g:指定组
-
Limit field
limit:可以设置磁盘容量的软、硬限制;及文件数的软、硬限制;-u表示指定用户(如果指定组使用-g)
bsoft:表示设置磁盘容量的软限制数值
bhard:表示设置磁盘容量的硬限制数值
isoft:表示设置磁盘文件数的软限制数值
ihard:表示设置磁盘文件数的硬限制数值
[root@localhost ~]# xfs_quota -x -c 'limit -u bsoft=100M bhard=150M isoft=100 ihard=150 sun' /opt/siti1
//设置用户sun的磁盘配额,磁盘容量软限制为100M,硬限制为150M;文件数软限制为100,硬限制为150
-
We can see the situation from the command user capacity limit
xfs_quota -c 'quota -uv 用户名' 挂载点
View user's disk limitor
xfs_quota -c 'quota -uv -i 用户名' 挂载点
View user limit the number of files
[root@localhost ~]# xfs_quota -c 'quota -uv -i sun' /opt/siti1
Disk quotas for User sun (1000)
Filesystem Files Quota Limit Warn/Time Mounted on
/dev/mapper/siti-si 0 100 150 00 [--------] /opt/siti1
[root@localhost ~]# xfs_quota -c 'quota -uv sun' /opt/siti1
Disk quotas for User sun (1000)
Filesystem Blocks Quota Limit Warn/Time Mounted on
/dev/mapper/siti-si 0 102400 153600 00 [--------] /opt/siti1
3、验证磁盘配额功能
- User account login Linux operating system subject to quotas, and switch to the application of the quota system file, such as copying a file write operations, disk quota entry test set is valid. Prior to first check whether the user set disk quotas to write files to disk by the authority.
root@localhost ~]# ls -l /opt
总用量 0
drwxr-xr-x. 2 root root 6 3月 26 2015 rh
drwxr-xr-x. 2 root root 6 8月 23 16:10 siti1
drwxr-xr-x. 2 root root 6 8月 23 16:11 siti2
[root@localhost ~]# chmod 777 /opt/siti1
[root@localhost ~]# ls -l /opt
总用量 0
drwxr-xr-x. 2 root root 6 3月 26 2015 rh
drwxrwxrwx. 2 root root 6 8月 23 16:10 siti1
drwxr-xr-x. 2 root root 6 8月 23 16:11 siti2
[root@localhost ~]# su - sun //切换用户
上一次登录:五 8月 9 12:19:27 CST 2019:1 上
[sun@localhost ~]$
- Users enter in the sun to siti1, create files, verify the number of file limit is successful.
[sun@localhost ~]$ cd /opt/siti1 //进入到siti1目录
[sun@localhost siti1]$ touch demo{1..100}.txt //创建文件demo1~demo100,我们设置的软限制数值
[sun@localhost siti1]$ touch demo{101..150}.txt //创建文件demo101~demo150,我们设置的硬限制数
[sun@localhost siti1]$ touch demo151.txt //创建文件demo151,此设置超出设置的限制
touch: 无法创建"demo151.txt": 超出磁盘限额 //系统提示无法创建
[sun@localhost siti1]$
-
We verify command to write the file to verify the limit. Empty files created before the first remove, and then use the command written to the file.
dd if=/dev/zero of=文件路径 bs=N count=N
dd:复制
if=/dev/zero:从zero中拿取容量
of=文件路径:将的容量写入设置配额磁盘下的文件中
bs=N:每次拿多少
count=N:拿多少次
[sun@localhost siti1]$ rm -rf *
[sun@localhost siti1]$ dd if=/dev/zero of=/opt/siti1/123.txt bs=10M count=8
记录了8+0 的读入 //从zero中拿取80M写入sist1目录下123.txt文件中
记录了8+0 的写出
83886080字节(84 MB)已复制,0.0741589 秒,1.1 GB/秒
[sun@localhost siti1]$ ls -lh //查看siti1目录下文件,已写入文件
总用量 80M
-rw-rw-r--. 1 sun sun 80M 8月 23 19:11 123.txt
[sun@localhost siti1]$ dd if=/dev/zero of=/opt/siti1/1234.txt bs=10M count=8
dd: 写入"/opt/siti1/1234.txt" 出错: 超出磁盘限额
记录了8+0 的读入 //从zero中拿取80M写入sist1目录下1234.txt文件中,出现出错,超出限额
记录了7+0 的写出
73400320字节(73 MB)已复制,0.0852517 秒,861 MB/秒
[sun@localhost siti1]$ ls -lh //查看siti1目录内容,总容量写入150M,设置的限制数值。
总用量 150M
-rw-rw-r--. 1 sun sun 70M 8月 23 19:13 1234.txt
-rw-rw-r--. 1 sun sun 80M 8月 23 19:11 123.txt
4、查看配额使用情况
-
You can get a quota user or group usage in the file system, you can use the
report
command. We also need to get back toroot
the user, and then view it.xfs_quota -x -c 'report 选项' 挂载点
Common options
-a:查看所有配额
-i:查看节点信息
-b:输出报告
-u:查看用户配额
-g:查看组配额
[root@localhost ~]# xfs_quota -x -c 'report -aib' /opt/siti1
User quota on /opt/siti1 (/dev/mapper/siti-si)
Blocks Inodes
User ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace
---------- -------------------------------------------------- --------------------------------------------------
root 0 0 0 00 [--------] 3 0 0 00 [--------]
sun 153600 102400 153600 00 [6 days] 2 100 150 00 [--------]
Group quota on /opt/siti1 (/dev/mapper/siti-si)
Blocks Inodes
Group ID Used Soft Hard Warn/Grace Used Soft Hard Warn/ Grace
---------- -------------------------------------------------- --------------------------------------------------
root 0 0 0 00 [--------] 3 0 0 00 [--------]
sun 153600 0 0 00 [--------] 2 0 0 00 [--------]
to add on
Expand disk capacity to mount a good lvm, this time we directly view the disk information systems is not displayed after the capacity expansion, this time we need to use the xfs_growfs /dev/卷组名/逻辑卷名
command, you can reload it.
[root@localhost ~]# lvextend -L +4G /dev/siti/si //给逻辑卷si增加4G容量
Size of logical volume siti/si changed from 25.00 GiB (6400 extents) to 29.00 GiB (7424 extents).
Logical volume siti/si successfully resized.
[root@localhost ~]# df -h //查看磁盘信息
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda2 20G 4.3G 16G 22% /
...//省略部分内容...
/dev/mapper/siti-si 25G 183M 25G 1% /opt/siti1 //没有显示增加容量
/dev/mapper/siti-ti 30G 33M 30G 1% /opt/siti2
[root@localhost ~]# xfs_growfs /dev/siti/si //重新加载
meta-data=/dev/mapper/siti-si isize=512 agcount=4, agsize=1638400 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=6553600, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=3200, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 6553600 to 7602176
[root@localhost ~]# df -h //查看磁盘信息
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda2 20G 4.3G 16G 22% /
...//省略部分内容...
/dev/mapper/siti-si 29G 183M 29G 1% /opt/siti1 //显示增加的容量
/dev/mapper/siti-ti 30G 33M 30G 1% /opt/siti2