{"id":476,"date":"2019-05-13T21:27:58","date_gmt":"2019-05-13T21:27:58","guid":{"rendered":"https:\/\/unsrewiki.1sys1.com\/?p=476"},"modified":"2023-05-19T16:45:23","modified_gmt":"2023-05-19T16:45:23","slug":"moving-partitions-between-drives","status":"publish","type":"post","link":"https:\/\/server-help.org\/index.php\/2019\/05\/13\/moving-partitions-between-drives\/","title":{"rendered":"Moving partitions between drives"},"content":{"rendered":"\n<p>In this guide we will show you how to move your partition from an HDD to SSD or vice versa.<\/p>\n\n\n\n<p>We will assume that you currently have a Dedicated server which contains multiple drives.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@u18162509 ~]# df -h\nFilesystem            Size  Used Avail Use% Mounted on\n\/dev\/sda1             4.0G  2.9G  1.1G  73% \/\n\/dev\/mapper\/vg00-usr  4.8G  4.8G     0 100% \/usr\n\/dev\/mapper\/vg00-var  201G  184G  8.3G  96% \/var\n\/dev\/mapper\/vg00-home\n                      4.8G   10M  4.6G   1% \/home\n\/dev\/mapper\/hdd-data  3.9G  8.0M  3.7G   1% \/data\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@u18162509 \/]# pvs\n  PV         VG   Fmt  Attr PSize   PFree\n  \/dev\/sda3  vg00 lvm2 a--u 216.99g    0\n  \/dev\/sdb1  hdd  lvm2 a--u   3.42t 3.42t<\/code><\/pre>\n\n\n\n<p>As you can see there are 2 separate volumes named vg00 and hdd.<\/p>\n\n\n\n<p>Going forward you have 2 options.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Option 1). Your server only contains drives of a similar speed (HDD). <\/h2>\n\n\n\n<p>1). vi \/etc\/fstab, remove the following line.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/dev\/hdd\/data   \/data           ext4    defaults,usrquota,noatime       0 2<\/code><\/pre>\n\n\n\n<p>2). umount \/data<\/p>\n\n\n\n<p>3). lvremove \/dev\/hdd\/data<\/p>\n\n\n\n<p>4). vgmerge vg00 hdd<\/p>\n\n\n\n<p>5). pvs<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@u18162509 \/]# pvs\n  PV         VG   Fmt  Attr PSize   PFree\n  \/dev\/sda3  vg00 lvm2 a--u 216.99g    0\n  \/dev\/sdb1  vg00 lvm2 a--u   3.42t 3.42t<\/code><\/pre>\n\n\n\n<p>6). lvextend -L +5G \/dev\/mapper\/vg00-usr<\/p>\n\n\n\n<p>7). resize2fs \/dev\/mapper\/vg00-usr<\/p>\n\n\n\n<p>8). df -h<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@u18162509 \/]# df -h\nFilesystem            Size  Used Avail Use% Mounted on\n\/dev\/sda1             4.0G  2.9G  1.2G  72% \/\n\/dev\/mapper\/vg00-usr   10G  4.8G  5.4G  48% \/usr\n\/dev\/mapper\/vg00-var  201G  184G  8.3G  96% \/var\n\/dev\/mapper\/vg00-home\n                      4.8G   10M  4.6G   1% \/home\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Option 2). One drive is faster (SSD) then the large main drive (HDD).<\/h2>\n\n\n\n<p>On servers with drives of different performance levels we do not want to merge the volumes. Instead we will copy a partition from the smaller drive to the larger one (SSD to HDD). In this example we will be migrating \/var<\/p>\n\n\n\n<p>1). Reboot into Linux rescue<\/p>\n\n\n\n<p>2). Mount your partitions to \/mnt<\/p>\n\n\n\n<p>3). rsync -avxHAX &#8211;progress \/mnt\/var\/ \/mnt\/data\/<\/p>\n\n\n\n<p>4). vi \/mnt\/etc\/fstab<\/p>\n\n\n\n<p>Remove:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/dev\/hdd\/data   \/data           ext4    defaults,usrquota,noatime       0 2<\/code><\/pre>\n\n\n\n<p>Edit:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/dev\/hdd\/data   \/var            ext4    defaults,usrquota,noatime       0 2<\/code><\/pre>\n\n\n\n<p>5). Reboot back into local.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide we will show you how to move your partition from an HDD to SSD or vice versa. We will assume that you currently have a Dedicated server which contains multiple drives. As you can see there are 2 separate volumes named vg00 and hdd. Going forward you have 2 options. Option 1).&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,1],"tags":[],"_links":{"self":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts\/476"}],"collection":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/comments?post=476"}],"version-history":[{"count":5,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts\/476\/revisions"}],"predecessor-version":[{"id":917,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts\/476\/revisions\/917"}],"wp:attachment":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/media?parent=476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/categories?post=476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/tags?post=476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}