码迷,mamicode.com
首页 > 其他好文 > 详细

centos7 / redhat 7的分区扩容

时间:2019-12-01 21:18:38      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:create   mapper   back   ack   sys   lvm   available   ted   lvcreate   

linux扩容:分区扩容前先用fdisk把该分区的system id改成lvm(8e)
创建逻辑卷:
创建PV(转换物理卷)--->创建VG--->创建LV,并格式化
fdisk /dev/sdb,创建分区并将id改为8e
fdisk /dev/sdc创建分区并将id改为8e
fdisk /dev/sdd创建分区并将id改为8e
pvscan查看当前是否有物理卷
pvdisplay
1、[root@localhost ~]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created.
[root@localhost ~]# pvcreate /dev/sdc1
Physical volume "/dev/sdc1" successfully created.
[root@localhost ~]# pvcreate /dev/sdc1
Physical volume "/dev/sdc1" successfully created.
[root@localhost ~]#
2、创建卷组VG
vgscan、vgdisplay
[root@localhost ~]# vgscan
Reading volume groups from cache.
[root@localhost ~]# vgcreate mail_store /dev/sdc1 /dev/sdb1 /dev/sdd1
Volume group "mail_store" successfully created
[root@localhost ~]#
3、创建LV
[root@localhost ~]# lvscan
[root@localhost ~]# lvdisplay
[root@localhost ~]#
[root@localhost ~]# lvcreate -L 15G(大小) -n mail(名称) mail_store(卷组)
Logical volume "mail" created.
[root@localhost ~]# lvscan
ACTIVE ‘/dev/mail_store/mail‘ [15.00 GiB] inherit
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/mail_store/mail
LV Name mail
VG Name mail_store
LV UUID j5Hvhi-ppem-Okz1-CV0o-SnKY-Gkdk-lr2zXU
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2019-12-01 03:11:40 +0800
LV Status available

open 0

LV Size 15.00 GiB
Current LE 3840
Segments 2
Allocation inherit
Read ahead sectors auto

  • currently set to 8192
    Block device 253:0

格式化lv为ext4文件类型:mkfs -t ext4 /dev/mail_store/mail
[root@localhost ~]# mkfs -t ext4 /dev/mail_store/mail
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
983040 inodes, 3932160 blocks
196608 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=2151677952
120 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
挂载lv到/mnt目录:mount /dev/mail_store/mail /mnt/
[root@localhost ~]# mount /dev/mail_store/mail /mnt/
[root@localhost ~]# df -Th
文件系统 类型 容量 已用 可用 已用% 挂载点
/dev/sda2 ext4 17G 3.5G 13G 22% /
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/sda1 xfs 1014M 175M 840M 18% /boot
tmpfs tmpfs 183M 20K 183M 1% /run/user/1000
/dev/sr0 iso9660 3.8G 3.8G 0 100% /run/media/mcq/RHEL-7.4 Server.x86_64
tmpfs tmpfs 183M 0 183M 0% /run/user/0
/dev/mapper/mail_store-mail ext4 15G 41M 14G 1% /mnt
[root@localhost ~]#

centos7 / redhat 7的分区扩容

标签:create   mapper   back   ack   sys   lvm   available   ted   lvcreate   

原文地址:https://blog.51cto.com/2526575/2455100

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!