DISK or LUN migration to new server with LVM/File systems without loosing the File system Layout and Data, can be implemented in Linux with a sequence simple steps.
Though not necessary, backup existing data as a precaution, especially if you’re migrating a production Volume.
#check if file system is being used. If these commands does not produce any result, that indicates that the file system is not being held by any processes. lsof /opt/myapps fuser -cu /opt/myapps #unmount File system umount /opt/myapps #deactivate and export VG vgchange -an mydata_vg vgexport mydata_vg #Remove the filesystem entry from /etc/fstab file. #Shut down the current system. #remove LUNS presented to Source server (From storage end)
#Run a LUN scan
cd /sys/class/scsi_host && for HOST in `ls`; do echo "- - -" > ${HOST}/scan;done
#Check if the LUNS are available
cat /proc/scsi/scsi
#Import the VG on a destination server.
vgimport mydata_vg
#Activate the VG on a destination server
vgchange -ay mydata_vg
#Run below commands to scan for Changes in PV,VG and LV and verify if they are available.
pvscan
vgscan
lvscan
pvs
vgs
lvs
#Crosscheck if LV is activated on the destination server.
#Add filesystem entry to /etc/fstab file.
#Mount the filesystems.
mount -a
#Crosscheck whether it is mounted or not.
df -Th










