mdadm and lvm how to completely disable and remove vg/pv/lv

In short the solution is just to use vgremove for the actual /dev/mapper device:

vgremove /dev/mapper/backups-backuplv


 

box mnt # mdadm --manage /dev/md8 --stop
mdadm: Cannot get exclusive access to /dev/md8:Perhaps a running process, mounted filesystem or active volume group?
box mnt # lv
lvchange     lvconvert    lvcreate     lvdisplay    lvextend     lvm          lvmchange    lvmconf      lvmdiskscan  lvmdump      lvmsadc      lvmsar       lvreduce     lvremove     lvrename     lvresize     lvs          lvscan
box mnt # pvdisplay
  --- Physical volume ---
  PV Name               /dev/md8
  VG Name               backups
  PV Size               7.28 TiB / not usable 4.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              1907688
  Free PE               20251
  Allocated PE          1887437
  PV UUID               IDnmlM-2r3q-McwV-y2at-djxK-DvPM-sFqlTo
  
box mnt # pvchange --help
  pvchange: Change attributes of physical volume(s)

pvchange
    [-a|--all]
    [-A|--autobackup y|n]
    [-d|--debug]
    [-f|--force]
    [-h|--help]
    [-t|--test]
    [-u|--uuid]
    [-x|--allocatable y|n]
    [--metadataignore y|n]
    [-v|--verbose]
    [--addtag Tag]
    [--deltag Tag]
    [--version]
    [PhysicalVolumePath...]

box mnt # pvchange --help^C
box mnt # pvremove /dev/md8
  PV /dev/md8 belongs to Volume Group backups so please use vgreduce first.
  (If you are certain you need pvremove, then confirm by using --force twice.)
box mnt # vgdisplay
  --- Volume group ---
  VG Name               backups
  System ID            
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               7.28 TiB
  PE Size               4.00 MiB
  Total PE              1907688
  Alloc PE / Size       1887437 / 7.20 TiB
  Free  PE / Size       20251 / 79.11 GiB
  VG UUID               DwxSxL-UmcV-TyjM-TUa1-ef4w-lrK5-cipxiI
  
box mnt # vgremove /dev/^C
box mnt # ls /dev/m
mapper/  mcelog   md/      md0      md0p1    md1      md1p1    md2      md20     md2p1    md8      md99     mem      mpt2ctl 
box mnt # ls /dev/m
mapper/  mcelog   md/      md0      md0p1    md1      md1p1    md2      md20     md2p1    md8      md99     mem      mpt2ctl 
box mnt # ls /dev/mapper/
backups-backuplv  control          
box mnt # vgremove /dev/mapper/backups-backuplv
  Invalid volume group name: backups/backuplv
  Run `vgremove --help' for more information.
box mnt # vgremove /dev/mapper/backups
Do you really want to remove volume group "backups" containing 1 logical volumes? [y/n]: y
Do you really want to remove and DISCARD active logical volume backuplv? [y/n]: y
  Logical volume "backuplv" successfully removed
  Volume group "backups" successfully removed
box mnt #
 


Tags:

mdadm, lvm, disable, vg, pv, lvin, vgremove, dev, mapper, backups, backuplv, mnt, md, exclusive, mounted, filesystem, active, volume, lv, lvchange, lvconvert, lvcreate, lvdisplay, lvextend, lvmchange, lvmconf, lvmdiskscan, lvmdump, lvmsadc, lvmsar, lvreduce, lvremove, lvrename, lvresize, lvs, lvscan, pvdisplay, tib, usable, mib, allocatable, pe, allocated, uuid, idnmlm, mcwv, djxk, dvpm, sfqlto, pvchange, attributes, autobackup, debug, metadataignore, verbose, addtag, deltag, physicalvolumepath, pvremove, vgreduce, vgdisplay, format, metadata, areas, sequence, resizable, cur, alloc, gib, dwxsxl, umcv, tyjm, tua, ef, lrk, cipxii, ls, mcelog, mem, mpt, ctl, invalid, quot, containing, volumes, discard, successfully,

Latest Articles

  • How To Add Windows 7 8 10 11 to GRUB Boot List Dual Booting
  • How to configure OpenDKIM on Linux with Postfix and setup bind zonefile
  • Debian Ubuntu 10/11/12 Linux how to get tftpd-hpa server setup tutorial
  • efibootmgr: option requires an argument -- 'd' efibootmgr version 15 grub-install.real: error: efibootmgr failed to register the boot entry: Operation not permitted.
  • Apache Error Won't start SSL Cert Issue Solution Unable to configure verify locations for client authentication SSL Library Error: 151441510 error:0906D066:PEM routines:PEM_read_bio:bad end line SSL Library Error: 185090057 error:0B084009:x509 certif
  • Linux Debian Mint Ubuntu Bridge br0 gets random IP
  • redis requirements
  • How to kill a docker swarm
  • docker swarm silly issues
  • isc-dhcp-server dhcpd how to get longer lease
  • nvidia cannot resume from sleep Comm: nvidia-sleep.sh Tainted: Linux Ubuntu Mint Debian
  • zfs and LUKS how to recover in Linux
  • [error] (28)No space left on device: Cannot create SSLMutex Apache Solution Linux CentOS Ubuntu Debian Mint
  • Save money on bandwidth by disabling reflective rpc queries in Linux CentOS RHEL Ubuntu Debian
  • How to access a disk with bad superblock Linux Ubuntu Debian Redhat CentOS ext3 ext4
  • ImageMagick error convert solution - convert-im6.q16: cache resources exhausted
  • PTY allocation request failed on channel 0 solution
  • docker error not supported as upperdir failed to start daemon: error initializing graphdriver: driver not supported
  • Migrated Linux Ubuntu Mint not starting services due to broken /var/run and dbus - Failed to connect to bus: No such file or directory solution
  • qemu-system-x86_64: Initialization of device ide-hd failed: Failed to get