{"id":218,"date":"2018-05-20T05:49:57","date_gmt":"2018-05-20T05:49:57","guid":{"rendered":"https:\/\/secureethics.com\/?p=218"},"modified":"2018-08-04T08:14:23","modified_gmt":"2018-08-04T08:14:23","slug":"how-to-create-lvm-partition","status":"publish","type":"post","link":"https:\/\/secureethics.com\/?p=218","title":{"rendered":"How to create LVM Partitions ?"},"content":{"rendered":"<p>LVM partition has three levels of structure as below<\/p>\n<ol>\n<li>Physical volume<\/li>\n<li>Volume Group<\/li>\n<li>Logical volume<\/li>\n<\/ol>\n<p><strong>Step: 1 &#8211; <\/strong>Physical volume creation<\/p>\n<p>First, we have to create the physical volume before creating the volume group, Now I&#8217;m going to make physical volume partitioning\u00a0 \/dev\/ sdb from block storage(RAW HDD).<\/p>\n<ul>\n<li>Shell command:\u00a0<strong><span class=\"lang:default decode:true crayon-inline \">fdisk -l <\/span>\u00a0<\/strong> this command used for view the all mounted HDD&#8217;s<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-238\" src=\"https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/RAW.png\" alt=\"\" width=\"543\" height=\"293\" srcset=\"https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/RAW.png 543w, https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/RAW-300x162.png 300w, https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/RAW-520x281.png 520w\" sizes=\"auto, (max-width: 543px) 100vw, 543px\" \/><\/p>\n<ul>\n<li>Shell command: <strong><span class=\"lang:default decode:true crayon-inline \">pvcreate \/dev\/sdb<\/span>\u00a0<\/strong>this command used to create the physical volume from raw disk and it can be any disk-like physical HDD, VMware VMDK, etc.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-241\" src=\"https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/pvcreate.png\" alt=\"\" width=\"423\" height=\"49\" srcset=\"https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/pvcreate.png 423w, https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/pvcreate-300x35.png 300w\" sizes=\"auto, (max-width: 423px) 100vw, 423px\" \/><\/p>\n<ul>\n<li>Shell command: &#8220;<strong><span class=\"lang:default decode:true crayon-inline \">pvs or pvdisplay<\/span>\u00a0<\/strong>&#8221; to view the physical volumes<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-245\" src=\"https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/pvs.png\" alt=\"\" width=\"522\" height=\"477\" srcset=\"https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/pvs.png 522w, https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/pvs-300x274.png 300w, https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/pvs-520x475.png 520w\" sizes=\"auto, (max-width: 522px) 100vw, 522px\" \/><\/p>\n<p><strong>Step: 2 &#8211;\u00a0<\/strong> Volume Group creation<\/p>\n<ul>\n<li>Shell command: &#8220;<span class=\"lang:default decode:true crayon-inline \">vgcreate vg_secureethics \/dev\/sdb<\/span>\u00a0&#8221; to create the volume group<\/li>\n<\/ul>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 vg_secureethics<\/strong> &#8211;&gt; this is volume group name and it can be any name<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-248\" src=\"https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/vgcreate.png\" alt=\"\" width=\"465\" height=\"51\" srcset=\"https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/vgcreate.png 465w, https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/vgcreate-300x33.png 300w\" sizes=\"auto, (max-width: 465px) 100vw, 465px\" \/><\/p>\n<ul>\n<li>Shell command: &#8220;<span class=\"lang:default decode:true crayon-inline \">vgs<\/span>\u00a0 or <span class=\"lang:default decode:true crayon-inline \">vgdispaly<\/span>\u00a0&#8221; to view the volume groups<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-249\" src=\"https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/vgs.png\" alt=\"\" width=\"538\" height=\"742\" srcset=\"https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/vgs.png 538w, https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/vgs-218x300.png 218w, https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/vgs-520x717.png 520w\" sizes=\"auto, (max-width: 538px) 100vw, 538px\" \/><\/p>\n<p><strong>Step: 3 &#8211;\u00a0<\/strong> Logical Volume\u00a0 creation<\/p>\n<ul>\n<li>Shell command: &#8220;<strong><span class=\"lang:default decode:true crayon-inline \">lvcretae -L 4G -n lv_secureethics vg_secureethics<\/span>\u00a0<\/strong>&#8221; to create logical volume<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-253\" src=\"https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/lvcretae.png\" alt=\"\" width=\"628\" height=\"58\" srcset=\"https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/lvcretae.png 628w, https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/lvcretae-300x28.png 300w, https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/lvcretae-520x48.png 520w\" sizes=\"auto, (max-width: 628px) 100vw, 628px\" \/><\/p>\n<ul>\n<li>Shell command: &#8220;<span class=\"lang:default decode:true crayon-inline\">lvs<\/span>or <span class=\"lang:default decode:true crayon-inline \">lvdisplay<\/span>\u00a0&#8221; to view the logical volumes<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-254\" src=\"https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/lvs.png\" alt=\"\" width=\"916\" height=\"389\" srcset=\"https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/lvs.png 916w, https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/lvs-300x127.png 300w, https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/lvs-768x326.png 768w, https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/lvs-520x221.png 520w\" sizes=\"auto, (max-width: 916px) 100vw, 916px\" \/><\/p>\n<p><strong>Step: 4<\/strong> &#8211; Make File systems<\/p>\n<p>Shell command: &#8220;<span class=\"lang:default decode:true crayon-inline \">mkfs.ext4 \/dev\/mapper\/vg_secureethics-lv_secureethics_data<\/span>\u00a0&#8221; to make the filesystems for usable partition and You can use any format like ext2,ext4,xfs,ntfs,etc.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-255\" src=\"https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/mkfs.ext4_.png\" alt=\"\" width=\"693\" height=\"373\" srcset=\"https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/mkfs.ext4_.png 693w, https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/mkfs.ext4_-300x161.png 300w, https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/mkfs.ext4_-520x280.png 520w\" sizes=\"auto, (max-width: 693px) 100vw, 693px\" \/><\/p>\n<p>Step: 5 &#8211; Mount\/Add the LVM partition to fstab<\/p>\n<p>Here I&#8217;m going to mount the partition <strong>\/dev\/mapper\/vg_secureethics-lv_secureethics_data<\/strong> to\u00a0 \/data<\/p>\n<ul>\n<li>Shell command: &#8220;<strong><span class=\"lang:default decode:true crayon-inline \">mount \/dev\/mapper\/vg_secureethics-lv_secureethics_data \/data<\/span>\u00a0&#8221; <\/strong>to mount the lvm partition<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-256\" src=\"https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/mount.png\" alt=\"\" width=\"733\" height=\"215\" srcset=\"https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/mount.png 733w, https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/mount-300x88.png 300w, https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/mount-520x153.png 520w\" sizes=\"auto, (max-width: 733px) 100vw, 733px\" \/><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>Edit the fstab file &#8220;<span class=\"lang:default decode:true crayon-inline \">vi \/etc\/fstab<\/span>\u00a0&#8221; this is step mount the partition <span data-dobid=\"hdw\">permanently<\/span> on the server<\/li>\n<\/ul>\n<p>&#8220;<span class=\"lang:default decode:true crayon-inline \">\/dev\/mapper\/vg_secureethics-lv_secureethics_data \/data ext4 defaults 0 0<\/span>\u00a0&#8220;add this line end of the file\u00a0 into fstab<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-258\" src=\"https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/fstab_cat.png\" alt=\"\" width=\"761\" height=\"215\" srcset=\"https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/fstab_cat.png 761w, https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/fstab_cat-300x85.png 300w, https:\/\/secureethics.com\/wp-content\/uploads\/2018\/05\/fstab_cat-520x147.png 520w\" sizes=\"auto, (max-width: 761px) 100vw, 761px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>LVM partition has three levels of structure as below Physical volume Volume Group Logical volume Step: 1 &#8211; Physical volume creation First, we have to create the physical volume before creating the volume group, Now I&#8217;m going to make physical&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":254,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,4,9],"tags":[],"class_list":["post-218","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-linux","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/secureethics.com\/index.php?rest_route=\/wp\/v2\/posts\/218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/secureethics.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/secureethics.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/secureethics.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/secureethics.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=218"}],"version-history":[{"count":0,"href":"https:\/\/secureethics.com\/index.php?rest_route=\/wp\/v2\/posts\/218\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/secureethics.com\/index.php?rest_route=\/wp\/v2\/media\/254"}],"wp:attachment":[{"href":"https:\/\/secureethics.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/secureethics.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/secureethics.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}