• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

CentOS / RHEL : How to migrate storage (LVM) with pvmove Command

by admin

Solution:
Existing Configuration :

Existing Physical Volume: 1.5 TB, /dev/mapper/mpathX
Existing Volume Group: data_vg
Existing Logical Volume: lv_data01 (/dev/mapper/data_vg-lv_data01)

We need to move to the following configuration :

Physical Volume: 1.5TB, /dev/mapper/mpathY
Volume Group: data_vg
Logical Volume: data (/dev/mapper/data_vg-lv_data01)
Note: Please take complete backup before performing the storage migration

Steps

1. Begin by pvcreate’ing the new disk. This is the disk from the new storage array to which we want to migrate to.

# pvcreate /dev/mapper/mpathY

2. Now, add this disk into the data_vg Volume Group :

# vgextend data_vg /dev/mapper/mpathY

Make sure there are free extents on the new disk, before running pvmove

3. Begin the migration from the /dev/mapper/mpathX PV to the new /dev/mapper/mpathY PV

# pvmove -b /dev/mapper/mpathX /dev/mapper/mpathY

This will take time based on size to complete the activity. -b option in the command above runs the pvmove command in background.

4. Periodically, you can check the progress of the migration, Make sure you’re looking in the “Copy%” column for the LV and VG that you’re working with.

# lvs -a -o+devices

When the migration is completely finished, you will know because the “Copy%” column will no longer register a value for the LV and VG that you’re working in.

You may also run pvmove -iX , where X is an interval in seconds to report the progress. For example, pvmove -i5 will report progress every 5 seconds.

5. Now, you can safely remove the original PV from the VG.

# vgreduce oracleprod /dev/mapper/mpathX
# pvremove /dev/mapper/mpathX

Filed Under: Linux

Some more articles you might also be interested in …

  1. Beginners Guide to User and Group Administration in Linux
  2. wc Command Examples in Linux
  3. rm: cannot remove ‘doc/by-app’: Function not implemented (CentOS/RHEL 7)
  4. How to clear the buffer/pagecache (disk cache) under Linux
  5. Linux OS Service ‘NetworkManager’
  6. 6 Bash Shell Command Line Chaining Operators in Linux
  7. UNIX / Linux : How to delete root equivalent user (Non-Root User with UID 0)
  8. lsb_release Command Examples in Linux
  9. How to Verify if a Disk/Partition is in Use by Oracle ASM, was used by Oracle ASM or is never used by Oracle ASM
  10. Linux OS Service ‘NetFS’

You May Also Like

Primary Sidebar

Recent Posts

  • JavaFX ComboBox: Set a value to the combo box
  • Nginx load balancing
  • nginx 504 gateway time-out
  • Images preview with ngx_http_image_filter_module

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright