{"id":2595,"date":"2020-04-07T11:00:49","date_gmt":"2020-04-07T11:00:49","guid":{"rendered":"https:\/\/wiki.thomasandsofia.com\/?p=2595"},"modified":"2020-04-10T01:52:02","modified_gmt":"2020-04-10T01:52:02","slug":"2-lvm-logical-volumes","status":"publish","type":"post","link":"https:\/\/wiki.thomasandsofia.com\/?p=2595","title":{"rendered":"2. LVM Logical Volumes"},"content":{"rendered":"<p>&lt; <a href=\"https:\/\/wiki.thomasandsofia.com\/lvm-logical-volume-manager\/\">1 Logical Volume Manager<\/a> |\u00a0<a href=\"https:\/\/wiki.thomasandsofia.com\/lvm-commands\/\">Commands<\/a> | <a href=\"\/3-volume-group-administration\/\">3 Volume Group Administration &gt;<\/a><\/p>\n<h1>8. Linear Logical Volumes<\/h1>\n<p><a href=\"https:\/\/www.udemy.com\/course\/a-complete-guide-on-linux-lvm\/learn\/lecture\/13061988#overview\" target=\"_blank\" rel=\"noopener\">https:\/\/www.udemy.com\/course\/a-complete-guide-on-linux-lvm\/learn\/lecture\/13061988#overview<\/a><\/p>\n<h2>Creating the Volume Group<\/h2>\n<ul>\n<li>Volume Group is a pool of the physical volumes (PVs)<\/li>\n<li>Volume Groups are divided into Logical Volumes<\/li>\n<li>Logical Volumes are allocated into (mapped to) the same size as the Physical extents (PE) [See Logical Volumes below]\n<ul>\n<li>1 PE = 4MB<\/li>\n<li>If PV1 (Physical Volume 1) = 100MB, there will be 25 (100\/4) Physical Extents<\/li>\n<li>If PV2 = 100MB, there will be 50 PE<\/li>\n<li>VG1 (Volume Group 1) = PV1 + PV2, so 300MB = 75 PE.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>Logical Volumes<\/h2>\n<ul>\n<li>These can be used by your applications<\/li>\n<li>When PE are assigned to a Logical Volume, they change from PE to LE (Logical Extents)\n<ul>\n<li>If 1 PE = 4 MB, then 1 LE also = 4 MB (Always 1 to 1)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>Different types of Logical Volumes<\/h2>\n<ul>\n<li>Linear\n<ul>\n<li>These aggregate space from one or monre physical volumes into one logical volume.\n<ul>\n<li>If you have three 100GB disks, you can create a 300GB logical volume.<\/li>\n<li>The physical storage is concatenated.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h1>9. Volume Group Creation<\/h1>\n<h2>Creating Volume Groups<\/h2>\n<p>After the Physical Volumes have been created, create the Volume Group<\/p>\n<h3>Commands<\/h3>\n<p><strong>Find which volumes are available<\/strong><\/p>\n<pre>fdisk -l<\/pre>\n<p><strong>Display the Physical Volumes<\/strong><\/p>\n<pre>pvdisplay \/dev\/sdxn<\/pre>\n<p>Example:<\/p>\n<pre># pvdisplay \/dev\/sda3\r\n--- Physical volume ---\r\nPV Name \/dev\/sda3\r\nVG Name XSLocalEXT-cc138e33-c171-6d3f-e559-f9649d47ad75\r\nPV Size 196.97 GiB \/ not usable &lt;13.32 MiB\r\nAllocatable yes (but full)\r\nPE Size 4.00 MiB\r\nTotal PE 50422\r\nFree PE 0\r\nAllocated PE 50422\r\nPV UUID 14dfcf-uhNt-wav7-d1jH-hdOH-fGCr-nABNQi<\/pre>\n<p><strong>Create Volume Groups<\/strong><\/p>\n<pre>vgcreate &lt;groupName&gt; \/dev\/sdx1 \/dev\/sdx2 ...<\/pre>\n<p><strong>Display Volume Groups<\/strong><\/p>\n<pre>vgdisplay &lt;-v&gt; &lt;\/dev\/GROUPNAME&gt;<\/pre>\n<p>-v: Show Physical Volume information<\/p>\n<p>Example:<\/p>\n<pre>$ sudo vgdisplay\r\n--- Volume group ---\r\nVG Name XSLocalEXT-cc138e33-c171-6d3f-e559-f9649d47ad75\r\nSystem ID \r\nFormat lvm2\r\nMetadata Areas 1\r\nMetadata Sequence No 2\r\nVG Access read\/write\r\nVG Status resizable\r\nMAX LV 0\r\nCur LV 1\r\nOpen LV 1\r\nMax PV 0\r\nCur PV 1\r\nAct PV 1\r\nVG Size 196.96 GiB\r\nPE Size 4.00 MiB\r\nTotal PE 50422\r\nAlloc PE \/ Size 50422 \/ 196.96 GiB\r\nFree PE \/ Size 0 \/ 0 \r\nVG UUID PQfRRm-HJvu-2L3r-ohPX-tWaj-azeD-mwIaxj<\/pre>\n<p>With -v<\/p>\n<pre> --- Logical volume ---\r\nLV Path \/dev\/XSLocalEXT-cc138e33-c171-6d3f-e559-f9649d47ad75\/cc138e33-c171-6d3f-e559-f9649d47ad75\r\nLV Name cc138e33-c171-6d3f-e559-f9649d47ad75\r\nVG Name XSLocalEXT-cc138e33-c171-6d3f-e559-f9649d47ad75\r\nLV UUID PpOE7h-qUkF-grNR-2zxi-GMZC-S9HQ-mKhJY6\r\nLV Write Access read\/write\r\nLV Creation host, time citrix01, 2020-04-06 17:42:57 -0500\r\nLV Status available\r\n# open 1\r\nLV Size 196.96 GiB\r\nCurrent LE 50422\r\nSegments 1\r\nAllocation inherit\r\nRead ahead sectors auto\r\n- currently set to 256\r\nBlock device 253:0\r\n\r\n--- Physical volumes ---\r\nPV Name \/dev\/sda3 \r\nPV UUID 14dfcf-uhNt-wav7-d1jH-hdOH-fGCr-nABNQi\r\nPV Status allocatable\r\nTotal PE \/ Free PE 50422 \/ 0<\/pre>\n<p>&nbsp;<\/p>\n<h1>10 &#8211; 12. Practice Sessions and Command review<\/h1>\n<p>These are all Commands<\/p>\n<p>&nbsp;<\/p>\n<p><a name=\"stripedlv\"><\/a><\/p>\n<h1>13. Striped Logical Volumes<\/h1>\n<p><a href=\"https:\/\/www.udemy.com\/course\/a-complete-guide-on-linux-lvm\/learn\/lecture\/13062136#overview\">https:\/\/www.udemy.com\/course\/a-complete-guide-on-linux-lvm\/learn\/lecture\/13062136#overview<\/a><\/p>\n<p>Just like a RAID array, this is good for high I\/O<\/p>\n<p><a href=\"https:\/\/wiki.thomasandsofia.com\/wp-content\/uploads\/2020\/04\/striped.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2607\" src=\"https:\/\/wiki.thomasandsofia.com\/wp-content\/uploads\/2020\/04\/striped.png\" alt=\"\" width=\"527\" height=\"366\" srcset=\"https:\/\/wiki.thomasandsofia.com\/wp-content\/uploads\/2020\/04\/striped.png 527w, https:\/\/wiki.thomasandsofia.com\/wp-content\/uploads\/2020\/04\/striped-300x208.png 300w, https:\/\/wiki.thomasandsofia.com\/wp-content\/uploads\/2020\/04\/striped-150x104.png 150w\" sizes=\"auto, (max-width: 527px) 100vw, 527px\" \/><\/a><\/p>\n<p>Example 1:\u00a0 The following command creates a striped volume across 2 PVs (-i) with a stripe of 64KB (-I).\u00a0 The logical volume is 50GB (-L) named strpvol (-n) and is carved out of VG vglab.<\/p>\n<ul>\n<li>The default stripe size is 64kB.\u00a0 If a number is submitted, it will be assumed to be kB<\/li>\n<\/ul>\n<pre>lvcreate -L -i 2 -I 64 -n strpvol vglab<\/pre>\n<p>Example 2: Specify the exact extents to use in your Logical Volume striped array<\/p>\n<pre>lvcreate -l 100 -i 2 -n strpvol \/dev\/dec1:0-49 \/dev\/ded1:50-99<\/pre>\n<p>&nbsp;<\/p>\n<h1>14. Demonstration for Section 13.<\/h1>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&lt; 1 Logical Volume Manager |\u00a0Commands | 3 Volume Group Administration &gt; 8. Linear Logical Volumes https:\/\/www.udemy.com\/course\/a-complete-guide-on-linux-lvm\/learn\/lecture\/13061988#overview Creating the Volume Group Volume Group is a pool of the physical volumes (PVs) Volume Groups are divided into Logical Volumes Logical Volumes are allocated into (mapped to) the same size as the Physical extents (PE) [See Logical ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/wiki.thomasandsofia.com\/?p=2595\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[56],"tags":[],"class_list":["post-2595","post","type-post","status-publish","format-standard","hentry","category-logical-volume-manager"],"_links":{"self":[{"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/posts\/2595","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2595"}],"version-history":[{"count":10,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/posts\/2595\/revisions"}],"predecessor-version":[{"id":2635,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/posts\/2595\/revisions\/2635"}],"wp:attachment":[{"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2595"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2595"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2595"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}