--- Migration from Compellent to PowerStore---


Servers With Compellent Storage Google Sheet
DEBCAV's google Sheet
OUR Google Sheet

To replace the Linux client iSCSI with the new VMware VMDK storage device.	
 --J.Ramsay (jramsay@binghamton.edu) - 04/28/2022
	Reviewed steps to complete Linux client transition with no downtime
 --D.Cavallucci (debcav@binghamton.edu) - 04/28/2022
	Reviewed steps to ensure that the Linux client is provisioned correctly, 
        storage is added per Request and 
        Post migration steps are performed.

 --Information required by the VMWare administrators Open a Service Now Request
                                                     Modify a Server
	VM Name and Operating System 
		echo "$(hostname -s) - OS:$(cat /etc/oracle-release)"

	The iSCSI Initiator Name
		cat /etc/iscsi/initiatorname.iscsi

	The iSCSI IP Address
		ip addr | grep 'inet 10.1.' | awk '{print $2}'

	The required vmdk storage
		pvscan | egrep PV | awk '{print "pvs "$2}'  | sh | egrep -v PV  |awk {'print $1" "$5}'

-- ORACLE Centric
#!/usr/bin/bash
printf "VM Name and Operating System \n"
echo "$(hostname -s) - OS:$(cat /etc/oracle-release)"
printf "\nThe iSCSI Initiator Name\n"
		cat /etc/iscsi/initiatorname.iscsi
printf "\nThe iSCSI IP Address\n"
ip addr | grep 'inet 10.1.' | awk '{print $2}'
printf "\nThe required vmdk storage\n"
pvscan | egrep PV | awk '{print "pvs "$2}'  | sh | egrep -v PV  |awk {'print $1" "$5}'

printf "/n"

-- UBUNTU|DEBIAN|CENTOS
#!/usr/bin/bash
printf "VM Name and Operating System \n"
echo "$(hostname -s) - OS:$(cat /etc/os-release)" | egrep PRETTY_NAME |cut -d= -f2
printf "\nThe iSCSI Initiator Name\n"
		cat /etc/iscsi/initiatorname.iscsi | egrep -i IQN
printf "\nThe iSCSI IP Address\n"
ip addr | grep 'inet 10.1.' | awk '{print $2}'
printf "\nThe required vmdk storage\n"
pvscan | egrep PV | awk '{print "pvs "$2}'  | sh | egrep -v PV  |awk {'print $1" "$5}'

printf "/n"

	Combine multiple LUNS into one /dev/sd<letter>. 
        Use CFisk to make appropriate sized pieces ADD extra for CFdisk overhead.

 --Information required per host:
	The new VMDK disk "/dev/sd<letter>" which is not part of an existing LVM.
	The current iSCSI disk "/dev/mapper/cd<letter>" which is the standard naming convention|alias used for the multipath volumes.

	NOTE: On most systems, the /dev/sd<letter> may show up as /dev/sdh or higher,
              whereas on others, it might be /dev/sdb. 

	Please use the combination of the "lsblk" and "multipath -ll"
	tools to find the correct devices.
	fdisk -l | egrep /dev/sd | egrep Disk 
        The RESCAN's might need to be done before the new disk will appear.

 -- The following steps are used to stage the client, transition the data 
	from "/dev/mapper/cd<letter>" to /dev/sd<letter>" and remove the iSCSI infrastructure.

	NOTE: Most lines can be cut and paste into your terminal except for those lines where /dev/sd<letter> must be changed

	Please complete the following step on all Oracle Enterprise Linux 7 hosts.
        ls -l /etc/rc.d/rc.local
        If not executable then ...
        chmod a+x /etc/rc.d/rc.local

	systemctl enable rc-local;systemctl status rc-local

	Add to all Linux hosts 
        (OEL7)
	grep -q 'device/rescan' /etc/rc.d/rc.local || \
	cat <<eof>> /etc/rc.d/rc.local
	[ -f /sys/class/block/sdb/device/rescan ] && \
	echo 1>/sys/class/block/sdb/device/rescan
	[ -f /sys/class/block/sdc/device/rescan ] && \
	echo 1>/sys/class/block/sdc/device/rescan
	[ -f /sys/class/block/sdd/device/rescan ] && \
	echo 1>/sys/class/block/sdd/device/rescan
	[ -f /sys/class/block/sde/device/rescan ] && \
	echo 1>/sys/class/block/sde/device/rescan
	[ -f /sys/class/block/sdf/device/rescan ] && \
	echo 1>/sys/class/block/sdf/device/rescan
	eof

	OEL6
        grep -q 'device/rescan' /etc/rc.local || \
	cat <<eof>>  /etc/rc.local
	[ -f /sys/class/block/sdb/device/rescan ] && \
	echo 1>/sys/class/block/sdb/device/rescan
	[ -f /sys/class/block/sdc/device/rescan ] && \
	echo 1>/sys/class/block/sdc/device/rescan
	[ -f /sys/class/block/sdd/device/rescan ] && \
	echo 1>/sys/class/block/sdd/device/rescan
	[ -f /sys/class/block/sde/device/rescan ] && \
	echo 1>/sys/class/block/sde/device/rescan
	[ -f /sys/class/block/sdf/device/rescan ] && \
	echo 1>/sys/class/block/sdf/device/rescan
	eof
 
        /etc/rc.d/rc.local 



	Scan for new disks ...
	ls -al /sys/class/scsi_host/host?
             <list appears>        
        for h in /sys/class/scsi_host/host?; do echo "- - -" >$h/scan; done
           ls -al /sys/class/scsi_host/host0/scan
           --w------- 1 root root 4096 Apr 29 12:42 /sys/class/scsi_host/host0/scan

	-List all disks (visually eliminate any old disks. The new disk maybe at the bottom)
	lsblk
         lsblk | egrep  -v 'VolGroup01|sda|fd0|sr0'
          and -- eleminate the disks with the size(s) of the original LUN(s)
        fdisk -l | egrep /dev/sd
        -List multipath volumes
	multipath –ll

	-List the physical disks|volumes -- new disk might still not appear;
	pvscan

	-Initialize new disk (update /dev/sd<letter>)
	pvcreate /dev/sd<letter>

	-Add new disk to lvm volume (update /dev/sd<letter>)
	vgextend VolGroup01 /dev/sd<letter>

	-Check status - now the disk should appear AND be in the VolumeGroup.
	pvscan

	-Transfer data to new disk (update /dev/sd<letter>)
	pvmove -v /dev/mapper/cd<letter> /dev/sd<letter>

	-Check status the 'old' disk should have no space used all space sould be free.
                      the 'new' disk should have all the space being used.
	pvscan

	-Remove the old disk (by example:confirm disk path and name)
	vgreduce VolGroup01 /dev/mapper/cd<letter>
        -Remove the lvm label  (by example:confirm disk path and name)
	pvremove /dev/mapper/cd<letter>

	-Check status - the original disk should be gone.
	pvscan

	-List all iscsi connections
	iscsiadm -m session | awk '{printf("iscsiadm -m node -u -T %s -p %s\n",$4,$3)}' | sed -e 's/:32.*//'

	-Script to logout all iscsi sessions
	iscsiadm -m session | awk '{printf("iscsiadm -m node -u -T %s -p %s\n",$4,$3)}' | sed -e 's/:32.*//' | bash

	-Confirm logout9s) were succesful
	iscsiadm -m session

	- Stop and disable iscsi
	systemctl stop iscsi iscsid
	systemctl disable iscsi iscsid
	
	-Rename iscsi config files to prevent loading
	/bin/mv /etc/iscsi/iscsid.conf{,.last}
	/bin/mv /etc/iscsi/initiatorname.iscsi{,.last}
	
	-Rename iscsi network interface file to prevent loading
	cd /etc/sysconfig/network-scripts/
	scsi_iface=$(ip addr | grep 'inet 10.1.' | awk '{print $NF}')
        echo $scsi_iface
	if [ -f /etc/sysconfig/network-scripts/ifcfg-${scsi_iface:=FOO} ]; then
		ifdown ${scsi_iface}
		/bin/mv /etc/sysconfig/network-scripts/ifcfg-${scsi_iface} \
		/etc/sysconfig/network-scripts/_ifcfg-${scsi_iface}
	fi
	
	-Rename iscsi data store to prevent loading
	/bin/mv /var/lib/iscsi{,.last}
	
	-Stop and disable multipathing
	systemctl stop multipathd
	systemctl disable multipathd
	
	-Rename multipath files to prevent loading
	/bin/mv /etc/multipath.conf{,.last}

	cd $HOME

	Notify Amy, Debbie or Kurt to have them deprovision the network adapter and reclaim the storage.
   
On the Task Page, select the magnifying glass next to your name in "Assigned To".  
Put in the email in the top search, then select it from the list.  
Then select the "Update" button on the top right of the page.  

	INFORMATIONAL: Booting to single-user mode
	edit grub and add rd.break to end of linux16 line followed by Ctrl-X
	mount -o remount,rw /sysroot
	chroot /sysroot
	passwd oracle
	Ctrl-D
	reboot


Valid HTML 4.0 Transitional