存储进行迁移,Linux层面需要做什么?

背景

系统使用了 Multipath + LVM 给应用提供存储。现在存储方面需要做迁移,要把 LUNs 迁移到其他阵列上。存储层面会通过做 Mirror 的方式,在新的位置创造出数据一致的 LUNs.

这种情况下,Linux 操作系统层面需要做哪些操作来配合? 应用可以down,但是系统不允许重启。

步骤

因为不能重启,为了尽可能减少风险,需要首先从文件系统,LVM, multipath 层面进行清理原有磁盘,存储层面迁移后,再重新扫描新的磁盘、multipath、LVM.

1. Record the current information for future reference.

a. The WWID of the LUNs. (should be different after migration)

  # multipath -ll

b. The UUID of the PVs. (should be unchanged after migration)

  # pvs -v

c. Backup the LVM related metadata.

  # cp -R /etc/lvm/backup </path/to/somewhere/safe/>

2. Stop the application and umount all related filesystems.

  # umount /dev/datavg/<LV>

make sure no related LV are mounted.

  # cat /proc/mounts

3. Deactivate the VG.

  # vgchange -an datavg

4. Export VG, so the VG is unregistered in the system.

  # vgexport datavg

5. Remove multipath devices (mpath*).

a. Check the existing mpath device by multipath -l command. We might see devices like

  mpathr (360000970000494900050533031334446) dm-21 EMC,SYMMETRIX

b. Flush the device. For example,

  # multipath -f mapthr

6. Remove underlaying paths (sd*).

  # echo 1 >  /sys/block/<device-name>/device/delete

is sd* seen from "multipath -ll" in step (1).

Make sure all the related paths (sd*) are deleted, so we won't be confused by the upcoming new paths.

7. Disconnect the LUNs. (in storage side or hardware side)

8. Perform the migration in storage side.

9. Connect the new LUNs. (in storage side or hardware side)

10. Rescan the new disks.

 # /usr/bin/rescan-scsi-bus.sh

11. Rescan the multipath device.

 # multipath

See if you can see the new LUNs as before.

The number of LUNs should be the same (eg. 20), but the WWID should be different.

 # multipath -ll

12. Rescan VG and import VG.

 # vgscan
 # vgimport datavg

13. Activate VG.

 # vgchange -ay datavg

You should see the PV by

 # pvs -v

14. Mount the filesystem back.

 # mount /dev/datavg/<LV>