{"id":6610,"date":"2016-06-14T23:15:05","date_gmt":"2016-06-14T15:15:05","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=6610"},"modified":"2023-04-28T09:47:07","modified_gmt":"2023-04-28T09:47:07","slug":"migrate-lvm-or-volume-group-to-new-linux","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/migrate-lvm-or-volume-group-to-new-linux\/","title":{"rendered":"How to Migrate LVM or Volume Group to New Linux Server"},"content":{"rendered":"<p><img decoding=\"async\" class=\"alignnone wp-image-6674 size-full lazyload\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/06\/How-to-Migrate-LVM-or-Volume-Group-to-New-Linux-Server.jpg\" alt=\"Migrate LVM\" width=\"1920\" height=\"1357\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/06\/How-to-Migrate-LVM-or-Volume-Group-to-New-Linux-Server.jpg 1920w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/06\/How-to-Migrate-LVM-or-Volume-Group-to-New-Linux-Server-300x212.jpg 300w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/06\/How-to-Migrate-LVM-or-Volume-Group-to-New-Linux-Server-768x543.jpg 768w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/06\/How-to-Migrate-LVM-or-Volume-Group-to-New-Linux-Server-1024x724.jpg 1024w\" data-sizes=\"(max-width: 1920px) 100vw, 1920px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1920px; --smush-placeholder-aspect-ratio: 1920\/1357;\" \/>This article will describe on how to move or migrate LVM and volume group from one server to another.<\/p>\n<p>If you are working in a production environment then you have to know about the software disk management and all the methods to provide flexibility in storage management.<\/p>\n<p>LVM stand for logical volume management. It is a tool to manage and provides a higher-level view of the disk storage.<\/p>\n<p>Below tutorial will be very useful for system administrators who have problems on the linux operating system and want to mount the mounted partition to other systems.<\/p>\n<p>This should be the most simple recovery strategy if we run Linux in VMware virtual machines.<\/p>\n<p>Migrating LVM or Volume Group to new server should be the fastest way to access the important linux partition that may contains user&#8217;s data or important configuration files.<\/p>\n<h2>How to Migrate LVM or Volume Group to New Server<\/h2>\n<p>1. Add vdisk to new virtual machine.<\/p>\n<p>a) Click &#8220;Add&#8221; to proceed :<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-6614 size-full lazyload\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-1.png\" alt=\"Migrate LVM\" width=\"356\" height=\"524\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-1.png 356w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-1-204x300.png 204w\" data-sizes=\"(max-width: 356px) 100vw, 356px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 356px; --smush-placeholder-aspect-ratio: 356\/524;\" \/><\/p>\n<p>b) Select &#8220;Hard Disk&#8221; device type :<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-6615 size-full lazyload\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-2.png\" alt=\"Migrate LVM\" width=\"638\" height=\"497\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-2.png 638w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-2-300x234.png 300w\" data-sizes=\"(max-width: 638px) 100vw, 638px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 638px; --smush-placeholder-aspect-ratio: 638\/497;\" \/><\/p>\n<p>c) Please choose &#8220;Use and existing virtual disk&#8221; :<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-6616 size-full lazyload\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-3.png\" alt=\"Migrate LVM\" width=\"637\" height=\"494\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-3.png 637w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-3-300x233.png 300w\" data-sizes=\"(max-width: 637px) 100vw, 637px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 637px; --smush-placeholder-aspect-ratio: 637\/494;\" \/><\/p>\n<p>d) Browse to vdisk location :<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-6617 size-full lazyload\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-4.png\" alt=\"Migrate LVM\" width=\"644\" height=\"501\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-4.png 644w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-4-300x233.png 300w\" data-sizes=\"(max-width: 644px) 100vw, 644px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 644px; --smush-placeholder-aspect-ratio: 644\/501;\" \/><\/p>\n<p>e) Click Next to proceed :<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-6618 size-full lazyload\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-5.png\" alt=\"Migrate LVM\" width=\"644\" height=\"500\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-5.png 644w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-5-300x233.png 300w\" data-sizes=\"(max-width: 644px) 100vw, 644px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 644px; --smush-placeholder-aspect-ratio: 644\/500;\" \/><\/p>\n<p>f) Click finish :<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-6619 size-full lazyload\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-6.png\" alt=\"Migrate LVM\" width=\"640\" height=\"499\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-6.png 640w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-6-300x234.png 300w\" data-sizes=\"(max-width: 640px) 100vw, 640px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 640px; --smush-placeholder-aspect-ratio: 640\/499;\" \/><\/p>\n<p>g) Finally click &#8220;OK&#8221; to complete :<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-6620 size-full lazyload\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-7.png\" alt=\"Migrate LVM\" width=\"695\" height=\"598\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-7.png 695w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/02\/add-LVM-to-new-server-7-300x258.png 300w\" data-sizes=\"(max-width: 695px) 100vw, 695px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 695px; --smush-placeholder-aspect-ratio: 695\/598;\" \/><\/p>\n<p>2. Once the vdisk as been added to new Linux server, please proceed to rescan the linux VM.<\/p>\n<p>a) Identify host bus number :<\/p>\n<pre># ls \/sys\/class\/scsi_host\/\nhost0  host1  host2\n<\/pre>\n<p>b) Rescan the SCSI Bus to Add a SCSI Devices :<\/p>\n<pre># echo \"- - -\" &gt; \/sys\/class\/scsi_host\/host0\/scan\n# echo \"- - -\" &gt; \/sys\/class\/scsi_host\/host1\/scan\n# echo \"- - -\" &gt; \/sys\/class\/scsi_host\/host2\/scan\n<\/pre>\n<p>3. Check the new disk. The second vdisk by default will be recognised as \/dev\/sdb. Since the partition type has been formatted as LVM on the previous system, it will show Id &#8220;8e&#8221; if you run fdisk command.<\/p>\n<pre># fdisk -l\n..\n..\n\nDisk \/dev\/sdb: 10.7 GB, 10737418240 bytes\n255 heads, 63 sectors\/track, 1305 cylinders\nUnits = cylinders of 16065 * 512 = 8225280 bytes\nSector size (logical\/physical): 512 bytes \/ 512 bytes\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\nDisk identifier: 0xce931872\n\n   Device Boot      Start         End      Blocks   Id  System\n\/dev\/sdb1               1        1305    10482381   8e  Linux LVM\n<\/pre>\n<p>There are two method to register and activate the LVM and volume group into new linux server. Proceed to steps 4 &#8211; 9 for Method 1. Go to step 10 for Method 2.<\/p>\n<p>4. Use lvscan to scans all known volume groups or all supported LVM block devices in the system for defined Logical Volumes. The output consists of one line for each Logical Volume indicating whether it is active or inactive :<\/p>\n<pre># lvscan\n  inactive          '\/dev\/vg_newlvm\/newvol' [9.99 GiB] inherit\n  ACTIVE            '\/dev\/vg_centos66\/lv_root' [30.00 GiB] inherit\n  ACTIVE            '\/dev\/vg_centos66\/lv_swap' [8.00 GiB] inherit\n<\/pre>\n<p>5. Check existing volume group and logical volume:<\/p>\n<pre># vgscan\n  Reading all physical volumes.  This may take a while...\n  Found volume group \"vg_newlvm\" using metadata type lvm2\n  Found volume group \"vg_centos66\" using metadata type lvm2\n<\/pre>\n<p>One of the logical volume in &#8220;vg_newlvm&#8221; volume group still inactive status.<\/p>\n<pre># lvscan\ninactive '\/dev\/vg_newlvm\/newvol' [9.99 GiB] inherit\nACTIVE '\/dev\/vg_centos66\/lv_root' [17.51 GiB] inherit\nACTIVE '\/dev\/vg_centos66\/lv_swap' [2.00 GiB] inherit\n<\/pre>\n<p>6. Export the volume group &#8220;vg_newlvm&#8221; :<\/p>\n<pre># vgexport vg_newlvm\nVolume group \"vg_newlvm\" successfully exported\n<\/pre>\n<p>7. Then import volume group &#8220;vg_newlvm&#8221;:<\/p>\n<pre># vgimport vg_newlvm\nVolume group \"vg_newlvm\" successfully imported\n<\/pre>\n<p>8. To activate volume groups &#8220;vg_newlvm&#8221;, run the following command :<\/p>\n<pre># vgchange -ay vg_newlvm\n1 logical volume(s) in volume group \"vg_newlvm\" now active\n<\/pre>\n<p>9. Check again updated logical volume and volume group status :<\/p>\n<pre># lvscan\n  ACTIVE            '\/dev\/vg_newlvm\/newvol' [9.99 GiB] inherit\n  ACTIVE            '\/dev\/vg_centos66\/lv_root' [17.51 GiB] inherit\n  ACTIVE            '\/dev\/vg_centos66\/lv_swap' [2.00 GiB] inherit\n<\/pre>\n<p>Method 2 :<\/p>\n<p>10. The fastest method to activate the migrated LVM or Volume Group are as below :<\/p>\n<pre># lvscan\ninactive '\/dev\/vg_newlvm\/newvol' [9.99 GiB] inherit\nACTIVE '\/dev\/vg_centos66\/lv_root' [17.51 GiB] inherit\nACTIVE '\/dev\/vg_centos66\/lv_swap' [2.00 GiB] inherit\n<\/pre>\n<p>Use lvchange command to activate the LVM.<\/p>\n<pre># lvchange -ay \/dev\/vg_newlvm\/newvol\n<\/pre>\n<pre># lvscan\nACTIVE '\/dev\/vg_newlvm\/newvol' [9.99 GiB] inherit\nACTIVE '\/dev\/vg_centos66\/lv_root' [17.51 GiB] inherit\nACTIVE '\/dev\/vg_centos66\/lv_swap' [2.00 GiB] inherit\n<\/pre>\n<p>11. Create \/data folder :<\/p>\n<pre># mkdir -p \/data\n<\/pre>\n<p>12. Mount the migrated LVM to \/data<\/p>\n<pre># mount \/dev\/vg_newlvm\/newvol \/data\n<\/pre>\n<p>13. Verify \/date to use migrated LVM :<\/p>\n<pre># df -lh\nFilesystem            Size  Used Avail Use% Mounted on\n\/dev\/mapper\/vg_centos66-lv_root\n                       18G  5.2G   12G  32% \/\ntmpfs                 939M     0  939M   0% \/dev\/shm\n\/dev\/sda1             477M   67M  385M  15% \/boot\n\/dev\/mapper\/vg_newlvm-newvol\n                      9.8G   32M  9.2G   1% \/data\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This article will describe on how to move or migrate LVM and volume group from one server to another. If you are working in a production environment then you have&#8230;<\/p>\n","protected":false},"author":6,"featured_media":6674,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[1002],"tags":[1536,1556],"class_list":["post-6610","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-lvm","tag-linux","tag-lvm"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/6610","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=6610"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/6610\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/6674"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=6610"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=6610"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=6610"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}