{"id":7415,"date":"2016-03-22T16:59:03","date_gmt":"2016-03-22T15:59:03","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/lvm-how-to-extend-a-volume-group\/"},"modified":"2023-01-03T13:59:53","modified_gmt":"2023-01-03T12:59:53","slug":"lvm-how-to-extend-a-volume-group","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/lvm-how-to-extend-a-volume-group\/","title":{"rendered":"LVM : How to extend a Volume Group"},"content":{"rendered":"<p>In this article we&#8217;ll going to explore on how to extend a partition which resides in a Logical Volume. LVM (<a href=\"http:\/\/www.tldp.org\/HOWTO\/LVM-HOWTO\/whatislvm.html\" target=\"_blank\" rel=\"noopener\">Logical Volume Manager<\/a>) is a great tool for managing your storage devices on a Linux host.<\/p>\n<p>Lets start with some vocabulary. In the order of the lowest layer (hard disks) towards the highest layer (the file system):<\/p>\n<ul>\n<li>Your hard disks cabled in the waiter or in a SAN<\/li>\n<li>Physical Volume: these are the hard disks, a volume RAID or a volume coming from a SAN<\/li>\n<li>Volume Group: concatenation of the physical volumes<\/li>\n<li>Logical Volume: cutting of the volumes groups<\/li>\n<li>File system: controls how files are organized in the volumes groups<\/li>\n<\/ul>\n<p>The goal here is to add a new hard disk (or LUN) to the system and then to extend the &#8220;\/oracle&#8221; file system. Once the machine is turned off a new disk is attached to the system (eg: disk02.vdi or disk03.vmdk) and the virtual machine is restarted (Note: Enterprise configurations will not need to reboot for adding a new device).<\/p>\n<p>Currently the storage distribution of the system looks like this:<br \/>\n<code><br \/>\n[root@vmreforadg02 ~]# df -h<br \/>\nFilesystem            Size  Used Avail Use% Mounted on<br \/>\ntmpfs                 3.0G     0  3.0G   0% \/dev\/shm<br \/>\n\/dev\/sda1             243M  105M  126M  46% \/boot<br \/>\n\/dev\/mapper\/vgdata-lvdata<br \/>\n<strong>48G   40G    8G  83%<\/strong> \/oracle<br \/>\n<\/code><\/p>\n<p>As a new device was added to the system this device is now visible in the device tree: \/dev\/vdb<br \/>\n<code><br \/>\n[root@vmoracle02 ~]# <strong>fdisk -l<\/strong><br \/>\nDisk \/dev\/sdb: 21.5 GB, 21474836480 bytes<br \/>\n255 heads, 63 sectors\/track, 2610 cylinders<br \/>\nUnits = cylinders of 16065 * 512 = 8225280 bytes<br \/>\nSector size (logical\/physical): 512 bytes \/ 512 bytes<br \/>\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes<br \/>\nDisk identifier: 0x2bbb9b95<br \/>\n<\/code><\/p>\n<p>Create a new partition:<br \/>\n<code><br \/>\n[root@vmoracle02 ~]# <strong>fdisk \/dev\/sdb <\/strong><br \/>\nDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel<br \/>\nBuilding a new DOS disklabel with disk identifier 0x2bbb9b95.<br \/>\nChanges will remain in memory only, until you decide to write them.<br \/>\nAfter that, of course, the previous content won't be recoverable.<br \/>\nWarning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)<br \/>\n<\/code><\/p>\n<p>To switch to the partition menu press &#8220;p&#8221;:<br \/>\n<code><br \/>\nCommand (m for help): <strong>p<\/strong><br \/>\nDisk \/dev\/sdb: 21.5 GB, 21474836480 bytes<br \/>\n255 heads, 63 sectors\/track, 2610 cylinders<br \/>\nUnits = cylinders of 16065 * 512 = 8225280 bytes<br \/>\nSector size (logical\/physical): 512 bytes \/ 512 bytes<br \/>\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes<br \/>\n..<br \/>\nDisk identifier: 0x2bbb9b95<br \/>\nDevice Boot      Start         End      Blocks   Id  System<br \/>\n<\/code><\/p>\n<p>Follow the steps below to create a new primary partition:<br \/>\n<code><br \/>\nCommand (m for help): <strong>n<\/strong><br \/>\nCommand action<br \/>\ne   extended<br \/>\np   primary partition (1-4) <strong>p<\/strong><br \/>\nPartition number (1-4): <strong>1<\/strong><br \/>\nFirst cylinder (1-2610, default 1):<br \/>\nUsing default value 1<br \/>\nLast cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610):<br \/>\nUsing default value 2610<br \/>\nPartition number (1-4): <strong>1<\/strong><br \/>\nFirst cylinder (1-2610, default 1):<br \/>\nUsing default value 1<br \/>\nLast cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610):<br \/>\nUsing default value 2610<br \/>\nCommand (m for help): <strong>t<\/strong><br \/>\nSelected partition 1<br \/>\nHex code (type L to list codes): <strong>8e<\/strong><br \/>\nChanged system type of partition 1 to 8e (Linux LVM)<br \/>\n<\/code><br \/>\n8e is the code for LVM and the partition now looks like this.<br \/>\n<code><br \/>\nCommand (m for help): <strong>p<\/strong><br \/>\nDisk \/dev\/sdb: 21.5 GB, 21474836480 bytes<br \/>\n255 heads, 63 sectors\/track, 2610 cylinders<br \/>\nUnits = cylinders of 16065 * 512 = 8225280 bytes<br \/>\nSector size (logical\/physical): 512 bytes \/ 512 bytes<br \/>\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes<br \/>\nDisk identifier: 0x2bbb9b95<br \/>\n..<br \/>\nDevice Boot         Start         End      Blocks    Id  System<br \/>\n\/dev\/sdb1               1        2610    20964793+  8e  Linux LVM<br \/>\n<\/code><\/p>\n<p>The final step is to write the partition table to disk by pressing &#8220;w&#8221;:<br \/>\n<code><br \/>\nCommand (m for help): <strong>w<\/strong><br \/>\nThe partition table has been altered!<br \/>\n..<br \/>\nCalling ioctl() to re-read partition table.<br \/>\nSyncing disks.<br \/>\n<\/code><\/p>\n<p>The volume group &#8220;vgdata&#8221; can now be extended by adding the new partition:<br \/>\n<code><br \/>\n[root@vmoracle02 ~]# <strong>vgextend vgdata \/dev\/sdb1<\/strong><br \/>\nPhysical volume \"\/dev\/sdb1\" successfully created<br \/>\nVolume group \"vgdata\" successfully extended<br \/>\n[root@vmoracle02 ~]#<br \/>\n<\/code><\/p>\n<p>Execute the following command to extend the new space available of the logical volume.:<br \/>\n<code><br \/>\n[root@vmoracle02 ~]# <strong>lvextend -l +100%FREE \/dev\/mapper\/vgdata-lvdata <\/strong><br \/>\nSize of logical volume vgdata\/lvdata changed from 47.75 GiB (12225 extents) to 67.75 GiB (17343 extents).<br \/>\nLogical volume lvdata successfully resized<br \/>\n[root@vmoracle02 ~]#<br \/>\n[root@vmoracle02 ~]# <strong>resize2fs \/dev\/mapper\/vgdata-lvdata<\/strong><br \/>\nresize2fs 1.43-WIP (20-Jun-2013)<br \/>\nFilesystem at \/dev\/mapper\/vgdata-lvdata is mounted on \/oracle; on-line resizing required<br \/>\nold_desc_blocks = 3, new_desc_blocks = 5<br \/>\nPerforming an on-line resize of \/dev\/mapper\/vgdata-lvdata to 17759232 (4k) blocks.<br \/>\nThe filesystem on \/dev\/mapper\/vgdata-lvdata is now 17759232 blocks long.<br \/>\n<\/code><\/p>\n<p>Verify if the change was made on the file system &#8220;\/oracle&#8221;:<br \/>\n<code><br \/>\n[root@vmoracle02 ~]# df -h<br \/>\nFilesystem            Size  Used Avail Use% Mounted on<br \/>\ntmpfs                 3.0G     0  3.0G   0% \/dev\/shm<br \/>\n\/dev\/sda1             243M  105M  126M  46% \/boot<br \/>\n\/dev\/mapper\/vgdata-lvdata<br \/>\n<strong> 67G   40G   27G  58%<\/strong> \/oracle<br \/>\n[root@vmoracle02 ~]#<br \/>\n<\/code><\/p>\n<p>Free space available again.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article we&#8217;ll going to explore on how to extend a partition which resides in a Logical Volume. LVM (Logical Volume Manager) is a great tool for managing your storage devices on a Linux host. Lets start with some vocabulary. In the order of the lowest layer (hard disks) towards the highest layer (the [&hellip;]<\/p>\n","protected":false},"author":109,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229],"tags":[611,73,782],"type_dbi":[],"class_list":["post-7415","post","type-post","status-publish","format-standard","hentry","category-database-administration-monitoring","tag-filesytem","tag-linux","tag-lvm"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.6) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>LVM : How to extend a Volume Group - dbi Blog<\/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:\/\/www.dbi-services.com\/blog\/lvm-how-to-extend-a-volume-group\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"LVM : How to extend a Volume Group\" \/>\n<meta property=\"og:description\" content=\"In this article we&#8217;ll going to explore on how to extend a partition which resides in a Logical Volume. LVM (Logical Volume Manager) is a great tool for managing your storage devices on a Linux host. Lets start with some vocabulary. In the order of the lowest layer (hard disks) towards the highest layer (the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/lvm-how-to-extend-a-volume-group\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2016-03-22T15:59:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-03T12:59:53+00:00\" \/>\n<meta name=\"author\" content=\"DevOps\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DevOps\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/lvm-how-to-extend-a-volume-group\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/lvm-how-to-extend-a-volume-group\\\/\"},\"author\":{\"name\":\"DevOps\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/4cd1b5f8a3de93f05a16ab8d7d2b7735\"},\"headline\":\"LVM : How to extend a Volume Group\",\"datePublished\":\"2016-03-22T15:59:03+00:00\",\"dateModified\":\"2023-01-03T12:59:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/lvm-how-to-extend-a-volume-group\\\/\"},\"wordCount\":301,\"commentCount\":0,\"keywords\":[\"filesytem\",\"Linux\",\"LVM\"],\"articleSection\":[\"Database Administration &amp; Monitoring\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/lvm-how-to-extend-a-volume-group\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/lvm-how-to-extend-a-volume-group\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/lvm-how-to-extend-a-volume-group\\\/\",\"name\":\"LVM : How to extend a Volume Group - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"datePublished\":\"2016-03-22T15:59:03+00:00\",\"dateModified\":\"2023-01-03T12:59:53+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/4cd1b5f8a3de93f05a16ab8d7d2b7735\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/lvm-how-to-extend-a-volume-group\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/lvm-how-to-extend-a-volume-group\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/lvm-how-to-extend-a-volume-group\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"LVM : How to extend a Volume Group\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/4cd1b5f8a3de93f05a16ab8d7d2b7735\",\"name\":\"DevOps\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cdd2dd7441774355062c0f0f68612296b059cd1e2ff6c7af0b15dba0ed64a85f?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cdd2dd7441774355062c0f0f68612296b059cd1e2ff6c7af0b15dba0ed64a85f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cdd2dd7441774355062c0f0f68612296b059cd1e2ff6c7af0b15dba0ed64a85f?s=96&d=mm&r=g\",\"caption\":\"DevOps\"},\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/devops\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"LVM : How to extend a Volume Group - dbi Blog","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:\/\/www.dbi-services.com\/blog\/lvm-how-to-extend-a-volume-group\/","og_locale":"en_US","og_type":"article","og_title":"LVM : How to extend a Volume Group","og_description":"In this article we&#8217;ll going to explore on how to extend a partition which resides in a Logical Volume. LVM (Logical Volume Manager) is a great tool for managing your storage devices on a Linux host. Lets start with some vocabulary. In the order of the lowest layer (hard disks) towards the highest layer (the [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/lvm-how-to-extend-a-volume-group\/","og_site_name":"dbi Blog","article_published_time":"2016-03-22T15:59:03+00:00","article_modified_time":"2023-01-03T12:59:53+00:00","author":"DevOps","twitter_card":"summary_large_image","twitter_misc":{"Written by":"DevOps","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/lvm-how-to-extend-a-volume-group\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/lvm-how-to-extend-a-volume-group\/"},"author":{"name":"DevOps","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/4cd1b5f8a3de93f05a16ab8d7d2b7735"},"headline":"LVM : How to extend a Volume Group","datePublished":"2016-03-22T15:59:03+00:00","dateModified":"2023-01-03T12:59:53+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/lvm-how-to-extend-a-volume-group\/"},"wordCount":301,"commentCount":0,"keywords":["filesytem","Linux","LVM"],"articleSection":["Database Administration &amp; Monitoring"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/lvm-how-to-extend-a-volume-group\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/lvm-how-to-extend-a-volume-group\/","url":"https:\/\/www.dbi-services.com\/blog\/lvm-how-to-extend-a-volume-group\/","name":"LVM : How to extend a Volume Group - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2016-03-22T15:59:03+00:00","dateModified":"2023-01-03T12:59:53+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/4cd1b5f8a3de93f05a16ab8d7d2b7735"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/lvm-how-to-extend-a-volume-group\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/lvm-how-to-extend-a-volume-group\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/lvm-how-to-extend-a-volume-group\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"LVM : How to extend a Volume Group"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/4cd1b5f8a3de93f05a16ab8d7d2b7735","name":"DevOps","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cdd2dd7441774355062c0f0f68612296b059cd1e2ff6c7af0b15dba0ed64a85f?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cdd2dd7441774355062c0f0f68612296b059cd1e2ff6c7af0b15dba0ed64a85f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cdd2dd7441774355062c0f0f68612296b059cd1e2ff6c7af0b15dba0ed64a85f?s=96&d=mm&r=g","caption":"DevOps"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/devops\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/7415","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/109"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=7415"}],"version-history":[{"count":1,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/7415\/revisions"}],"predecessor-version":[{"id":21366,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/7415\/revisions\/21366"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=7415"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=7415"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=7415"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=7415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}