{"id":149,"date":"2019-10-19T22:50:00","date_gmt":"2019-10-19T22:50:00","guid":{"rendered":"http:\/\/snehpatel.com\/?p=149"},"modified":"2019-10-19T22:50:00","modified_gmt":"2019-10-19T22:50:00","slug":"centos-resize-home-directory-to-increase-directory","status":"publish","type":"post","link":"https:\/\/snehpatel.com\/index.php\/2019\/10\/19\/centos-resize-home-directory-to-increase-directory\/","title":{"rendered":"CentOS resize \/home directory to increase \/ directory"},"content":{"rendered":"\n\t\t\t\t\n<p>On my previous projects, I used the default installation settings for centos. But after some heavy usage getting logs from all networking devices. \/ directory started getting full and that struck the realization to resize the \/home directory to get more space. (Dumb random command: df -h).<\/p>\n\n\n\n<p> Before starting, the mount point name would be different depending on your installation. So be careful before applying to on production machine. <\/p>\n\n\n\n<p>NOTE: Check \/etc\/fstab file to verify the \/home entry is in the file. If its UUID of the device note that ID. You will need to change the UUID at the end of this process as the reconstruction of logical volume will create new UUID. And if it contents the location of device you don&#8217;t need to worry about this<\/p>\n\n\n\n<p>NOTE: You need root account to perform steps below<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>First, let&#8217;s take a backup of your home directory as we will delete the mount point completely.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>tar\u00a0-czvf\u00a0\/root\/home.tgz\u00a0-C\u00a0\/home\u00a0.<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>Test your backup<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>tar -tvf \/root\/home.tgz<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>Unmount the logical volume home<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>umount \/dev\/mapper\/centos-home<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>Remove home logical volume <\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>lvremove \/dev\/mapper\/centos-home<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>Now create a new home directory with reduces size. Here is kept 40GB. <\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>lvcreate -L 40GB -n home centos<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>Let&#8217;s construct newly created logical volume with XFS filesystem<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>mkfs.xfs \/dev\/centos\/home<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>Mount the volume back to \/home point<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>mount \/dev\/mapper\/centos-home<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>Now extend the root directory using the free space we created by reconstructing \/home volume<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>lvextend -r -l +100%FREE \/dev\/mapper\/centos-root<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>Use a previously created backup to put important files to its place <\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>tar -xzvf \/root\/home.tgz -C \/home<\/code><\/pre>\n\t\t","protected":false},"excerpt":{"rendered":"<p>On my previous projects, I used the default installation settings for centos. But after some heavy usage getting logs from all networking devices. \/ directory started getting full and that struck the realization to resize the \/home directory to get more space. (Dumb random command: df -h). Before starting, the mount point name would be &#8230; <a title=\"CentOS resize \/home directory to increase \/ directory\" class=\"read-more\" href=\"https:\/\/snehpatel.com\/index.php\/2019\/10\/19\/centos-resize-home-directory-to-increase-directory\/\" aria-label=\"Read more about CentOS resize \/home directory to increase \/ directory\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[17,9],"tags":[26,34],"class_list":["post-149","post","type-post","status-publish","format-standard","hentry","category-linux","category-systme","tag-disk","tag-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>CentOS resize \/home directory to increase \/ directory - Sneh Patel<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/snehpatel.com\/index.php\/2019\/10\/19\/centos-resize-home-directory-to-increase-directory\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CentOS resize \/home directory to increase \/ directory - Sneh Patel\" \/>\n<meta property=\"og:description\" content=\"On my previous projects, I used the default installation settings for centos. But after some heavy usage getting logs from all networking devices. \/ directory started getting full and that struck the realization to resize the \/home directory to get more space. (Dumb random command: df -h). Before starting, the mount point name would be ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/snehpatel.com\/index.php\/2019\/10\/19\/centos-resize-home-directory-to-increase-directory\/\" \/>\n<meta property=\"og:site_name\" content=\"Sneh Patel\" \/>\n<meta property=\"article:published_time\" content=\"2019-10-19T22:50:00+00:00\" \/>\n<meta name=\"author\" content=\"Sneh Patel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sneh Patel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/snehpatel.com\\\/index.php\\\/2019\\\/10\\\/19\\\/centos-resize-home-directory-to-increase-directory\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/snehpatel.com\\\/index.php\\\/2019\\\/10\\\/19\\\/centos-resize-home-directory-to-increase-directory\\\/\"},\"author\":{\"name\":\"Sneh Patel\",\"@id\":\"https:\\\/\\\/snehpatel.com\\\/#\\\/schema\\\/person\\\/a39105bc63f7e11a0e07b12a4c3dda73\"},\"headline\":\"CentOS resize \\\/home directory to increase \\\/ directory\",\"datePublished\":\"2019-10-19T22:50:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/snehpatel.com\\\/index.php\\\/2019\\\/10\\\/19\\\/centos-resize-home-directory-to-increase-directory\\\/\"},\"wordCount\":230,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/snehpatel.com\\\/#\\\/schema\\\/person\\\/a39105bc63f7e11a0e07b12a4c3dda73\"},\"keywords\":[\"Disk\",\"Linux\"],\"articleSection\":[\"Linux\",\"System\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/snehpatel.com\\\/index.php\\\/2019\\\/10\\\/19\\\/centos-resize-home-directory-to-increase-directory\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/snehpatel.com\\\/index.php\\\/2019\\\/10\\\/19\\\/centos-resize-home-directory-to-increase-directory\\\/\",\"url\":\"https:\\\/\\\/snehpatel.com\\\/index.php\\\/2019\\\/10\\\/19\\\/centos-resize-home-directory-to-increase-directory\\\/\",\"name\":\"CentOS resize \\\/home directory to increase \\\/ directory - Sneh Patel\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/snehpatel.com\\\/#website\"},\"datePublished\":\"2019-10-19T22:50:00+00:00\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/snehpatel.com\\\/index.php\\\/2019\\\/10\\\/19\\\/centos-resize-home-directory-to-increase-directory\\\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/snehpatel.com\\\/#website\",\"url\":\"https:\\\/\\\/snehpatel.com\\\/\",\"name\":\"Sneh Patel\",\"description\":\"Cyber Security Blog\",\"publisher\":{\"@id\":\"https:\\\/\\\/snehpatel.com\\\/#\\\/schema\\\/person\\\/a39105bc63f7e11a0e07b12a4c3dda73\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/snehpatel.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/snehpatel.com\\\/#\\\/schema\\\/person\\\/a39105bc63f7e11a0e07b12a4c3dda73\",\"name\":\"Sneh Patel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/i0.wp.com\\\/snehpatel.com\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/cropped-Slide4-1.jpg?fit=672%2C222&ssl=1\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/snehpatel.com\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/cropped-Slide4-1.jpg?fit=672%2C222&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/snehpatel.com\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/cropped-Slide4-1.jpg?fit=672%2C222&ssl=1\",\"width\":672,\"height\":222,\"caption\":\"Sneh Patel\"},\"logo\":{\"@id\":\"https:\\\/\\\/i0.wp.com\\\/snehpatel.com\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/cropped-Slide4-1.jpg?fit=672%2C222&ssl=1\"},\"sameAs\":[\"http:\\\/\\\/snehpatel.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"CentOS resize \/home directory to increase \/ directory - Sneh Patel","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/snehpatel.com\/index.php\/2019\/10\/19\/centos-resize-home-directory-to-increase-directory\/","og_locale":"en_US","og_type":"article","og_title":"CentOS resize \/home directory to increase \/ directory - Sneh Patel","og_description":"On my previous projects, I used the default installation settings for centos. But after some heavy usage getting logs from all networking devices. \/ directory started getting full and that struck the realization to resize the \/home directory to get more space. (Dumb random command: df -h). Before starting, the mount point name would be ... Read more","og_url":"https:\/\/snehpatel.com\/index.php\/2019\/10\/19\/centos-resize-home-directory-to-increase-directory\/","og_site_name":"Sneh Patel","article_published_time":"2019-10-19T22:50:00+00:00","author":"Sneh Patel","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Sneh Patel","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/snehpatel.com\/index.php\/2019\/10\/19\/centos-resize-home-directory-to-increase-directory\/#article","isPartOf":{"@id":"https:\/\/snehpatel.com\/index.php\/2019\/10\/19\/centos-resize-home-directory-to-increase-directory\/"},"author":{"name":"Sneh Patel","@id":"https:\/\/snehpatel.com\/#\/schema\/person\/a39105bc63f7e11a0e07b12a4c3dda73"},"headline":"CentOS resize \/home directory to increase \/ directory","datePublished":"2019-10-19T22:50:00+00:00","mainEntityOfPage":{"@id":"https:\/\/snehpatel.com\/index.php\/2019\/10\/19\/centos-resize-home-directory-to-increase-directory\/"},"wordCount":230,"commentCount":0,"publisher":{"@id":"https:\/\/snehpatel.com\/#\/schema\/person\/a39105bc63f7e11a0e07b12a4c3dda73"},"keywords":["Disk","Linux"],"articleSection":["Linux","System"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/snehpatel.com\/index.php\/2019\/10\/19\/centos-resize-home-directory-to-increase-directory\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/snehpatel.com\/index.php\/2019\/10\/19\/centos-resize-home-directory-to-increase-directory\/","url":"https:\/\/snehpatel.com\/index.php\/2019\/10\/19\/centos-resize-home-directory-to-increase-directory\/","name":"CentOS resize \/home directory to increase \/ directory - Sneh Patel","isPartOf":{"@id":"https:\/\/snehpatel.com\/#website"},"datePublished":"2019-10-19T22:50:00+00:00","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/snehpatel.com\/index.php\/2019\/10\/19\/centos-resize-home-directory-to-increase-directory\/"]}]},{"@type":"WebSite","@id":"https:\/\/snehpatel.com\/#website","url":"https:\/\/snehpatel.com\/","name":"Sneh Patel","description":"Cyber Security Blog","publisher":{"@id":"https:\/\/snehpatel.com\/#\/schema\/person\/a39105bc63f7e11a0e07b12a4c3dda73"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/snehpatel.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/snehpatel.com\/#\/schema\/person\/a39105bc63f7e11a0e07b12a4c3dda73","name":"Sneh Patel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/i0.wp.com\/snehpatel.com\/wp-content\/uploads\/2020\/09\/cropped-Slide4-1.jpg?fit=672%2C222&ssl=1","url":"https:\/\/i0.wp.com\/snehpatel.com\/wp-content\/uploads\/2020\/09\/cropped-Slide4-1.jpg?fit=672%2C222&ssl=1","contentUrl":"https:\/\/i0.wp.com\/snehpatel.com\/wp-content\/uploads\/2020\/09\/cropped-Slide4-1.jpg?fit=672%2C222&ssl=1","width":672,"height":222,"caption":"Sneh Patel"},"logo":{"@id":"https:\/\/i0.wp.com\/snehpatel.com\/wp-content\/uploads\/2020\/09\/cropped-Slide4-1.jpg?fit=672%2C222&ssl=1"},"sameAs":["http:\/\/snehpatel.com"]}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/snehpatel.com\/index.php\/wp-json\/wp\/v2\/posts\/149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/snehpatel.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/snehpatel.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/snehpatel.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/snehpatel.com\/index.php\/wp-json\/wp\/v2\/comments?post=149"}],"version-history":[{"count":0,"href":"https:\/\/snehpatel.com\/index.php\/wp-json\/wp\/v2\/posts\/149\/revisions"}],"wp:attachment":[{"href":"https:\/\/snehpatel.com\/index.php\/wp-json\/wp\/v2\/media?parent=149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/snehpatel.com\/index.php\/wp-json\/wp\/v2\/categories?post=149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/snehpatel.com\/index.php\/wp-json\/wp\/v2\/tags?post=149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}