zoukankan      html  css  js  c++  java
  • linux系统中完整删除逻辑卷、卷组、物理劵

    • 删除逻辑卷前备份数据
    • 逻辑卷删除顺序为逻辑卷、卷组、物理劵,不可颠倒

    1、查看系统中当前的逻辑卷

    [root@PC1linuxprobe /]# lvscan 
      ACTIVE            '/dev/rhel/swap' [2.00 GiB] inherit
      ACTIVE            '/dev/rhel/root' [17.51 GiB] inherit
      ACTIVE            '/dev/vg1/lv1' [100.00 MiB] inherit
      ACTIVE            '/dev/vg1/lv2' [300.00 MiB] inherit

    2、查看逻辑卷挂载情况

    [root@PC1linuxprobe /]# df -h
    Filesystem             Size  Used Avail Use% Mounted on
    /dev/mapper/rhel-root   18G  2.9G   15G  17% /
    devtmpfs               985M     0  985M   0% /dev
    tmpfs                  994M  140K  994M   1% /dev/shm
    tmpfs                  994M  8.8M  986M   1% /run
    tmpfs                  994M     0  994M   0% /sys/fs/cgroup
    /dev/sda1              497M  119M  379M  24% /boot
    /dev/sr0               3.5G  3.5G     0 100% /run/media/root/RHEL-7.0 Server.x86_64
    /dev/mapper/vg1-lv2    283M  2.1M  262M   1% /lvmounttest

    3、卸载逻辑卷

    [root@PC1linuxprobe /]# umount /lvmounttest

    4、删除逻辑卷

    [root@PC1linuxprobe /]# lvscan 
      ACTIVE            '/dev/rhel/swap' [2.00 GiB] inherit
      ACTIVE            '/dev/rhel/root' [17.51 GiB] inherit
      ACTIVE            '/dev/vg1/lv1' [100.00 MiB] inherit
      ACTIVE            '/dev/vg1/lv2' [300.00 MiB] inherit
    [root@PC1linuxprobe /]# lvremove /dev/vg1/lv1
    Do you really want to remove active logical volume lv1? [y/n]: y
      Logical volume "lv1" successfully removed
    [root@PC1linuxprobe /]# lvremove /dev/vg1/lv2
    Do you really want to remove active logical volume lv2? [y/n]: y
      Logical volume "lv2" successfully removed
    [root@PC1linuxprobe /]# lvscan 
      ACTIVE            '/dev/rhel/swap' [2.00 GiB] inherit
      ACTIVE            '/dev/rhel/root' [17.51 GiB] inherit

    5、删除卷组

    [root@PC1linuxprobe /]# vgscan 
      Reading all physical volumes.  This may take a while...
      Found volume group "rhel" using metadata type lvm2
      Found volume group "vg1" using metadata type lvm2
    [root@PC1linuxprobe /]# vgremove vg1 
      Volume group "vg1" successfully removed
    [root@PC1linuxprobe /]# vgscan 
      Reading all physical volumes.  This may take a while...
      Found volume group "rhel" using metadata type lvm2

    6、删除物理劵

    [root@PC1linuxprobe /]# pvscan 
      PV /dev/sda2   VG rhel            lvm2 [19.51 GiB / 0    free]
      PV /dev/sdb                       lvm2 [20.00 GiB]
      PV /dev/sdc                       lvm2 [20.00 GiB]
      PV /dev/sdd                       lvm2 [20.00 GiB]
      Total: 4 [79.51 GiB] / in use: 1 [19.51 GiB] / in no VG: 3 [60.00 GiB]
    [root@PC1linuxprobe /]# pvremove /dev/sdb /dev/sdc /dev/sdd
      Labels on physical volume "/dev/sdb" successfully wiped
      Labels on physical volume "/dev/sdc" successfully wiped
      Labels on physical volume "/dev/sdd" successfully wiped
    [root@PC1linuxprobe /]# pvscan 
      PV /dev/sda2   VG rhel   lvm2 [19.51 GiB / 0    free]
      Total: 1 [19.51 GiB] / in use: 1 [19.51 GiB] / in no VG: 0 [0   ]

    总结,完整删除逻辑卷步骤:

    • 卸载,示例:umount /mountpoint
    • 删除逻辑卷,示例:lvremove /dev/vgname/lvname
    • 删除卷组,示例:vgremove vgname
    • 删除物理劵,示例:pvremove /dev/disk*

     注:

    • 逻辑卷部署顺序:物理劵→卷组→逻辑卷
    • 逻辑卷删除顺序:逻辑卷→卷组→物理劵
  • 相关阅读:
    利用avicap32.dll实现的实时视频传输
    异常错误:在可以调用 OLE 之前,必须将当前线程设置为单线程单元(STA)模式
    很不错的python 机器学习资源
    基于C#的机器学习--目录
    C#WinForm无边框窗体移动----模仿鼠标单击标题栏移动窗体位置
    C# WinForm窗体控件GroupBox修改边框颜色控件
    wireshark抓包新手使用教程
    Winform开发框架之权限管理系统功能介绍
    自定义控件开发的调试及DesignMode的状态处理
    Winform开发框架之权限管理系统改进的经验总结(4)--用户分级管理
  • 原文地址:https://www.cnblogs.com/liujiaxin2018/p/13945634.html
Copyright © 2011-2022 走看看