{"id":528,"date":"2018-07-27T14:27:03","date_gmt":"2018-07-27T12:27:03","guid":{"rendered":"http:\/\/union31xh.free.fr\/?p=528"},"modified":"2018-08-09T19:25:31","modified_gmt":"2018-08-09T17:25:31","slug":"linux-gestion-des-disques","status":"publish","type":"post","link":"https:\/\/blogperso.union31.fr\/?p=528","title":{"rendered":"Linux : introduction LVM"},"content":{"rendered":"<p>Dans notre cas un Linux CENTOS 7 a \u00e9t\u00e9 install\u00e9 sur un disque de 8Go d\u00e9j\u00e0 existant.<\/p>\n<p>A l&rsquo;issue 2 disques de 1 Go ont \u00e9t\u00e9 ajout\u00e9s<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Sommaire<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/blogperso.union31.fr\/?p=528\/#I_Disques_partition\" >I Disques \/ partition<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/blogperso.union31.fr\/?p=528\/#II_Visualisation_des_filesystem\" >II Visualisation des filesystem<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/blogperso.union31.fr\/?p=528\/#III_LVM\" >III LVM<\/a><ul class='ez-toc-list-level-2' ><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/blogperso.union31.fr\/?p=528\/#III1_Presentation\" >III.1 Pr\u00e9sentation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/blogperso.union31.fr\/?p=528\/#III2_Vocabulaire\" >III.2 Vocabulaire:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/blogperso.union31.fr\/?p=528\/#III3_Listes_des_principales_commandes\" >III.3 Listes des principales commandes<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/blogperso.union31.fr\/?p=528\/#III4_Groupes_de_Volumes_VG\" >III.4 Groupes de Volumes (VG)<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/blogperso.union31.fr\/?p=528\/#III41_Afficher_la_liste_des_groupes_de_volumes\" >III.4.1 Afficher la liste des groupes de volumes :<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/blogperso.union31.fr\/?p=528\/#III42_Creation_dun_groupe_de_volume_sur_le_disque_sdc\" >III.4.2 Cr\u00e9ation d&rsquo;un groupe de volume sur le disque sdc<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/blogperso.union31.fr\/?p=528\/#III43_Suppression_dun_groupe_de_volumes\" >III.4.3 Suppression d&rsquo;un groupe de volumes<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/blogperso.union31.fr\/?p=528\/#III5_Volumes_Logiques_VL\" >III.5 Volumes Logiques (VL)<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/blogperso.union31.fr\/?p=528\/#III51_Afficher_les_volumes_logiques\" >III.5.1 Afficher les volumes logiques<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/blogperso.union31.fr\/?p=528\/#III52_Creation_dun_volume_logique\" >III.5.2 Cr\u00e9ation d&rsquo;un volume logique<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/blogperso.union31.fr\/?p=528\/#III53_Formatter_un_volume_logique\" >III.5.3 Formatter un volume logique<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/blogperso.union31.fr\/?p=528\/#III54_Monter_un_volume_logique\" >III.5.4 Monter un volume logique<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/blogperso.union31.fr\/?p=528\/#III55_Supprimer_un_volume_logique\" >III.5.5 Supprimer un volume logique<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/blogperso.union31.fr\/?p=528\/#III5_Redimmensionner\" >III.5 Redimmensionner<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/blogperso.union31.fr\/?p=528\/#III51_Augmenter_un_volume_logique\" >III.5.1 Augmenter un volume logique<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/blogperso.union31.fr\/?p=528\/#III52_Reduire_un_volume_logique\" >III.5.2 R\u00e9duire un volume logique<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/blogperso.union31.fr\/?p=528\/#III53_Enlever_un_disque_physique_dun_groupe_de_volumes\" >III.5.3 Enlever un disque physique d&rsquo;un groupe de volumes<\/a><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"I_Disques_partition\"><\/span>I Disques \/ partition<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>Lister les disques physiques vu par le syst\u00e8me :<\/p>\n<ul>\n<li>ls -als \/dev\/[hs]d[a-z]  &#8211;&gt; (Xen, RAIS et LVM non pris en compte)<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<pre>0 brw-rw----. 1 root disk 8, 0 27 juil. 15:11 \/dev\/sda\r\n0 brw-rw----. 1 root disk 8, 16 27 juil. 15:11 \/dev\/sdb\r\n0 brw-rw----. 1 root disk 8, 32 27 juil. 15:11 \/dev\/sdc\r\n\r\n\r\n\r\n<\/pre>\n<p>hd* &#8211;&gt; disque IDE<\/p>\n<p>sd* &#8211;&gt; disque SATA, SCSI, USB<\/p>\n<p>scd* ou sr* &#8211;&gt; lecteur CDROM SATA,SCSI,&#8230;<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>lsblk | grep disk<\/li>\n<\/ul>\n<pre>sda 8:0 0 8G 0 disk\r\nsdb 8:16 0 1010,9M 0 disk\r\nsdc 8:32 0 1,1G 0 disk<\/pre>\n<ul>\n<li>lsblk &#8211;&gt; Liste des disques et partitions associ\u00e9es<\/li>\n<\/ul>\n<pre>NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT\r\nsda 8:0 0 8G 0 disk\r\n\u251c\u2500sda1 8:1 0 1G 0 part \/boot\r\n\u2514\u2500sda2 8:2 0 7G 0 part\r\n \u251c\u2500centos-root 253:0 0 6,2G 0 lvm \/\r\n \u2514\u2500centos-swap 253:1 0 820M 0 lvm [SWAP]\r\nsdb 8:16 0 1010,9M 0 disk\r\nsdc 8:32 0 1,1G 0 disk\r\nsr0 11:0 1 1024M 0 rom<\/pre>\n<ul>\n<li>lsblk -f &#8211;&gt; Liste des disques et partitions associ\u00e9es + type de filesystem<\/li>\n<\/ul>\n<pre>NAME FSTYPE LABEL UUID MOUNTPOINT\r\nsda\r\n\u251c\u2500sda1 xfs dc103496-c8f0-427c-8d24-182472f24d3f \/boot\r\n\u2514\u2500sda2 LVM2_member i63M7M-z29v-ccrO-58fh-UVbx-OZYq-yLBhNf\r\n \u251c\u2500centos-root xfs 66b2362b-959c-4eb7-b2e5-a917172f56a7 \/\r\n \u2514\u2500centos-swap swap 1eefbfad-a121-48ae-ac30-3b042cd56b91 [SWAP]\r\nsdb\r\nsdc\r\nsr0<\/pre>\n<ul>\n<li>fdisk -l &#8211;&gt; liste des disques physiques et partitions associ\u00e9es<\/li>\n<\/ul>\n<pre>Disque \/dev\/sda : 8589 Mo, 8589934592 octets, 16777216 secteurs\r\nUnit\u00e9s = secteur de 1 \u00d7 512 = 512 octets\r\nTaille de secteur (logique \/ physique) : 512 octets \/ 512 octets\r\ntaille d'E\/S (minimale \/ optimale) : 512 octets \/ 512 octets\r\nType d'\u00e9tiquette de disque : dos\r\nIdentifiant de disque : 0x000c9656\r\n\r\nP\u00e9riph\u00e9rique Amor\u00e7age D\u00e9but Fin Blocs Id. Syst\u00e8me\r\n\/dev\/sda1 * 2048 2099199 1048576 83 Linux\r\n\/dev\/sda2 2099200 16777215 7339008 8e Linux LVM\r\n\r\nDisque \/dev\/sdb : 1060 Mo, 1060025856 octets, 2070363 secteurs\r\nUnit\u00e9s = secteur de 1 \u00d7 512 = 512 octets\r\nTaille de secteur (logique \/ physique) : 512 octets \/ 512 octets\r\ntaille d'E\/S (minimale \/ optimale) : 512 octets \/ 512 octets\r\n\r\n\r\nDisque \/dev\/sdc : 1157 Mo, 1157994496 octets, 2261708 secteurs\r\nUnit\u00e9s = secteur de 1 \u00d7 512 = 512 octets\r\nTaille de secteur (logique \/ physique) : 512 octets \/ 512 octets\r\ntaille d'E\/S (minimale \/ optimale) : 512 octets \/ 512 octets\r\n\r\n\r\nDisque \/dev\/mapper\/centos-root : 6652 Mo, 6652166144 octets, 12992512 secteurs\r\nUnit\u00e9s = secteur de 1 \u00d7 512 = 512 octets\r\nTaille de secteur (logique \/ physique) : 512 octets \/ 512 octets\r\ntaille d'E\/S (minimale \/ optimale) : 512 octets \/ 512 octets\r\n\r\n\r\nDisque \/dev\/mapper\/centos-swap : 859 Mo, 859832320 octets, 1679360 secteurs\r\nUnit\u00e9s = secteur de 1 \u00d7 512 = 512 octets\r\nTaille de secteur (logique \/ physique) : 512 octets \/ 512 octets\r\ntaille d'E\/S (minimale \/ optimale) : 512 octets \/ 512 octets<\/pre>\n<p>&nbsp;<\/p>\n<h1><span class=\"ez-toc-section\" id=\"II_Visualisation_des_filesystem\"><\/span>II Visualisation des filesystem<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<ul>\n<li>df -h<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<pre>Sys. de fichiers Taille Utilis\u00e9 Dispo Uti% Mont\u00e9 sur\r\n\/dev\/mapper\/centos-root 6,2G 1,1G 5,1G 18% \/\r\ndevtmpfs 485M 0 485M 0% \/dev\r\ntmpfs 496M 0 496M 0% \/dev\/shm\r\ntmpfs 496M 6,8M 490M 2% \/run\r\ntmpfs 496M 0 496M 0% \/sys\/fs\/cgroup\r\n\/dev\/sda1 1014M 129M 886M 13% \/boot\r\ntmpfs 100M 0 100M 0% \/run\/user\/0<\/pre>\n<ul>\n<li>mount \/ mount -l<\/li>\n<li>fdisk -l (partition + disque physique)<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h1><span class=\"ez-toc-section\" id=\"III_LVM\"><\/span>III LVM<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<h2><span class=\"ez-toc-section\" id=\"III1_Presentation\"><\/span>III.1 Pr\u00e9sentation<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Logical Volume Manager  ou gestionnaire de volumes logiques en fran\u00e7ais.<\/p>\n<ul>\n<li>Remplace le traditionnel partionnement logique des disques.<\/li>\n<li>Op\u00e9ration de redimensionnement moins risqu\u00e9 que sur une partition logique<\/li>\n<li>Inconv\u00e9nient : si disque physique HS l&rsquo;ensemble du volume logique est HS (utiliser des disques en RAID)<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"III2_Vocabulaire\"><\/span>III.2 Vocabulaire:<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li>Volume physique ou PV (Physical Volume)\n<ul>\n<li>C&rsquo;est un disque ou une partition. Il sera confi\u00e9 \u00e0 LVM<\/li>\n<\/ul>\n<\/li>\n<li>Groupe de volumes ou VG (Volume Group)\n<ul>\n<li>C&rsquo;est un ensemble de volumes physiques<\/li>\n<\/ul>\n<\/li>\n<li>Volume logique ou LV (Logical Volume)\n<ul>\n<li>C&rsquo;est un espace d\u00e9fini dans un groupe de volume (VG). Ce dernier aura un syst\u00e8me de fichiers<\/li>\n<li>D\u00e9conseill\u00e9 pour le moment d&rsquo;y mettre \/boot<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"III3_Listes_des_principales_commandes\"><\/span>III.3 Listes des principales commandes<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Liste des princiaples commandes LVM pour manipuler les Volumes Physiques (PV) : man -k ^pv<\/p>\n<pre>pvchange (8) - Change attributes of physical volume(s)\r\npvck (8) - Check the consistency of physical volume(s)\r\npvcreate (8) - Initialize physical volume(s) for use by LVM\r\npvdisplay (8) - Display various attributes of physical volume(s)\r\npvmove (8) - Move extents from one physical volume to another\r\npvremove (8) - Remove LVM label(s) from physical volume(s)\r\npvresize (8) - Resize physical volume(s)\r\npvs (8) - Display information about physical volumes\r\npvscan (8) - List all physical volumes<\/pre>\n<p>&nbsp;<\/p>\n<p>Liste des princiaples commandes LVM pour manipuler les Groupes de Volumes (VG) : man -k ^vg<\/p>\n<pre>vgcfgbackup (8) - Backup volume group configuration(s)\r\nvgcfgrestore (8) - Restore volume group configuration\r\nvgchange (8) - Change volume group attributes\r\nvgck (8) - Check the consistency of volume group(s)\r\nvgconvert (8) - Change volume group metadata format\r\nvgcreate (8) - Create a volume group\r\nvgdisplay (8) - Display volume group information\r\nvgexport (8) - Unregister volume group(s) from the system\r\nvgextend (8) - Add physical volumes to a volume group\r\nvgimport (8) - Register exported volume group with system\r\nvgimportclone (8) - Import a VG from cloned PVs\r\nvgmerge (8) - Merge volume groups\r\nvgmknodes (8) - Create the special files for volume group devices in \/dev\r\nvgreduce (8) - Remove physical volume(s) from a volume group\r\nvgremove (8) - Remove volume group(s)\r\nvgrename (8) - Rename a volume group\r\nvgs (8) - Display information about volume groups\r\nvgscan (8) - Search for all volume groups\r\nvgsplit (8) - Move physical volumes into a new or existing volume group<\/pre>\n<p>Liste des princiaples commandes LVM pour manipuler les  Volumes Logiques (LV) : man -k ^lg<\/p>\n<pre>lvchange (8) - Change the attributes of logical volume(s)\r\nlvconvert (8) - Change logical volume layout\r\nlvcreate (8) - Create a logical volume\r\nlvdisplay (8) - Display information about a logical volume\r\nlvextend (8) - Add space to a logical volume\r\nlvm (8) - LVM2 tools\r\nlvm-config (8) - Display and manipulate configuration information\r\nlvm-dumpconfig (8) - Display and manipulate configuration information\r\nlvm-fullreport (8) - (sujet inconnu)\r\nlvm-lvpoll (8) - (sujet inconnu)\r\nlvm.conf (5) - Configuration file for LVM2\r\nlvm2-activation-generator (8) - generator for systemd units to activate LVM2 volumes on boot\r\nlvmcache (7) - LVM caching\r\nlvmconf (8) - LVM configuration modifier\r\nlvmconfig (8) - Display and manipulate configuration information\r\nlvmdiskscan (8) - List devices that may be used as physical volumes\r\nlvmdump (8) - create lvm2 information dumps for diagnostic purposes\r\nlvmetad (8) - LVM metadata cache daemon\r\nlvmpolld (8) - LVM poll daemon\r\nlvmraid (7) - LVM RAID\r\nlvmreport (7) - LVM reporting and related features\r\nlvmsadc (8) - LVM system activity data collector\r\nlvmsar (8) - LVM system activity reporter\r\nlvmsystemid (7) - LVM system ID\r\nlvmthin (7) - LVM thin provisioning\r\nlvreduce (8) - Reduce the size of a logical volume\r\nlvremove (8) - Remove logical volume(s) from the system\r\nlvrename (8) - Rename a logical volume\r\nlvresize (8) - Resize a logical volume\r\nlvs (8) - Display information about logical volumes\r\nlvscan (8) - List all logical volumes in all volume groups<\/pre>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"III4_Groupes_de_Volumes_VG\"><\/span>III.4 Groupes de Volumes (VG)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"III41_Afficher_la_liste_des_groupes_de_volumes\"><\/span>III.4.1 Afficher la liste des groupes de volumes :<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>vgdisplay -s<\/li>\n<\/ul>\n<pre>\"centos\" &lt;7,00 GiB [&lt;7,00 GiB used \/ 0 free]<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"III42_Creation_dun_groupe_de_volume_sur_le_disque_sdc\"><\/span>III.4.2 Cr\u00e9ation d&rsquo;un groupe de volume sur le disque sdc<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>vgcreate mon_vol_grp \/dev\/sdc<\/p>\n<pre>Volume group \"mon_vol_grp\" successfully created<\/pre>\n<p>ce qui donne apr\u00e8s un vgdisplay :<\/p>\n<pre><strong> \"mon_vol_grp\" 1,07 GiB [0 used \/ 1,07 GiB free]<\/strong>\r\n \"centos\" &lt;7,00 GiB [&lt;7,00 GiB used \/ 0 free]<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"III43_Suppression_dun_groupe_de_volumes\"><\/span>III.4.3 Suppression d&rsquo;un groupe de volumes<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>vgremove mon_vol_grp<\/p>\n<pre> Volume group \"mon_vol_grp\" successfully removed<\/pre>\n<p>R\u00e9sultat apr\u00e8s un vg display :<\/p>\n<pre> \"centos\" &lt;7,00 GiB [&lt;7,00 GiB used \/ 0 free]<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"III5_Volumes_Logiques_VL\"><\/span>III.5 Volumes Logiques (VL)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"III51_Afficher_les_volumes_logiques\"><\/span>III.5.1 Afficher les volumes logiques<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>lvdisplay<\/li>\n<\/ul>\n<pre>--- Logical volume ---\r\n<strong> LV Path \/dev\/centos\/swap\r\n LV Name swap\r\n VG Name centos<\/strong>\r\n LV UUID EWn4T0-2cLo-SWFu-skUZ-YiJ0-6bww-WywdiB\r\n LV Write Access read\/write\r\n LV Creation host, time localhost, 2018-07-27 11:40:49 +0200\r\n LV Status available\r\n # open 2\r\n LV Size 820,00 MiB\r\n Current LE 205\r\n Segments 1\r\n Allocation inherit\r\n Read ahead sectors auto\r\n - currently set to 8192\r\n Block device 253:1\r\n\r\n--- Logical volume ---\r\n<strong> LV Path \/dev\/centos\/root\r\n LV Name root\r\n VG Name centos<\/strong>\r\n LV UUID J9QkbE-3a1e-AQ4k-lupo-aFZB-3m3g-n3e3kO\r\n LV Write Access read\/write\r\n LV Creation host, time localhost, 2018-07-27 11:40:49 +0200\r\n LV Status available\r\n # open 1\r\n LV Size &lt;6,20 GiB\r\n Current LE 1586\r\n Segments 1\r\n Allocation inherit\r\n Read ahead sectors auto\r\n - currently set to 8192\r\n Block device 253:0<\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"III52_Creation_dun_volume_logique\"><\/span>III.5.2 Cr\u00e9ation d&rsquo;un volume logique<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Cr\u00e9ation d&rsquo;un volume logique (LG) sur le volume groupe \u00ab\u00a0mon_vol_grp\u00a0\u00bb<\/p>\n<ul>\n<li>lvcreate -n Vol_log1 -L 100m mon_vol_grp<\/li>\n<li>lvcreate -n Vol_log2 -L 200m mon_vol_grp<\/li>\n<\/ul>\n<pre> Logical volume \"Vol_log1\" created.\r\n Logical volume \"Vol_log2\" created.<\/pre>\n<p>R\u00e9sultat apr\u00e8s un lvdisplay :<\/p>\n<pre>--- Logical volume ---\r\n<strong> LV Path \/dev\/mon_vol_grp\/Vol_log1\r\n LV Name Vol_log1\r\n VG Name mon_vol_grp<\/strong>\r\n LV UUID IrFfsZ-2saw-meMq-KiAe-sK39-mAEw-2adMv2\r\n LV Write Access read\/write\r\n LV Creation host, time localhost.localdomain, 2018-08-09 17:45:06 +0200\r\n LV Status available\r\n # open 0\r\n LV Size 100,00 MiB\r\n Current LE 25\r\n Segments 1\r\n Allocation inherit\r\n Read ahead sectors auto\r\n - currently set to 8192\r\n Block device 253:2\r\n\r\n--- Logical volume ---\r\n<strong> LV Path \/dev\/mon_vol_grp\/Vol_log2\r\n LV Name Vol_log2\r\n VG Name mon_vol_grp<\/strong>\r\n LV UUID IZPMp7-9cUV-eAxs-y8N9-cVE7-S7xZ-u60cWf\r\n LV Write Access read\/write\r\n LV Creation host, time localhost.localdomain, 2018-08-09 17:45:20 +0200\r\n LV Status available\r\n # open 0\r\n LV Size 200,00 MiB\r\n Current LE 50\r\n Segments 1\r\n Allocation inherit\r\n Read ahead sectors auto\r\n - currently set to 8192\r\n Block device 253:3\r\n\r\n--- Logical volume ---\r\n LV Path \/dev\/centos\/swap\r\n LV Name swap\r\n VG Name centos\r\n LV UUID EWn4T0-2cLo-SWFu-skUZ-YiJ0-6bww-WywdiB\r\n LV Write Access read\/write\r\n LV Creation host, time localhost, 2018-07-27 11:40:49 +0200\r\n LV Status available\r\n # open 2\r\n LV Size 820,00 MiB\r\n Current LE 205\r\n Segments 1\r\n Allocation inherit\r\n Read ahead sectors auto\r\n - currently set to 8192\r\n Block device 253:1\r\n\r\n--- Logical volume ---\r\n LV Path \/dev\/centos\/root\r\n LV Name root\r\n VG Name centos\r\n LV UUID J9QkbE-3a1e-AQ4k-lupo-aFZB-3m3g-n3e3kO\r\n LV Write Access read\/write\r\n LV Creation host, time localhost, 2018-07-27 11:40:49 +0200\r\n LV Status available\r\n # open 1\r\n LV Size &lt;6,20 GiB\r\n Current LE 1586\r\n Segments 1\r\n Allocation inherit\r\n Read ahead sectors auto\r\n - currently set to 8192\r\n Block device 253:0<\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"III53_Formatter_un_volume_logique\"><\/span>III.5.3 Formatter un volume logique<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Mise en place d&rsquo;un syst\u00e8me de fichiers pour les 2 volumes logiques cr\u00e9\u00e9s :<\/p>\n<ul>\n<li>mkfs -t ext4 \/dev\/mon_vol_grp\/Vol_log1<\/li>\n<li>mkfs -t ext4 \/dev\/mon_vol_grp\/Vol_log2<\/li>\n<\/ul>\n<p>Sortie pour la cr\u00e9ation du premier syst\u00e8me de fichiers :<\/p>\n<pre>mke2fs 1.42.9 (28-Dec-2013)\r\n\u00c9tiquette de syst\u00e8me de fichiers=\r\nType de syst\u00e8me d'exploitation : Linux\r\nTaille de bloc=1024 (log=0)\r\nTaille de fragment=1024 (log=0)\r\n\u00ab Stride \u00bb = 0 blocs, \u00ab Stripe width \u00bb = 0 blocs\r\n25688 i-noeuds, 102400 blocs\r\n5120 blocs (5.00%) r\u00e9serv\u00e9s pour le super utilisateur\r\nPremier bloc de donn\u00e9es=1\r\nNombre maximum de blocs du syst\u00e8me de fichiers=33685504\r\n13 groupes de blocs\r\n8192 blocs par groupe, 8192 fragments par groupe\r\n1976 i-noeuds par groupe\r\nSuperblocs de secours stock\u00e9s sur les blocs :\r\n 8193, 24577, 40961, 57345, 73729\r\n\r\nAllocation des tables de groupe : compl\u00e9t\u00e9\r\n\u00c9criture des tables d'i-noeuds : compl\u00e9t\u00e9\r\nCr\u00e9ation du journal (4096 blocs) : compl\u00e9t\u00e9\r\n\u00c9criture des superblocs et de l'information de comptabilit\u00e9 du syst\u00e8me de\r\nfichiers : compl\u00e9t\u00e9<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"III54_Monter_un_volume_logique\"><\/span>III.5.4 Monter un volume logique<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>mkdir \/LVM_exemple<\/li>\n<li>mount \/dev\/mon_vol_grp\/Vol_log1 \/LVM_exemple\/<\/li>\n<li>lsblk<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<pre>NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT\r\nsda 8:0 0 8G 0 disk\r\n\u251c\u2500sda1 8:1 0 1G 0 part \/boot\r\n\u2514\u2500sda2 8:2 0 7G 0 part\r\n \u251c\u2500centos-root 253:0 0 6,2G 0 lvm \/\r\n \u2514\u2500centos-swap 253:1 0 820M 0 lvm [SWAP]\r\nsdb 8:16 0 1010,9M 0 disk\r\n<strong>sdc 8:32 0 1,1G 0 disk<\/strong>\r\n<strong>\u251c\u2500mon_vol_grp-Vol_log1 253:2 0 100M 0 lvm \/LVM_exemple<\/strong>\r\n<strong>\u2514\u2500mon_vol_grp-Vol_log2 253:3 0 200M 0 lvm<\/strong>\r\nsr0 11:0 1 1024M 0 rom\r\n\r\n<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"III55_Supprimer_un_volume_logique\"><\/span>III.5.5 Supprimer un volume logique<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>umount \/LVM_exemple\/<\/li>\n<li>lvremove \/dev\/mon_vol_grp\/Vol_log1<\/li>\n<\/ul>\n<pre>Do you really want to remove active logical volume mon_vol_grp\/Vol_log1? [y\/n]: y\r\n Logical volume \"Vol_log1\" successfully removed<\/pre>\n<ul>\n<li>lsblk<\/li>\n<\/ul>\n<pre>NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT\r\nsda 8:0 0 8G 0 disk\r\n\u251c\u2500sda1 8:1 0 1G 0 part \/boot\r\n\u2514\u2500sda2 8:2 0 7G 0 part\r\n \u251c\u2500centos-root 253:0 0 6,2G 0 lvm \/\r\n \u2514\u2500centos-swap 253:1 0 820M 0 lvm [SWAP]\r\nsdb 8:16 0 1010,9M 0 disk\r\nsdc 8:32 0 1,1G 0 disk\r\n\u2514\u2500mon_vol_grp-Vol_log2 253:3 0 200M 0 lvm\r\nsr0 11:0 1 1024M 0 rom<\/pre>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"III5_Redimmensionner\"><\/span>III.5 Redimmensionner<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"III51_Augmenter_un_volume_logique\"><\/span>III.5.1 Augmenter un volume logique<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>pvcreate \/dev\/sdb  <em> #cr\u00e9ation d&rsquo;un volume physique sur le disque sdb<\/em><\/li>\n<li>vgextend mon_vol_grp \/dev\/sdb   <em># ajout de ce voulme physique dans le volume groupe \u00ab\u00a0mon_vol_grp\u00a0\u00bb<\/em><\/li>\n<\/ul>\n<pre> Physical volume \"\/dev\/sdb\" successfully created.\r\n Volume group \"mon_vol_grp\" successfully extended<\/pre>\n<p>Apr\u00e8s un pvdisplay :<\/p>\n<pre>--- Physical volume ---\r\n<strong> PV Name \/dev\/sdc<\/strong>\r\n<strong> VG Name mon_vol_grp<\/strong>\r\n PV Size &lt;1,08 GiB \/ not usable &lt;4,35 MiB\r\n Allocatable yes\r\n PE Size 4,00 MiB\r\n Total PE 275\r\n Free PE 225\r\n Allocated PE 50\r\n PV UUID iySi5C-exUY-dBD0-ml14-2KdL-0SSS-j2vkAu\r\n\r\n--- Physical volume ---\r\n<strong> PV Name \/dev\/sdb<\/strong>\r\n<strong> VG Name mon_vol_grp<\/strong>\r\n PV Size &lt;1010,92 MiB \/ not usable &lt;2,92 MiB\r\n Allocatable yes\r\n PE Size 4,00 MiB\r\n Total PE 252\r\n Free PE 252\r\n Allocated PE 0\r\n PV UUID Ffe1Wt-R94x-UyVh-kzJN-m2cR-vCc8-JPfHuj\r\n\r\n--- Physical volume ---\r\n PV Name \/dev\/sda2\r\n VG Name centos\r\n PV Size &lt;7,00 GiB \/ not usable 3,00 MiB\r\n Allocatable yes (but full)\r\n PE Size 4,00 MiB\r\n Total PE 1791\r\n Free PE 0\r\n Allocated PE 1791\r\n PV UUID i63M7M-z29v-ccrO-58fh-UVbx-OZYq-yLBhNf<\/pre>\n<p>On voit maintenant que le volume de groupe \u00ab\u00a0mon_vol_grp\u00a0\u00bb repose sur <strong>2<\/strong> disques physiques.<\/p>\n<p>Autre commande permettant une lecture plus simple : pvscan<\/p>\n<pre><strong> PV \/dev\/<span style=\"color: #993300;\">sdc<\/span> VG <span style=\"color: #993300;\">mon_vol_grp<\/span> lvm2 [1,07 GiB \/ 900,00 MiB free]\r\n PV \/dev\/<span style=\"color: #993300;\">sdb<\/span> VG <span style=\"color: #993300;\">mon_vol_grp<\/span> lvm2 [1008,00 MiB \/ 1008,00 MiB free]<\/strong>\r\n PV \/dev\/sda2 VG centos lvm2 [&lt;7,00 GiB \/ 0 free]\r\n Total: 3 [9,05 GiB] \/ in use: 3 [9,05 GiB] \/ in no VG: 0 [0 ]<\/pre>\n<p>Il faut maintenant redimmensionner le volume logique<\/p>\n<ul>\n<li>lvresize &#8211;resizefs &#8211;size +1,5G \/dev\/mon_vol_grp\/Vol_log2<\/li>\n<\/ul>\n<pre>fsck de util-linux 2.23.2\r\n\/dev\/mapper\/mon_vol_grp-Vol_log2 : propre, 11\/51200 fichiers, 12115\/204800 blocs\r\n Size of logical volume mon_vol_grp\/Vol_log2 changed from 200,00 MiB (50 extents) to &lt;1,70 GiB (434 extents).\r\n Logical volume mon_vol_grp\/Vol_log2 successfully resized.\r\nresize2fs 1.42.9 (28-Dec-2013)\r\nEn train de redimensionner le syst\u00e8me de fichiers sur \/dev\/mapper\/mon_vol_grp-Vol_log2 \u00e0 1777664 (1k) blocs.\r\nLe syst\u00e8me de fichiers \/dev\/mapper\/mon_vol_grp-Vol_log2 a maintenant une taille de 1777664 blocs.<\/pre>\n<p>V\u00e9rification de l&rsquo;augmentation d&rsquo;espace du volume logique : lvdisplay<\/p>\n<p>&nbsp;<\/p>\n<pre>--- Logical volume ---\r\n<strong> LV Path \/dev\/mon_vol_grp\/Vol_log2<\/strong>\r\n<strong> LV Name Vol_log2<\/strong>\r\n<strong> VG Name mon_vol_grp<\/strong>\r\n LV UUID IZPMp7-9cUV-eAxs-y8N9-cVE7-S7xZ-u60cWf\r\n LV Write Access read\/write\r\n LV Creation host, time localhost.localdomain, 2018-08-09 17:45:20 +0200\r\n LV Status available\r\n # open 0\r\n<span style=\"color: #993300;\"><strong> LV Size &lt;1,70 GiB<\/strong><\/span>\r\n Current LE 434\r\n Segments 3\r\n Allocation inherit\r\n Read ahead sectors auto\r\n - currently set to 8192\r\n Block device 253:3\r\n\r\n--- Logical volume ---\r\n LV Path \/dev\/centos\/swap\r\n LV Name swap\r\n VG Name centos\r\n LV UUID EWn4T0-2cLo-SWFu-skUZ-YiJ0-6bww-WywdiB\r\n LV Write Access read\/write\r\n LV Creation host, time localhost, 2018-07-27 11:40:49 +0200\r\n LV Status available\r\n # open 2\r\n LV Size 820,00 MiB\r\n Current LE 205\r\n Segments 1\r\n Allocation inherit\r\n Read ahead sectors auto\r\n - currently set to 8192\r\n Block device 253:1\r\n\r\n--- Logical volume ---\r\n LV Path \/dev\/centos\/root\r\n LV Name root\r\n VG Name centos\r\n LV UUID J9QkbE-3a1e-AQ4k-lupo-aFZB-3m3g-n3e3kO\r\n LV Write Access read\/write\r\n LV Creation host, time localhost, 2018-07-27 11:40:49 +0200\r\n LV Status available\r\n # open 1\r\n LV Size &lt;6,20 GiB\r\n Current LE 1586\r\n Segments 1\r\n Allocation inherit\r\n Read ahead sectors auto\r\n - currently set to 8192\r\n Block device 253:0<\/pre>\n<pre><\/pre>\n<p>Voir effectivement que le filesystem est bien augment\u00e9 :<\/p>\n<ul>\n<li>mount \/dev\/mon_vol_grp\/Vol_log2 \/LVM_exemple\/<\/li>\n<li>df -h<\/li>\n<\/ul>\n<pre>Sys. de fichiers Taille Utilis\u00e9 Dispo Uti% Mont\u00e9 sur\r\n\/dev\/mapper\/centos-root 6,2G 1,1G 5,1G 18% \/\r\ndevtmpfs 485M 0 485M 0% \/dev\r\ntmpfs 496M 0 496M 0% \/dev\/shm\r\ntmpfs 496M 6,8M 490M 2% \/run\r\ntmpfs 496M 0 496M 0% \/sys\/fs\/cgroup\r\n\/dev\/sda1 1014M 129M 886M 13% \/boot\r\ntmpfs 100M 0 100M 0% \/run\/user\/0\r\n<strong>\/dev\/mapper\/mon_vol_grp-Vol_log2 <span style=\"color: #993300;\">1,7G<\/span> 2,7M 1,6G 1% \/LVM_exemple<\/strong><\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"III52_Reduire_un_volume_logique\"><\/span>III.5.2 R\u00e9duire un volume logique<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>&nbsp;<\/p>\n<ul>\n<li>lvresize &#8211;resizefs &#8211;size -1,5G \/dev\/mon_vol_grp\/Vol_log2<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<pre>Do you want to unmount \"\/LVM_exemple\" ? [Y|n] y\r\nfsck de util-linux 2.23.2\r\n\/dev\/mapper\/mon_vol_grp-Vol_log2 : 11\/444416 fichiers (0.0% non contig\u00fcs), 62946\/1777664 blocs\r\nresize2fs 1.42.9 (28-Dec-2013)\r\nEn train de redimensionner le syst\u00e8me de fichiers sur \/dev\/mapper\/mon_vol_grp-Vol_log2 \u00e0 204800 (1k) blocs.\r\nLe syst\u00e8me de fichiers \/dev\/mapper\/mon_vol_grp-Vol_log2 a maintenant une taille de 204800 blocs.\r\n\r\nSize of logical volume mon_vol_grp\/Vol_log2 changed from &lt;1,70 GiB (434 extents) to 200,00 MiB (50 extents).\r\n Logical volume mon_vol_grp\/Vol_log2 successfully resized.<\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"III53_Enlever_un_disque_physique_dun_groupe_de_volumes\"><\/span>III.5.3 Enlever un disque physique d&rsquo;un groupe de volumes<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Enlever le volume physique du volume groupe :<\/p>\n<ul>\n<li>vgreduce mon_vol_grp \/dev\/sdb<\/li>\n<\/ul>\n<pre> Removed \"\/dev\/sdb\" from volume group \"mon_vol_grp\"<\/pre>\n<p>R\u00e9sultat apr\u00e8s un pvscan :<\/p>\n<pre> PV \/dev\/sdc VG mon_vol_grp lvm2 [1,07 GiB \/ 900,00 MiB free]\r\n PV \/dev\/sda2 VG centos lvm2 [&lt;7,00 GiB \/ 0 free]\r\n <strong>PV \/dev\/sdb lvm2 [&lt;1010,92 MiB]<\/strong>\r\n Total: 3 [&lt;9,06 GiB] \/ in use: 2 [8,07 GiB] \/ in no VG: 1 [&lt;1010,92 MiB]<\/pre>\n<p>Suppression du volume physique :<\/p>\n<ul>\n<li>pvremove \/dev\/sdb<\/li>\n<\/ul>\n<p>V\u00e9rification avec pvscan :<\/p>\n<pre> PV \/dev\/sdc VG mon_vol_grp lvm2 [1,07 GiB \/ 900,00 MiB free]\r\n PV \/dev\/sda2 VG centos lvm2 [&lt;7,00 GiB \/ 0 free]\r\n Total: 2 [8,07 GiB] \/ in use: 2 [8,07 GiB] \/ in no VG: 0 [0 ]<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Dans notre cas un Linux CENTOS 7 a \u00e9t\u00e9 install\u00e9 sur un disque de 8Go d\u00e9j\u00e0 existant. A l&rsquo;issue 2 disques de 1 Go ont \u00e9t\u00e9 ajout\u00e9s I Disques \/ partition Lister les disques physiques vu par le syst\u00e8me :<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-528","post","type-post","status-publish","format-standard","hentry","category-_systeme"],"_links":{"self":[{"href":"https:\/\/blogperso.union31.fr\/index.php?rest_route=\/wp\/v2\/posts\/528","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogperso.union31.fr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogperso.union31.fr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogperso.union31.fr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogperso.union31.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=528"}],"version-history":[{"count":48,"href":"https:\/\/blogperso.union31.fr\/index.php?rest_route=\/wp\/v2\/posts\/528\/revisions"}],"predecessor-version":[{"id":576,"href":"https:\/\/blogperso.union31.fr\/index.php?rest_route=\/wp\/v2\/posts\/528\/revisions\/576"}],"wp:attachment":[{"href":"https:\/\/blogperso.union31.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=528"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogperso.union31.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=528"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogperso.union31.fr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=528"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}