{"id":4941,"date":"2026-08-29T23:50:34","date_gmt":"2026-08-29T14:50:34","guid":{"rendered":"https:\/\/donguri3.net\/server-tech\/modify-lvm-centos7-home-to-root-2\/"},"modified":"2026-08-29T23:50:35","modified_gmt":"2026-08-29T14:50:35","slug":"modify-lvm-centos7-home-to-root","status":"publish","type":"post","link":"https:\/\/donguri3.net\/en\/server-tech\/linux-server-network\/modify-lvm-centos7-home-to-root\/","title":{"rendered":"Changing the CentOS 7 LVM Configuration: Delete \/home and Expand \/"},"content":{"rendered":"<p>When installing CentOS 7, the default settings use LVM to split the storage into \/ (root) and \/home. This time, although we were utilizing the lvm home volume as storage for Docker, upon closer organization, we realized that it wasn&#8217;t occupying that much space and decided that there was no special need to keep the home volume separate.<\/p>\n<p>Therefore, we performed the procedure to delete the home volume&#8217;s logical volume and integrate that freed-up space into the \/ volume.<\/p>\n<h2>Current Partition Configuration<\/h2>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># lsblk\nNAME              MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT\nsda                 8:0    0   238.5G  0 disk\n\u251c\u2500sda1              8:1    0   500M  0 part \/boot\n\u2514\u2500sda2              8:2    0   238G  0 part\n  \u251c\u2500centos-root   253:0    0    50G  0 lvm  \/\n  \u251c\u2500centos-swap   253:1    0   7.7G  0 lvm  &#x5B;SWAP]\n  \u2514\u2500centos-home   253:2    0 180.2G  0 lvm  \/var\/lib\/docker\/vfs<\/pre>\n<h2>LVM Logical Volumes<\/h2>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># lvs\n  LV   VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert\n  home centos -wi-a----- 180.23g\n  root centos -wi-ao----  50.00g\n  swap centos -wi-ao----  &lt;7.69g<\/pre>\n<h2>Steps to Delete \/home and Expand \/<\/h2>\n<h3>Back up \/home Data<\/h3>\n<p>If there is important data in \/home, please back it up in advance. In our case, since only Docker images were stored there, we did not create a backup.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ tar -cvzf \/root\/home_backup.tar.gz \/home<\/pre>\n<h3>Unmount \/home<\/h3>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ umount \/home<\/pre>\n<p>If you cannot unmount the directory, check for any processes currently using it and stop them as necessary.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ lsof +D \/home\n$ systemctl stop docker  # If Docker is using it<\/pre>\n<h3>Delete the centos-home Logical Volume<\/h3>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># lvremove \/dev\/centos\/home\nDo you really want to remove active logical volume centos\/home? &#x5B;y\/n]: y\nLogical volume &quot;home&quot; successfully removed$ lvremove \/dev\/centos\/home<\/pre>\n<p>When the confirmation message appears, type y to delete it.<\/p>\n<h3>Check Volume Group Free Space<\/h3>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># vgdisplay centos\n  --- Volume group ---\n  VG Name               centos\n  System ID\n  Format                lvm2\n  Metadata Areas        1\n  Metadata Sequence No  6\n  VG Access             read\/write\n  VG Status             resizable\n  MAX LV                0\n  Cur LV                2\n  Open LV               2\n  Max PV                0\n  Cur PV                1\n  Act PV                1\n  VG Size               237.98 GiB\n  PE Size               4.00 MiB\n  Total PE              60924\n  Alloc PE \/ Size       14768 \/ &lt;57.69 GiB\n  Free  PE \/ Size       46156 \/ &lt;180.30 GiB\n  VG UUID               FEeX6Q-XXX<\/pre>\n<p>Verify that the free space after deleting \/home is displayed under Free PE \/ Size.<\/p>\n<h3>Expand the \/ Logical Volume<\/h3>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># lvextend -l +100%FREE \/dev\/centos\/root\n  Size of logical volume centos\/root changed from 50.00 GiB (12800 extents) to &amp;lt;230.30 GiB (58956 extents).\n  Logical volume centos\/root successfully resized.<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># vgdisplay centos\n  --- Volume group ---\n  VG Name               centos\n  System ID\n  Format                lvm2\n  Metadata Areas        1\n  Metadata Sequence No  7\n  VG Access             read\/write\n  VG Status             resizable\n  MAX LV                0\n  Cur LV                2\n  Open LV               2\n  Max PV                0\n  Cur PV                1\n  Act PV                1\n  VG Size               237.98 GiB\n  PE Size               4.00 MiB\n  Total PE              60924\n  Alloc PE \/ Size       60924 \/ 237.98 GiB\n  Free  PE \/ Size       0 \/ 0\n  VG UUID               FEeX6Q-XXX<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># lvs\n  LV   VG     Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert\n  root centos -wi-ao---- &lt;230.30g\n  swap centos -wi-ao----   &lt;7.69g<\/pre>\n<h3>Expand the File System<\/h3>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># xfs_growfs \/\nmeta-data=\/dev\/mapper\/centos-root isize=256    agcount=4, agsize=3276800 blks\n         =                       sectsz=512   attr=2, projid32bit=1\n         =                       crc=0        finobt=0 spinodes=0\ndata     =                       bsize=4096   blocks=13107200, imaxpct=25\n         =                       sunit=0      swidth=0 blks\nnaming   =version 2              bsize=4096   ascii-ci=0 ftype=0\nlog      =internal               bsize=4096   blocks=6400, version=2\n         =                       sectsz=512   sunit=0 blks, lazy-count=1\nrealtime =none                   extsz=4096   blocks=0, rtextents=0\ndata blocks changed from 13107200 to 60370944<\/pre>\n<h3>7. Verification<\/h3>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># df -h\n\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9            \u30b5\u30a4\u30ba  \u4f7f\u7528  \u6b8b\u308a \u4f7f\u7528% \u30de\u30a6\u30f3\u30c8\u4f4d\u7f6e\n\/dev\/mapper\/centos-root   231G   32G  200G   14% \/\n\/dev\/sda1                 497M  466M   32M   94% \/boot<\/pre>\n<p>Verify that the capacity of \/ has been expanded.<\/p>\n<h2>Conclusion<\/h2>\n<p>While default CentOS 7 installations often allocate a large amount of space to \/home, if you do not actually need a separate \/home partition in your operational environment, deleting \/home and integrating it into \/ like we did here allows you to utilize your storage more efficiently.<\/p>\n<p>Leveraging LVM enables flexible partition management, so reviewing your configuration according to your environment is also important.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When installing CentOS 7, the default settings use LVM to split the storage into \/ (root) and \/home. This time [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":1101,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"en_US","_original_post":"https:\/\/donguri3.net\/?p=562","footnotes":""},"categories":[1170],"tags":[18,105,10,251],"class_list":["post-4941","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux-server-network","tag-docker","tag-linux","tag-server","tag-251","en-US"],"_links":{"self":[{"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/posts\/4941","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/comments?post=4941"}],"version-history":[{"count":1,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/posts\/4941\/revisions"}],"predecessor-version":[{"id":4944,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/posts\/4941\/revisions\/4944"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/media\/1101"}],"wp:attachment":[{"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/media?parent=4941"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/categories?post=4941"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/tags?post=4941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}