Linux—LVM命令

目录

一、查看卷组信息

二、新建一个分区partition

三、创建物理卷pv

四、创建卷组vg

五、查看vg可用空间

六、建立逻辑卷lv

七、建立文件系统

八、建立挂载点

九、挂载存储

十、修改fstab配置文件实现自动挂载

十一、卸载卷组的逻辑卷lv

十二、删除逻辑卷lv

十三、删除卷组vg

十四、删除物理卷pv

十五、编辑/etc/fstab,删除对应挂载信息


一、查看卷组信息

        查看服务器卷组(VG)物理卷(PV)逻辑卷(LV)相关信息。

        vgscan:查找系统中存在的LVM卷组。显示卷组名和LVM元数据类型。

        vgdisplay:查看卷组详细信息。

        pvscan:查看系统中所有连接硬盘,显示出物理卷。

        lvscan:查看所有LVM的逻辑卷(LV)。

        新增硬盘后,用   fdisk -l   命令,查看新增硬盘。

二、新建一个分区partition

        新建一个主分区(primary partition)或逻辑分区(logical partition)

[root@getlnx20 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xaa12f277.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
 
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
 
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').
 
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-10443, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-10443, default 10443): 
Using default value 10443
 
Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
Syncing disks.

三、创建物理卷pv

[root@getlnx20 ~]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created
[root@getlnx20 ~]# pvscan
  PV /dev/sda2   VG VolGroup00   lvm2 [39.51 GiB / 0    free]
  PV /dev/sdb1                   lvm2 [80.00 GiB]
  Total: 2 [119.51 GiB] / in use: 1 [39.51 GiB] / in no VG: 1 [80.00 GiB]

四、创建卷组vg

[root@getlnx20 ~]# vgcreate -s 32M VolGroup01 /dev/sdb1
  Volume group "VolGroup01" successfully created
[root@getlnx20 ~]# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "VolGroup01" using metadata type lvm2
  Found volume group "VolGroup00" using metadata type lvm2

五、查看vg可用空间

[root@getlnx20 ~]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup01
  System ID             
  Format                lvm2
  Metadata Areas        1
  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                1
  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值