{"id":1000,"date":"2018-11-22T11:25:58","date_gmt":"2018-11-22T09:25:58","guid":{"rendered":"http:\/\/itsimple.info\/?p=1000"},"modified":"2019-05-29T16:05:45","modified_gmt":"2019-05-29T14:05:45","slug":"how-to-increase-expand-resize-disk-space-on-centos-vm","status":"publish","type":"post","link":"https:\/\/itsimple.info\/?p=1000","title":{"rendered":"How To increase \/ Expand \/Resize Disk Space On CentOS VM"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>First you need to add additional disk space on the host server to the Linux machine, next you can reboot in order to let the operating system recognize the disk size change, to that without reboot you can run :<\/p>\n<pre><code>find \/sys -iname 'scan'   \r\n<\/code><\/pre>\n<pre><code>echo \"- - -\" &gt;\/<\/code>\"the right device you got in the find\r\nfdisk -l (to see the changes)\r\ndf -h  (another way)\r\nor pvdisplay and lvdisplay to see all the partition size<\/pre>\n<p>Then you want to use parted, if you do not have just install it :<\/p>\n<pre><code>yum -y install parted<\/code><\/pre>\n<p>Run Parted To start the program :<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1123\" src=\"https:\/\/itsimple.info\/wp-content\/uploads\/2018\/11\/parted-print-300x118.png\" alt=\"\" width=\"618\" height=\"243\" srcset=\"https:\/\/itsimple.info\/wp-content\/uploads\/2018\/11\/parted-print-300x118.png 300w, https:\/\/itsimple.info\/wp-content\/uploads\/2018\/11\/parted-print-768x302.png 768w, https:\/\/itsimple.info\/wp-content\/uploads\/2018\/11\/parted-print.png 896w\" sizes=\"auto, (max-width: 618px) 100vw, 618px\" \/><\/p>\n<p>Type print to get the partition table information , Then To Extend the disk type :<\/p>\n<pre>(parted)resizepart\r\nSelect the partition number\r\nType the size you want to resize in GB for example to extend the disk to total of 100GB just type 100GB\r\n\r\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-1124\" src=\"https:\/\/itsimple.info\/wp-content\/uploads\/2018\/11\/parted-resize-verify-300x128.png\" alt=\"\" width=\"623\" height=\"266\" srcset=\"https:\/\/itsimple.info\/wp-content\/uploads\/2018\/11\/parted-resize-verify-300x128.png 300w, https:\/\/itsimple.info\/wp-content\/uploads\/2018\/11\/parted-resize-verify-768x327.png 768w, https:\/\/itsimple.info\/wp-content\/uploads\/2018\/11\/parted-resize-verify.png 898w\" sizes=\"auto, (max-width: 623px) 100vw, 623px\" \/><\/pre>\n<p>Next You will need to extend the logical partition<\/p>\n<pre><strong>pvresize \/dev\/sda2<\/strong> -&gt; this resize partion number 2 to max , or relative 40G: pvresize --setphysicalvolumesize 40G \/dev\/sda2<\/pre>\n<p>Then we need to resize the LVM- &gt; run df -h to see the volumes<\/p>\n<pre>\r\n <strong>lvresize -l +100%FREE \/dev\/VolGroup\/lv_root<\/strong>\u00a0\u00a0\u00a0 or the root for example :\u00a0 <strong>lvextend -rl +100%FREE \/dev\/mapper\/centos-root<\/strong><\/pre>\n<p>you might get note after resizing the partition :<\/p>\n<pre><code>Information: You may need to update \/etc\/fstab<\/code><\/pre>\n<p>Run again <strong>pvdisplay<\/strong> and <strong>lvdisplay<\/strong> to see all the partition size , you verify resized Partition with <strong>lsblk :<\/strong><\/p>\n<pre><code>root@test:~# lsblk\r\nNAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT\r\nvda    254:0    0  20G  0 disk \r\n??vda1 254:1    0  20G  0 part \/\r\nvdb    254:16   0  40G  0 disk \r\n??vdb1 254:17   0  40G  0 part <\/code><\/pre>\n<pre><code>\u00a0<\/code><\/pre>\n<p>If the Partition is XFS type you might need to run :<\/p>\n<p><code>root@test:~# xfs_growfs -d \/dev\/mapper\/centos-root<\/p>\n<p>Then Check with<\/p>\n<pre>df -h<\/pre>\n<p><\/code><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<hr \/>\n<h3>\u00a0Good Luck<\/h3>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; First you need to add additional disk space on the host server to the Linux machine, next you can reboot in order to let the operating system recognize the disk size change, to that without reboot you can run : find \/sys -iname &#8216;scan&#8217; echo &#8220;- &#8211; -&#8221; &gt;\/&#8221;the right device you got in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,13,21,12],"tags":[],"class_list":["post-1000","post","type-post","status-publish","format-standard","hentry","category-centos","category-linux","category-operating-systems","category-tutorials"],"_links":{"self":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts\/1000","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1000"}],"version-history":[{"count":0,"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts\/1000\/revisions"}],"wp:attachment":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1000"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1000"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1000"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}