{"id":2618,"date":"2020-04-09T18:32:31","date_gmt":"2020-04-09T18:32:31","guid":{"rendered":"https:\/\/wiki.thomasandsofia.com\/?p=2618"},"modified":"2020-04-10T01:49:16","modified_gmt":"2020-04-10T01:49:16","slug":"4-thin-provisioned-logical-volumes","status":"publish","type":"post","link":"https:\/\/wiki.thomasandsofia.com\/?p=2618","title":{"rendered":"4. Thin Provisioned Logical Volumes"},"content":{"rendered":"<p><a href=\"\/3-volume-group-administration\/\">&lt; 3 Volume Group Administration<\/a> | <a href=\"\/lvm-commands\/\">Commands<\/a> | <a href=\"\/5-lvm-snapshots\/\">5 Snapshots &gt;<\/a><\/p>\n<h1>26. Overview<\/h1>\n<p><a href=\"https:\/\/www.udemy.com\/course\/a-complete-guide-on-linux-lvm\/learn\/lecture\/13062374#overview\" target=\"_blank\" rel=\"noopener\">https:\/\/www.udemy.com\/course\/a-complete-guide-on-linux-lvm\/learn\/lecture\/13062374#overview<\/a><\/p>\n<p><a href=\"https:\/\/wiki.thomasandsofia.com\/wp-content\/uploads\/2020\/04\/thinpool.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2619\" src=\"https:\/\/wiki.thomasandsofia.com\/wp-content\/uploads\/2020\/04\/thinpool.png\" alt=\"\" width=\"604\" height=\"405\" srcset=\"https:\/\/wiki.thomasandsofia.com\/wp-content\/uploads\/2020\/04\/thinpool.png 604w, https:\/\/wiki.thomasandsofia.com\/wp-content\/uploads\/2020\/04\/thinpool-300x201.png 300w, https:\/\/wiki.thomasandsofia.com\/wp-content\/uploads\/2020\/04\/thinpool-150x101.png 150w\" sizes=\"auto, (max-width: 604px) 100vw, 604px\" \/><\/a><\/p>\n<ul>\n<li>Thin Provisioning allows you to over commit the storage and create LVs that are larger than the available extents.<\/li>\n<\/ul>\n<p>Example:<\/p>\n<ul>\n<li>PV1 &amp; PV2 are both 50GB<\/li>\n<li>VG1 = 100GB<\/li>\n<li>Create a Thin Pool = Size of VG (100GB)\n<ul>\n<li>It can be smaller and can be increased later.<\/li>\n<\/ul>\n<\/li>\n<li>You can now create 3 LVs whos combined space is larger than the actual space available.\n<ul>\n<li>Each disk will only use what it is using, not how much was assigned to it!<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h1>27. Thin Pool Setup<\/h1>\n<p><a href=\"https:\/\/www.udemy.com\/course\/a-complete-guide-on-linux-lvm\/learn\/lecture\/13062392#overview\" target=\"_blank\" rel=\"noopener\">https:\/\/www.udemy.com\/course\/a-complete-guide-on-linux-lvm\/learn\/lecture\/13062392#overview<\/a><\/p>\n<ul>\n<li>Setup: 2 drives, \/sdg1, sdh 2GB each<\/li>\n<li>Use lvdisplay to see usage parameters after it has been created<\/li>\n<\/ul>\n<pre># Create the Physical Volumes\r\npvcreate \/dev\/sdg1 \/dev\/sdh1\r\n# Create the VG\r\nvgcreate \/dev\/vg_thin \/dev\/sdg1 \/dev\/sdh1\r\n# Create the thin pool\r\n# This is similar to creating an LV\r\nlvcreate -L 3GB --thinpool thin_pool vg_thin\r\n# Create a thin volume\r\nlvcreate -V 1G --thin -n thin_vol1 vg_thin\/thin_pool\r\nlvcreate -V 1G --thin -n thin_vol2 vg_thin\/thin_pool\r\nlvcreate -V 1G --thin -n thin_vol3 vg_thin\/thin_pool<\/pre>\n<h1>28 &amp; 29 Lab<\/h1>\n<pre># Format the volumes\r\nmkfs -t ext4 \/dev\/vg_thin\/thin_vol1\r\nmkfs -t ext4 \/dev\/vg_thin\/thin_vol2\r\nmkfs -t ext4 \/dev\/vg_thin\/thin_vol3\r\n# mount the volumes\r\nmkdir \/mnt\/tv1\r\nmount \/dev\/vg_thin\/thin_vol1\r\nmkdir \/mnt\/tv2\r\nmount \/dev\/vg_thin\/thin_vol2\r\nmkdir \/mnt\/tv3\r\nmount \/dev\/vg_thin\/thin_vol3\r\n# View space taken\r\nlvdisplay \/dev\/vg_thin\/thin_pool\r\n  LV Size    3.00GiB\r\n  Allocated Pool data  4.79%<\/pre>\n<h4>Create a 4th LV<\/h4>\n<pre># This will over provision the 3GB thin_pool size\r\nlvcreate -V 1G --thin -n thin_vol4 vg_thin\/thin_pool\r\n# It will give a warning, but will provision it!<\/pre>\n<h2>29. Format, mount, and check the used space.<\/h2>\n<pre>mkfs -t ext4 \/dev\/vg_thin\/thin_vol4\r\nmkdir \/mnt\/tv4\r\nmount \/dev\/vg_thin_thin_vol4 \/mnt\/tv4\r\n# Copy some files to all drives.\r\ncp 250mb.file \/mnt\/tv1\r\ncp 250mb.file \/mnt\/tv2\r\ncp 250mb.file \/mnt\/tv3\r\ncp 250mb.file \/mnt\/tv4\r\n# check used space (fake values, some used for formatting)\r\nlvdisplay \/dev\/vg_thin\/thin_pool\r\n  LV Size  3.00GiB\r\n  Allocated Pool Data 33.3%<\/pre>\n<h4>If you need to add additional Space:<\/h4>\n<ul>\n<li>Extend the thin_pool by take some\/all of the remaining space in the Volume Group<\/li>\n<li>Add a new PV to the Volume Group, then extend<\/li>\n<\/ul>\n<pre>lvextend -L +500MB \/dev\/vg_thin\/thin_pool<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&lt; 3 Volume Group Administration | Commands | 5 Snapshots &gt; 26. Overview https:\/\/www.udemy.com\/course\/a-complete-guide-on-linux-lvm\/learn\/lecture\/13062374#overview Thin Provisioning allows you to over commit the storage and create LVs that are larger than the available extents. Example: PV1 &amp; PV2 are both 50GB VG1 = 100GB Create a Thin Pool = Size of VG (100GB) It can be ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/wiki.thomasandsofia.com\/?p=2618\" 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-2618","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\/2618","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=2618"}],"version-history":[{"count":4,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/posts\/2618\/revisions"}],"predecessor-version":[{"id":2626,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/posts\/2618\/revisions\/2626"}],"wp:attachment":[{"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2618"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2618"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2618"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}