4.11-Lvm讲解(中)创建卷组,创建逻辑卷,扩容逻辑卷,缩容逻辑卷

本文详细介绍了如何在Linux下进行LVM操作,包括创建卷组、创建逻辑卷、扩容和缩容逻辑卷的过程。通过实例演示了使用ext4和xfs文件系统的扩容步骤,并强调了在xfs系统下缩容的限制。
摘要由CSDN通过智能技术生成

创建卷组

[root@evan-01 ~]# vgcreate vg1 /dev/sdb1 /dev/sdb2
  Volume group "vg1" successfully created
[root@evan-01 ~]# 

查看卷组
查看创建的卷组

[root@evan-01 ~]# vgdisplay
  --- Volume group ---
  VG Name               vg1
  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               1.99 GiB
  PE Size               4.00 MiB
  Total PE              510
  Alloc PE / Size       0 / 0   
  Free  PE / Size       510 / 1.99 GiB
  VG UUID               Zp3UBb-ofWe-At0C-2XPt-Mvsz-uf7Z-uWLh9S
   
  --- Volume group ---
  VG Name               centos
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <19.00 GiB
  PE Size               4.00 MiB
  Total PE              4863
  Alloc PE / Size       4863 / <19.00 GiB
  Free  PE / Size       0 / 0   
  VG UUID               WR4onu-xheI-7NwR-5vW1-y0Ek-eilK-Yil3A2
   
[root@evan-01 ~]# 

更简单直观查看卷组

[root@evan-01 ~]# vgs
  VG     #PV #LV #SN Attr   VSize   VFree
  centos   1   2   0 wz--n- <19.00g    0 
  vg1      2   0   0 wz--n-   1.99g 1.99g
[root@evan-01 ~]#

创建逻辑卷

[root@evan-01 ~]# lvcreate -L 100M -n 1v1 vg1
  Logical volume "1v1" created.
[root@evan-01 ~]#

格式化

[root@evan-01 ~]# mkfs.ext4 /dev/vg1/lv1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
25688 inodes, 102400 blocks
5120 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=33685504
13 block groups
8192 blocks per group, 8192 fragments per group
1976 inodes per group
Superblock backups stored on blocks: 
        8193, 24577, 40961, 57345, 73729

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done 

[root@evan-01 ~]# 

挂载

[root@evan-01 ~]# mount /dev/vg1/lv1 /mnt/
[root@evan-01 ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   17G 1023M   16G   6% /
devtmpfs                 482M     0  482M   0% /dev
tmpfs                    493M     0  493M   0% /dev/shm
tmpfs                    493M  6.8M  486M   2% /run
tmpfs                    493M     0  493M   0% /sys/fs/cgroup
/dev/sda1               1014M  125M  890M  13% /boot
tmpfs                     9
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值