美文网首页
Linux系统从vg里删除某个pv

Linux系统从vg里删除某个pv

作者: 红尘陌上人 | 来源:发表于2019-03-22 10:50 被阅读0次

1、首先查看pv使用情况

[root@dzda01 ~]# pvscan
  PV /dev/vda3   VG vg01            lvm2 [62.00 GiB / 4.00 MiB free]
  PV /dev/vda4   VG vg01            lvm2 [<17.49 GiB / <17.49 GiB free]
  Total: 2 [79.49 GiB] / in use: 2 [79.49 GiB] / in no VG: 0 [0   ]

从pvscan给出的结果可以看出vda4这个pv是没有使用的,可以直接卸载掉。

2、从vg01中删除vda4

[root@dzda01 ~]# vgreduce vg01 /dev/vda4
  Removed "/dev/vda4" from volume group "vg01"
[root@dzda01 ~]# pvscan
  PV /dev/vda3   VG vg01            lvm2 [62.00 GiB / 4.00 MiB free]
  PV /dev/vda4                      lvm2 [<17.49 GiB]
  Total: 2 [79.49 GiB] / in use: 1 [62.00 GiB] / in no VG: 1 [<17.49 GiB]

3、删除pv
确认PV信息

[root@dzda01 ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/vda3
  VG Name               vg01
  PV Size               <62.01 GiB / not usable 4.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              15873
  Free PE               1
  Allocated PE          15872
  PV UUID               yjxUQ0-UFPf-iziu-bnGj-sA1B-Qzvz-22l8ql
   
  "/dev/vda4" is a new physical volume of "<17.49 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/vda4
  VG Name               
  PV Size               <17.49 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               N5GfN7-3TDV-tMeU-JfTc-QLXL-g0aw-BCbZ03

删除pv

[root@dzda01 ~]# pvremove /dev/vda4
  Labels on physical volume "/dev/vda4" successfully wiped.

4、删除改盘上的lvm空间

[root@dzda01 ~]# fdisk /dev/vda
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p

Disk /dev/vda: 322.1 GB, 322122547200 bytes, 629145600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000bc594

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1            2048        6143        2048   83  Linux
/dev/vda2   *        6144     1054719      524288   83  Linux
/dev/vda3         1054720   131094527    65019904   8e  Linux LVM
/dev/vda4       131094528   167772159    18338816   8e  Linux LVM

Command (m for help): d
Partition number (1-4, default 4): 4
Partition 4 is deleted

Command (m for help): p

Disk /dev/vda: 322.1 GB, 322122547200 bytes, 629145600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000bc594

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1            2048        6143        2048   83  Linux
/dev/vda2   *        6144     1054719      524288   83  Linux
/dev/vda3         1054720   131094527    65019904   8e  Linux LVM

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@dzda01 ~]# partprobe

现在vda4的空间就全部释放了,可以重新规划空间!如果是单盘pv的话,现在即可拔出硬盘了!

相关文章

  • Linux系统从vg里删除某个pv

    1、首先查看pv使用情况 从pvscan给出的结果可以看出vda4这个pv是没有使用的,可以直接卸载掉。 2、从v...

  • Linux实用工具-lvm(2)

    基本操作-pv 创建pv 查看pv 基本操作-vg 两种创建vg方式 创建vg,默认PE大小为4M 设置PE大小为...

  • pv+vg+lv

    创建 pv+vg+lvfdisk -l && lsblkpvcreate /dev/sdbvgcreate vg...

  • LVM卷的搭建

    LVM卷的搭建 1.物理盘加入pv,也可以是分区加入pv 2. 创建vg ,将加入pv的磁盘加入到vg 3. 创建...

  • 扩展更目录

    思路:添加硬盘 -> 分区 -> 将分区转换为物理卷(pv)-> 将pv卷添加到逻辑卷组中(vg)-> 将vg中的...

  • LVM管理

    1 名词解释 磁盘或者分区可以创建成pv(物理卷),一个或多个pv可以组成vg(卷组),vg可以划分成lv(逻辑卷...

  • Kubernetes pv无法删除问题

    正常删除pvc,pv等的步骤 正确删除pv的步骤是删除使用pvc的pod,再删除pvc,最后删除pv pv无法删除...

  • win10内建的Linux

    启用Linux子系统 从cmd中下载linux和linux终端安装程序一样 卸载linux子系统 删除 %USER...

  • linux机器创建虚拟盘

    将新硬盘格式化 将以上硬盘创建PV 加入VG 创建LV,并将 VG加入LV 格式化LV 挂载

  • 创建逻辑卷

    PV:物理卷(Physical volume)VG:卷组(Volume Group)LV:逻辑卷(Logical ...

网友评论

      本文标题:Linux系统从vg里删除某个pv

      本文链接:https://www.haomeiwen.com/subject/qlhlvqtx.html