Saturday, 12 May 2018

Fiber Channel Cheat Sheet - Deleting LUNs

I want to delete the following LUN:
"mpathe" LUN WWID is "600507680c800507f0000000000000c6" (without "3") Disks are "/dev/sdh", "/dev/sdm", "/dev/sdc" and "/dev/sdr".
[root@B54LFRTMPSTG01 ~]# multipath -ll
mpathe (3600507680c800507f0000000000000c6) dm-4 IBM     ,2145            
size=55G features='1 queue_if_no_path' hwhandler='0' wp=rw
|-+- policy='service-time 0' prio=50 status=active
| |- 0:0:0:2 sdh        8:112 active ready running
| `- 1:0:0:2 sdm        8:192 active ready running
`-+- policy='service-time 0' prio=10 status=enabled
  |- 0:0:1:2 sdc        8:32  active ready running
  `- 1:0:1:2 sdr        65:16 active ready running


Find the used Physical Volume (PV), Volume Group (VG), Logical Volume (LV), Filesystem and Mount Point used by "mpathe"
[root@B54LFRTMPSTG01 ~]# pvs | grep -e PV  -e mpathe
  PV                 VG                  Fmt  Attr PSize     PFree 
  /dev/mapper/mpathe vg-community-master lvm2 a--    <55.00g     0 
[root@B54LFRTMPSTG01 ~]# lvs | grep -e LV -e vg-community-master
  LV               VG                  Attr       LSize     Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  community-master vg-community-master -wi-ao----   <55.00g    
[root@B54LFRTMPSTG01 ~]# df -hT /dev/vg-community-master/community-master
Filesystem                                          Type  Size  Used Avail Use% Mounted on
/dev/mapper/vg--community--master-community--master ext3   55G   52M   52G   1% /home/databases/community-master
[root@B54LFRTMPSTG01 ~]# lsblk | grep -B1 -A1 mpathe
sdc                                           8:32   0   55G  0 disk  
└─mpathe                                    253:4    0   55G  0 mpath 
  └─vg--community--master-community--master 253:7    0   55G  0 lvm   /home/databases/community-master
--
sdh                                           8:112  0   55G  0 disk  
└─mpathe                                    253:4    0   55G  0 mpath 
  └─vg--community--master-community--master 253:7    0   55G  0 lvm   /home/databases/community-master
--
sdm                                           8:192  0   55G  0 disk  
└─mpathe                                    253:4    0   55G  0 mpath 
  └─vg--community--master-community--master 253:7    0   55G  0 lvm   /home/databases/community-master
--
sdr                                          65:16   0   55G  0 disk  
└─mpathe                                    253:4    0   55G  0 mpath 
  └─vg--community--master-community--master 253:7    0   55G  0 lvm   /home/databases/community-master


Umount "/home/databases/community-master" mount point:
[root@B54LFRTMPSTG01 ~]# umount /home/databases/community-master


Comment "/home/databases/community-master" line from "/etc/fstab" file:
#/dev/vg-community-master/community-master       /home/databases/community-master        ext3    defaults,noatime        0       0


Deactivate "community-master" LV and "vg-community-master" VG:
[root@B54LFRTMPSTG01 ~]# lvchange -an /dev/vg-community-master/community-master
[root@B54LFRTMPSTG01 ~]# vgchange -an vg-community-master
  0 logical volume(s) in volume group "vgsql" now active


IF AND ONLY IF YOU DO NOT WANT THE TO MOVE THE LV AND VG TO ANOTHER HOST, THEN DELETE "community-master" LV and "vg-community-master" VG, OTHERWISE, EXPORT the VG:
[root@B54LFRTMPSTG01 ~]# lvremove /dev/vg-community-master/community-master
[root@B54LFRTMPSTG01 ~]# vgremove vg-community-master


Remove 'mpathe" device:
[root@B54LFRTMPSTG01 ~]# multipath -f mpathe
[root@B54LFRTMPSTG01 ~]# multipath -ll
[root@B54LFRTMPSTG01 ~]# echo $?
0


Unmap Disks the forms "mpathe" from your discovered LUNs:
[root@B54LFRTMPSTG01 ~]# echo 1 > /sys/block/sdh/device/delete 
[root@B54LFRTMPSTG01 ~]# echo 1 > /sys/block/sdm/device/delete 
[root@B54LFRTMPSTG01 ~]# echo 1 > /sys/block/sdc/device/delete 
[root@B54LFRTMPSTG01 ~]# echo 1 > /sys/block/sdr/device/delete 

No comments:

Post a Comment