当前位置:网站首页>Logical volume creation
Logical volume creation
2022-08-05 06:15:00 【sologuai】
一、逻辑卷概念
PV ( Physical Volume,物理卷)
- 整个硬盘,或使用fdisk等工具建立的普通分区
- 包括许多默认4MB大小的PE ( Physical Extent ,基本单元)
VG ( Volume Group,卷组)
- 一个或多个物理卷组合而成的整体
LV ( Logical Volume,逻辑卷)
- 从卷组中分割出的一块空间,用于建立文件系统
二、创建逻辑卷命令
pvcreate 设备名1 [设备名2 ... ...] (设备可以是分区,可以是硬盘)
vgcreate卷组名 物理卷名1 物理卷名2 (物理卷可以是一个,可以是多个)
lvcreate -n 逻辑卷名 -L 容量大小 卷组名(从哪个卷组里取)
lvextend -L +大小 /dev/卷组名/逻辑卷名
扩容后刷新文件系统命令
xfg_growfs /dev/vgname1/lvname1 //刷新xfs文件系统容量
resize2fs /dev/vgname1/lvname1 //刷新ext4类型文件系统容量
使用fdisk工具规划分区,将/dev/sdb3和/dev/sdc1分区
[[email protected] ~]# fdisk /dev/sdb //管理磁盘分区,将sdb3的格式修改为LVM
欢迎使用 fdisk (util-linux 2.23.2).
更改将停留在内存中,直到您决定将更改写入磁盘.
使用写入命令前请三思.
命令(输入 m 获取帮助):t
分区号 (1-3,5,6,默认 6):3
Hex 代码(输入 L 列出所有代码):8e
已将分区“Linux”的类型更改为“Linux LVM”
命令(输入 m 获取帮助):w
[[email protected] ~]# fdisk /dev/sdc //管理磁盘分区,将sdc1的格式修改为LVM
欢迎使用 fdisk (util-linux 2.23.2).
更改将停留在内存中,直到您决定将更改写入磁盘.
使用写入命令前请三思.
命令(输入 m 获取帮助):t
已选择分区 1
Hex 代码(输入 L 列出所有代码):8e
已将分区“Linux”的类型更改为“Linux LVM”
命令(输入 m 获取帮助):w
[[email protected] ~]# partprobe //刷新分区,使系统识别
Warning: 无法以读写方式打开 /dev/sr0 (只读文件系统)./dev/sr0 已按照只读方式打开.将/dev/sdb3和/dev/sdc1创建物理卷
[[email protected] ~]# pvcreate /dev/sdb3 /dev/sdc1 //创建物理卷
Physical volume "/dev/sdb3" successfully created.
Physical volume "/dev/sdc1" successfully created.
[[email protected] ~]# pvscan //扫描查看物理卷
PV /dev/sda2 VG centos lvm2 [14.00 GiB / 0 free]
PV /dev/sdb3 lvm2 [<2.00 GiB]
PV /dev/sdc1 lvm2 [8.00 GiB]
Total: 3 [<24.00 GiB] / in use: 1 [14.00 GiB] / in no VG: 2 [<10.00 GiB]创建卷组vg01,并将2个物理卷分配给vg01
[[email protected] ~]# vgcreate vg01 /dev/sdb3 /dev/sdc1 //创建卷组
Volume group "vg01" successfully created
[[email protected] ~]# vgscan //扫描卷组
Reading volume groups from cache.
Found volume group "centos" using metadata type lvm2
Found volume group "vg01" using metadata type lvm2
[[email protected] ~]# vgdisplay vg01 //显示卷组列表
--- Volume group ---
VG Name vg01
System ID
Format lvm2
Metadata Areas 2
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 2
Act PV 2
VG Size 9.99 GiB //卷组总容量
PE Size 4.00 MiB
Total PE 2558
Alloc PE / Size 0 / 0
Free PE / Size 2558 / 9.99 GiB //空余容量
VG UUID fl0023-VHwK-3OiQ-y1wT-DCnS-t7f2-E5aTWn
从vg01中取8G容量创建逻辑卷lvmail
[[email protected] ~]# mkfs.xfs /dev/vg01/lvmail //将lvmail格式化为XFS文件系统
meta-data=/dev/vg01/lvmail isize=512 agcount=4, agsize=524288 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=2097152, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0将逻辑卷lvmail格式化为XFS文件系统
[[email protected] ~]# mkdir /data/mail
[[email protected] ~]# blkid | grep lvmail //查看逻辑卷lvmail的UUID
/dev/mapper/vg01-lvmail: UUID="14e500d0-867d-470c-b4ed-b5b758db7996" TYPE="xfs"
[[email protected] ~]# vim /etc/fstab //修改配置文件,将lvmail设置为每次开机后自动挂载到/data/mail 目录下
UUID=14e500d0-867d-470c-b4ed-b5b758db7996 /data/mail xfs defaults 0 0
[[email protected] ~]# mount -a //重新挂载所有磁盘
[[email protected] ~]# df -Th //查看磁盘信息,可以看到lvmail已成功挂载
文件系统 类型 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root xfs 10G 4.9G 5.2G 49% /
devtmpfs devtmpfs 897M 0 897M 0% /dev
tmpfs tmpfs 912M 0 912M 0% /dev/shm
tmpfs tmpfs 912M 9.1M 903M 1% /run
tmpfs tmpfs 912M 0 912M 0% /sys/fs/cgroup
/dev/sdb1 xfs 10G 33M 10G 1% /data/aa
/dev/sdb5 xfs 2.0G 33M 2.0G 2% /data/bb
/dev/sda1 xfs 1014M 179M 836M 18% /boot
tmpfs tmpfs 183M 12K 183M 1% /run/user/42
tmpfs tmpfs 183M 0 183M 0% /run/user/0
/dev/mapper/vg01-lvmail xfs 8.0G 33M 8.0G 1% /data/mail修改/etc/fstab 文件,将逻辑卷lvmail挂载到/data/mail 目录下
[[email protected] ~]# mkdir /data/mail
[[email protected] ~]# blkid | grep lvmail //查看逻辑卷lvmail的UUID
/dev/mapper/vg01-lvmail: UUID="14e500d0-867d-470c-b4ed-b5b758db7996" TYPE="xfs"
[[email protected] ~]# vim /etc/fstab //修改配置文件,将lvmail设置为每次开机后自动挂载到/data/mail 目录下
UUID=14e500d0-867d-470c-b4ed-b5b758db7996 /data/mail xfs defaults 0 0
[[email protected] ~]# mount -a //重新挂载所有磁盘
[[email protected] ~]# df -Th //查看磁盘信息,可以看到lvmail已成功挂载
文件系统 类型 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root xfs 10G 4.9G 5.2G 49% /
devtmpfs devtmpfs 897M 0 897M 0% /dev
tmpfs tmpfs 912M 0 912M 0% /dev/shm
tmpfs tmpfs 912M 9.1M 903M 1% /run
tmpfs tmpfs 912M 0 912M 0% /sys/fs/cgroup
/dev/sdb1 xfs 10G 33M 10G 1% /data/aa
/dev/sdb5 xfs 2.0G 33M 2.0G 2% /data/bb
/dev/sda1 xfs 1014M 179M 836M 18% /boot
tmpfs tmpfs 183M 12K 183M 1% /run/user/42
tmpfs tmpfs 183M 0 183M 0% /run/user/0
/dev/mapper/vg01-lvmail xfs 8.0G 33M 8.0G 1% /data/mail边栏推荐
猜你喜欢

【机器学习】1单变量线性回归

VLAN details and experiments
![[Pytorch study notes] 8. How to use WeightedRandomSampler (weight sampler) when the training category is unbalanced data](/img/29/5b44c016bd11f0c0a9110cf513f4e1.png)
[Pytorch study notes] 8. How to use WeightedRandomSampler (weight sampler) when the training category is unbalanced data

入门文档06 向流(stream)中添加文件

Getting Started 05 Using cb() to indicate that the current task is complete

vim教程:vimtutor

dsf5.0新建页面访问时重定向到首页的问题

OpenCV3.0 is compatible with VS2010 and VS2013

IP address and subnet division

Getting Started Documentation 12 webserve + Hot Updates
随机推荐
传输层协议(TCP3次握手)
OpenCV3.0 is compatible with VS2010 and VS2013
Getting Started 05 Using cb() to indicate that the current task is complete
VLAN详解及实验
Servlet跳转到JSP页面,转发和重定向
【Machine Learning】1 Univariate Linear Regression
逻辑卷创建
Getting Started Documentation 12 webserve + Hot Updates
Introductory document 05-2 use return instructions the current task has been completed
unity实现第一人称漫游(保姆级教程)
spark源码-任务提交流程之-5-CoarseGrainedExecutorBackend
I217-V network disconnection problem in large traffic under openwrt soft routing
TCP/IP four-layer model
The problem of calling ds18b20 through a single bus
The idea of commonly used shortcut key
Apache配置反向代理
Configuration of TensorFlow ObjecDetectionAPI under Anaconda3 of win10 system
Getting Started Document 01 series in order
I/O performance and reliability
Spark源码-任务提交流程之-6.2-sparkContext初始化-TaskScheduler任务调度器