{"id":107,"date":"2019-01-07T13:16:56","date_gmt":"2019-01-07T12:16:56","guid":{"rendered":"http:\/\/blog.nosland.com\/?p=107"},"modified":"2019-01-07T13:40:35","modified_gmt":"2019-01-07T12:40:35","slug":"lvm","status":"publish","type":"post","link":"http:\/\/blog.nosland.com\/?p=107","title":{"rendered":"LVM"},"content":{"rendered":"\n<p>Exemple d&rsquo;utilisation de LVM. La machine choisie est\u00a0une\u00a0Debian\u00a0parce avec deux disques.<\/p>\n\n\n\n<h4 id=\"disques\">Disques<\/h4>\n\n\n\n<p>On va regarder les disques avec la commande\u00a0<code>fdisk<\/code>:<\/p>\n\n\n\n<p class=\"has-text-color has-background has-luminous-vivid-amber-color has-very-dark-gray-background-color\">$ sudo fdisk -l \/dev\/sda \/dev\/sdb<br>Disk \/dev\/sda: 30 GiB, 32212254720 bytes, 62914560 sectors<br>Device     Boot Start      End  Sectors Size Id Type<br> \/dev\/sda1        2048 62914559 62912512  30G 8e Linux LVM<br><br> Disk \/dev\/sdb: 200 GiB, 214748364800 bytes, 419430400 sectors<br> Device     Boot Start       End   Sectors  Size Id Type<br> \/dev\/sdb1        2048 419430399 419428352  200G 8e Linux LVM<\/p>\n\n\n\n<p>Il y a deux disques: un de 30\u00a0<abbr title=\"Gigabyte\">GB<\/abbr>\u00a0et un de 200\u00a0<abbr title=\"Gigabyte\">GB<\/abbr>. Chaque disque h\u00e9berge une partition LVM:\u00a0<code>\/dev\/sda1<\/code>\u00a0et\u00a0<code>\/dev\/sdb1<\/code>.<\/p>\n\n\n\n<h4 id=\"pv\">Physical Volume<\/h4>\n\n\n\n<p>Ces deux partitions sont utilis\u00e9es dans des PV (Physical Volume)<\/p>\n\n\n\n<p class=\"has-text-color has-background has-luminous-vivid-amber-color has-very-dark-gray-background-color\">$ sudo pvs   <br><br>PV         VG   Fmt  Attr PSize   PFree    <br>\/dev\/sda1  vg1  lvm2 a&#8211;   30.00g 11.00g <br>\/dev\/sdb1  vg2  lvm2 a&#8211;  200.00g 20.00g<\/p>\n\n\n\n<h4 id=\"vg\">Volume Group<\/h4>\n\n\n\n<p>Chaque PV est utilis\u00e9 dans un VG (Volume Group):<\/p>\n\n\n\n<p class=\"has-text-color has-background has-luminous-vivid-amber-color has-very-dark-gray-background-color\">$ sudo vgs   <br>VG   #PV #LV #SN Attr   VSize   VFree  <br> vg1    1   7   0 wz&#8211;n-  30.00g 11.00g<br> vg2    1   1   0 wz&#8211;n- 200.00g 20.00g<\/p>\n\n\n\n<p>Il y a deux VG:\u00a0<code>vg1<\/code>\u00a0et\u00a0<code>vg2<\/code>. Les informations sont indentiques \u00e0 ce que renvoie\u00a0<code>pvs<\/code>\u00a0parce qu&rsquo;il n&rsquo;y a qu&rsquo;un seul PV dans chaque VG. Il est possible d&rsquo;\u00e9tendre un VG en ajoutant un autre PV.<\/p>\n\n\n\n<h4 id=\"lv\">Logical Volume<\/h4>\n\n\n\n<p>Chaque VG fournit de la place pour plusieurs LV (Logical Volume):<\/p>\n\n\n\n<p class=\"has-text-color has-background has-luminous-vivid-amber-color has-very-dark-gray-background-color\">$ sudo lvs  <br> LV        VG   Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert  <br>home      vg1  -wi-ao&#8212;- 1000.00m                                                       postgres  vg1  -wi-ao&#8212;-    5.00g  <br>slash     vg1  -wi-ao&#8212;-  976.00m                                                       <br>swap      vg1  -wi-ao&#8212;-    1.24g                                                       <br>tmp       vg1  -wi-ao&#8212;- 1000.00m                                                       <br>usr       vg1  -wi-ao&#8212;-    3.91g                                                       <br>var       vg1  -wi-ao&#8212;-    5.95g <br>data vg2  -wi-ao&#8212;-  180.00g                                                    <\/p>\n\n\n\n<p>Toutes les filesystems sont contenus dans\u00a0<code>vg1<\/code>, sauf\u00a0<code>data<\/code>\u00a0qui se trouve dans\u00a0<code>vg2<\/code><\/p>\n\n\n\n<p>Ce sont ces filesystem qu&rsquo;on peut voir avec la commande&nbsp;<code>df<\/code>:<\/p>\n\n\n\n<p class=\"has-text-color has-background has-luminous-vivid-amber-color has-very-dark-gray-background-color\">$ df -h<br>Filesystem                    Size    Used     Avail     Use%  Mounted on <br>\/dev\/dm-0                      1.8G    1.3G     335M     80%     \/ <br>udev                                10M      0          10M       0%     \/dev <br>tmpfs                             148M    18M    131M     12%    \/run <br>\/dev\/mapper\/vg-usr     1.5G     1.4G    524M     98%    \/usr <br>tmpfs                             370M       0       370M      0%     \/dev\/shm <br>tmpfs                              5.0M       0        5.0M      0%     \/run\/lock <br>tmpfs                             370M       0       370M      0%     \/sys\/fs\/cgroup<br>\/dev\/sda1                       180M     48M   120M    29%    \/boot  <br>\/dev\/mapper\/vg-var      2.4G     1.1G     1.2G    48%    \/var <br>\/dev\/mapper\/vg-tmp   597M     4.1M  558M     1%     \/tmp <br>\/dev\/mapper\/vg-home  1.8G    786M  879M    48%    \/home <br>\/dev\/sdb1                        985G     141G  794G    16%    \/images <br>tmpfs                                74M         0       74M     0%     \/run\/user\/65534 <br>tmpfs                                74M         0       74M     0%     \/run\/user\/1001 <br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Exemple d&rsquo;utilisation de LVM. La machine choisie est\u00a0une\u00a0Debian\u00a0parce avec deux disques. Disques On va regarder les disques avec la commande\u00a0fdisk:&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"_links":{"self":[{"href":"http:\/\/blog.nosland.com\/index.php?rest_route=\/wp\/v2\/posts\/107"}],"collection":[{"href":"http:\/\/blog.nosland.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.nosland.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.nosland.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.nosland.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=107"}],"version-history":[{"count":2,"href":"http:\/\/blog.nosland.com\/index.php?rest_route=\/wp\/v2\/posts\/107\/revisions"}],"predecessor-version":[{"id":112,"href":"http:\/\/blog.nosland.com\/index.php?rest_route=\/wp\/v2\/posts\/107\/revisions\/112"}],"wp:attachment":[{"href":"http:\/\/blog.nosland.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.nosland.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=107"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.nosland.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}