Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
elearning:workbooks:lpic:21:450:l105 [2022/10/04 12:44] – created admin | elearning:workbooks:lpic:21:450:l105 [2022/11/01 07:27] (Version actuelle) – admin | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | ======Topic | + | ~~PDF: |
+ | |||
+ | Version : **2022.01** | ||
+ | |||
+ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
+ | |||
+ | ======Topic | ||
+ | |||
+ | * **Topic 204: Advanced Storage Device Administration** | ||
+ | * Logical Volume Manager (LVM) | ||
+ | * LAB #1 - Volumes Logiques Linéaires | ||
+ | * Physical Volume (PV) | ||
+ | * Volume Group (VG) et Physical Extent (PE) | ||
+ | * Logical Volumes (LV) | ||
+ | * LAB #2 - Étendre un Volume Logique à Chaud | ||
+ | * LAB #3 - Snapshots | ||
+ | * LAB #4 - Suppression des Volumes | ||
+ | * LAB #5 - Volumes Logiques en Miroir | ||
+ | * LAB #6 - Modifier les Attributs LVM | ||
+ | * LAB #7 - Volumes Logiques en Bandes | ||
+ | * LAB #8 - Gérer les Métadonnées | ||
+ | * RAID Logiciel | ||
+ | * Concepts RAID | ||
+ | * Disques en miroir | ||
+ | * Bandes de données | ||
+ | * Types de RAID | ||
+ | * RAID 0 - Concaténation | ||
+ | * RAID 0 - Striping | ||
+ | * RAID 1 - Miroir | ||
+ | * RAID 1+0 - Striping en Miroir | ||
+ | * RAID 2 - Miroir avec Contrôle d' | ||
+ | * RAID 3 et 4 - Striping avec Parité | ||
+ | * RAID 5 - Striping avec Parité Distribuée | ||
+ | * Au délà de RAID 5 | ||
+ | * LAB #9 - Mise en Place du RAID 5 Logiciel | ||
+ | * 9.1 - Préparer le disque | ||
+ | * 9.2 - Créer une Unité RAID | ||
+ | * 9.3 - Remplacer une Unité Défaillante | ||
+ | * LAB #10 - autofs | ||
+ | |||
+ | =====Logical Volume Manager (LVM)===== | ||
+ | |||
+ | ====LAB #1 - Volumes Logiques Linéaires==== | ||
+ | |||
+ | Afin de mettre en place le LVM, vous avez besoin du paquet **lvm2** et du paquet **device-mapper**. | ||
+ | |||
+ | Sous Debian 11, installez le paquet lvm2 : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Nous allons travailler avec les partitions suivantes : | ||
+ | |||
+ | < | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Pour initialiser le LVM saississez la commande suivante : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **vgscan** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | vgscan - Search for all volume groups | ||
+ | |||
+ | vgscan | ||
+ | [ --ignorelockingfailure ] | ||
+ | [ --mknodes ] | ||
+ | [ --notifydbus ] | ||
+ | [ --reportformat basic|json ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Common options for lvm: | ||
+ | [ -d|--debug ] | ||
+ | [ -h|--help ] | ||
+ | [ -q|--quiet ] | ||
+ | [ -v|--verbose ] | ||
+ | [ -y|--yes ] | ||
+ | [ -t|--test ] | ||
+ | [ --commandprofile String ] | ||
+ | [ --config String ] | ||
+ | [ --driverloaded y|n ] | ||
+ | [ --nolocking ] | ||
+ | [ --lockopt String ] | ||
+ | [ --longhelp ] | ||
+ | [ --profile String ] | ||
+ | [ --version ] | ||
+ | |||
+ | Use --longhelp to show all options and advanced commands. | ||
+ | </ | ||
+ | |||
+ | ===Physical Volume (PV)=== | ||
+ | |||
+ | Pour créer le **PV** il convient d' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Physical volume "/ | ||
+ | Physical volume "/ | ||
+ | Physical volume "/ | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **pvcreate** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | pvcreate - Initialize physical volume(s) for use by LVM | ||
+ | |||
+ | pvcreate PV ... | ||
+ | [ -f|--force ] | ||
+ | [ -M|--metadatatype lvm2 ] | ||
+ | [ -u|--uuid String ] | ||
+ | [ -Z|--zero y|n ] | ||
+ | [ --dataalignment Size[k|UNIT] ] | ||
+ | [ --dataalignmentoffset Size[k|UNIT] ] | ||
+ | [ --bootloaderareasize Size[m|UNIT] ] | ||
+ | [ --labelsector Number ] | ||
+ | [ --pvmetadatacopies 0|1|2 ] | ||
+ | [ --metadatasize Size[m|UNIT] ] | ||
+ | [ --metadataignore y|n ] | ||
+ | [ --norestorefile ] | ||
+ | [ --setphysicalvolumesize Size[m|UNIT] ] | ||
+ | [ --reportformat basic|json ] | ||
+ | [ --restorefile String ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Common options for lvm: | ||
+ | [ -d|--debug ] | ||
+ | [ -h|--help ] | ||
+ | [ -q|--quiet ] | ||
+ | [ -v|--verbose ] | ||
+ | [ -y|--yes ] | ||
+ | [ -t|--test ] | ||
+ | [ --commandprofile String ] | ||
+ | [ --config String ] | ||
+ | [ --driverloaded y|n ] | ||
+ | [ --nolocking ] | ||
+ | [ --lockopt String ] | ||
+ | [ --longhelp ] | ||
+ | [ --profile String ] | ||
+ | [ --version ] | ||
+ | |||
+ | Use --longhelp to show all options and advanced commands. | ||
+ | </ | ||
+ | |||
+ | Pour visualiser le PV il convient d' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | "/ | ||
+ | --- NEW Physical volume --- | ||
+ | PV Name / | ||
+ | VG Name | ||
+ | PV Size | ||
+ | Allocatable | ||
+ | PE Size | ||
+ | Total PE 0 | ||
+ | Free PE 0 | ||
+ | Allocated PE 0 | ||
+ | PV UUID | ||
+ | |||
+ | "/ | ||
+ | --- NEW Physical volume --- | ||
+ | PV Name / | ||
+ | VG Name | ||
+ | PV Size | ||
+ | Allocatable | ||
+ | PE Size | ||
+ | Total PE 0 | ||
+ | Free PE 0 | ||
+ | Allocated PE 0 | ||
+ | PV UUID | ||
+ | |||
+ | "/ | ||
+ | --- NEW Physical volume --- | ||
+ | PV Name / | ||
+ | VG Name | ||
+ | PV Size | ||
+ | Allocatable | ||
+ | PE Size | ||
+ | Total PE 0 | ||
+ | Free PE 0 | ||
+ | Allocated PE 0 | ||
+ | PV UUID | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **pvdisplay** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | pvdisplay - Display various attributes of physical volume(s) | ||
+ | |||
+ | pvdisplay | ||
+ | [ -a|--all ] | ||
+ | [ -c|--colon ] | ||
+ | [ -C|--columns ] | ||
+ | [ -m|--maps ] | ||
+ | [ -o|--options String ] | ||
+ | [ -S|--select String ] | ||
+ | [ -s|--short ] | ||
+ | [ -O|--sort String ] | ||
+ | [ --aligned ] | ||
+ | [ --binary ] | ||
+ | [ --configreport log|vg|lv|pv|pvseg|seg ] | ||
+ | [ --foreign ] | ||
+ | [ --ignorelockingfailure ] | ||
+ | [ --logonly ] | ||
+ | [ --noheadings ] | ||
+ | [ --nosuffix ] | ||
+ | [ --readonly ] | ||
+ | [ --reportformat basic|json ] | ||
+ | [ --separator String ] | ||
+ | [ --shared ] | ||
+ | [ --unbuffered ] | ||
+ | [ --units r|R|h|H|b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV|Tag ... ] | ||
+ | |||
+ | Common options for lvm: | ||
+ | [ -d|--debug ] | ||
+ | [ -h|--help ] | ||
+ | [ -q|--quiet ] | ||
+ | [ -v|--verbose ] | ||
+ | [ -y|--yes ] | ||
+ | [ -t|--test ] | ||
+ | [ --commandprofile String ] | ||
+ | [ --config String ] | ||
+ | [ --driverloaded y|n ] | ||
+ | [ --nolocking ] | ||
+ | [ --lockopt String ] | ||
+ | [ --longhelp ] | ||
+ | [ --profile String ] | ||
+ | [ --version ] | ||
+ | |||
+ | Use --longhelp to show all options and advanced commands. | ||
+ | </ | ||
+ | |||
+ | ===Volume Group (VG) et Physical Extent (PE)=== | ||
+ | |||
+ | Pour créer un Volume Group dénommé **vg0**, il convient d' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Volume group " | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **vgcreate** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | vgcreate - Create a volume group | ||
+ | |||
+ | vgcreate VG_new PV ... | ||
+ | [ -A|--autobackup y|n ] | ||
+ | [ -c|--clustered y|n ] | ||
+ | [ -l|--maxlogicalvolumes Number ] | ||
+ | [ -p|--maxphysicalvolumes Number ] | ||
+ | [ -M|--metadatatype lvm2 ] | ||
+ | [ -s|--physicalextentsize Size[m|UNIT] ] | ||
+ | [ -f|--force ] | ||
+ | [ -Z|--zero y|n ] | ||
+ | [ --addtag Tag ] | ||
+ | [ --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit ] | ||
+ | [ --metadataprofile String ] | ||
+ | [ --labelsector Number ] | ||
+ | [ --metadatasize Size[m|UNIT] ] | ||
+ | [ --pvmetadatacopies 0|1|2 ] | ||
+ | [ --vgmetadatacopies all|unmanaged|Number ] | ||
+ | [ --reportformat basic|json ] | ||
+ | [ --dataalignment Size[k|UNIT] ] | ||
+ | [ --dataalignmentoffset Size[k|UNIT] ] | ||
+ | [ --shared ] | ||
+ | [ --systemid String ] | ||
+ | [ --locktype sanlock|dlm|none ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Common options for lvm: | ||
+ | [ -d|--debug ] | ||
+ | [ -h|--help ] | ||
+ | [ -q|--quiet ] | ||
+ | [ -v|--verbose ] | ||
+ | [ -y|--yes ] | ||
+ | [ -t|--test ] | ||
+ | [ --commandprofile String ] | ||
+ | [ --config String ] | ||
+ | [ --driverloaded y|n ] | ||
+ | [ --nolocking ] | ||
+ | [ --lockopt String ] | ||
+ | [ --longhelp ] | ||
+ | [ --profile String ] | ||
+ | [ --version ] | ||
+ | |||
+ | Use --longhelp to show all options and advanced commands. | ||
+ | </ | ||
+ | |||
+ | Pour afficher les informations concernant **vg0**, il convient d' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | --- Volume group --- | ||
+ | VG Name vg0 | ||
+ | System ID | ||
+ | Format | ||
+ | Metadata Areas 3 | ||
+ | Metadata Sequence No 1 | ||
+ | VG Access | ||
+ | VG Status | ||
+ | MAX LV 0 | ||
+ | Cur LV 0 | ||
+ | Open LV 0 | ||
+ | Max PV 0 | ||
+ | Cur PV 3 | ||
+ | Act PV 3 | ||
+ | VG Size | ||
+ | PE Size 8.00 MiB | ||
+ | Total PE 110 | ||
+ | Alloc PE / Size 0 / 0 | ||
+ | Free PE / Size 110 / 880.00 MiB | ||
+ | VG UUID | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **vgdisplay** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | vgdisplay - Display volume group information | ||
+ | |||
+ | vgdisplay | ||
+ | [ -A|--activevolumegroups ] | ||
+ | [ -c|--colon ] | ||
+ | [ -C|--columns ] | ||
+ | [ -o|--options String ] | ||
+ | [ -S|--select String ] | ||
+ | [ -s|--short ] | ||
+ | [ -O|--sort String ] | ||
+ | [ --aligned ] | ||
+ | [ --binary ] | ||
+ | [ --configreport log|vg|lv|pv|pvseg|seg ] | ||
+ | [ --foreign ] | ||
+ | [ --ignorelockingfailure ] | ||
+ | [ --logonly ] | ||
+ | [ --noheadings ] | ||
+ | [ --nosuffix ] | ||
+ | [ --readonly ] | ||
+ | [ --reportformat basic|json ] | ||
+ | [ --shared ] | ||
+ | [ --separator String ] | ||
+ | [ --unbuffered ] | ||
+ | [ --units r|R|h|H|b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ VG|Tag ... ] | ||
+ | |||
+ | Common options for lvm: | ||
+ | [ -d|--debug ] | ||
+ | [ -h|--help ] | ||
+ | [ -q|--quiet ] | ||
+ | [ -v|--verbose ] | ||
+ | [ -y|--yes ] | ||
+ | [ -t|--test ] | ||
+ | [ --commandprofile String ] | ||
+ | [ --config String ] | ||
+ | [ --driverloaded y|n ] | ||
+ | [ --nolocking ] | ||
+ | [ --lockopt String ] | ||
+ | [ --longhelp ] | ||
+ | [ --profile String ] | ||
+ | [ --version ] | ||
+ | |||
+ | Use --longhelp to show all options and advanced commands. | ||
+ | </ | ||
+ | |||
+ | ===Logical Volumes (LV)=== | ||
+ | |||
+ | Pour créer un **Logical Volume** dénommé **lv0** dans le **Volume Group** **vg0**, il convient d' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Rounding up size to full physical extent 352.00 MiB | ||
+ | Logical volume " | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | Notez que la taille du LV est un multiple du PE. | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **lvcreate** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | lvcreate - Create a logical volume | ||
+ | |||
+ | Create a linear LV. | ||
+ | lvcreate -L|--size Size[m|UNIT] VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ --type linear ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a striped LV (infers --type striped). | ||
+ | lvcreate -i|--stripes Number -L|--size Size[m|UNIT] VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a raid1 or mirror LV (infers --type raid1|mirror). | ||
+ | lvcreate -m|--mirrors Number -L|--size Size[m|UNIT] VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -R|--regionsize Size[m|UNIT] ] | ||
+ | [ --mirrorlog core|disk ] | ||
+ | [ --minrecoveryrate Size[k|UNIT] ] | ||
+ | [ --maxrecoveryrate Size[k|UNIT] ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a raid LV (a specific raid level must be used, e.g. raid1). | ||
+ | lvcreate --type raid -L|--size Size[m|UNIT] VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -m|--mirrors Number ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ -R|--regionsize Size[m|UNIT] ] | ||
+ | [ --minrecoveryrate Size[k|UNIT] ] | ||
+ | [ --maxrecoveryrate Size[k|UNIT] ] | ||
+ | [ --raidintegrity y|n ] | ||
+ | [ --raidintegritymode String ] | ||
+ | [ --raidintegrityblocksize Number ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a raid10 LV. | ||
+ | lvcreate -m|--mirrors Number -i|--stripes Number -L|--size Size[m|UNIT] VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ -R|--regionsize Size[m|UNIT] ] | ||
+ | [ --minrecoveryrate Size[k|UNIT] ] | ||
+ | [ --maxrecoveryrate Size[k|UNIT] ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a COW snapshot LV of an origin LV. | ||
+ | lvcreate -s|--snapshot -L|--size Size[m|UNIT] LV | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ --type snapshot ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a thin pool. | ||
+ | lvcreate --type thin-pool -L|--size Size[m|UNIT] VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ --thinpool LV_new ] | ||
+ | [ --poolmetadatasize Size[m|UNIT] ] | ||
+ | [ --poolmetadataspare y|n ] | ||
+ | [ --discards passdown|nopassdown|ignore ] | ||
+ | [ --errorwhenfull y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a cache pool. | ||
+ | lvcreate --type cache-pool -L|--size Size[m|UNIT] VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -H|--cache ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ --poolmetadatasize Size[m|UNIT] ] | ||
+ | [ --poolmetadataspare y|n ] | ||
+ | [ --cachemode writethrough|writeback|passthrough ] | ||
+ | [ --cachepolicy String ] | ||
+ | [ --cachesettings String ] | ||
+ | [ --cachemetadataformat auto|1|2 ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a thin LV in a thin pool (infers --type thin). | ||
+ | lvcreate -V|--virtualsize Size[m|UNIT] --thinpool LV_thinpool VG | ||
+ | [ -T|--thin ] | ||
+ | [ --type thin ] | ||
+ | [ --discards passdown|nopassdown|ignore ] | ||
+ | [ --errorwhenfull y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Create a thin LV that is a snapshot of an existing thin LV | ||
+ | (infers --type thin). | ||
+ | lvcreate -s|--snapshot LV_thin | ||
+ | [ --type thin ] | ||
+ | [ --discards passdown|nopassdown|ignore ] | ||
+ | [ --errorwhenfull y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Create a thin LV that is a snapshot of an external origin LV. | ||
+ | lvcreate --type thin --thinpool LV_thinpool LV | ||
+ | [ -T|--thin ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ --poolmetadatasize Size[m|UNIT] ] | ||
+ | [ --poolmetadataspare y|n ] | ||
+ | [ --discards passdown|nopassdown|ignore ] | ||
+ | [ --errorwhenfull y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Create a LV that returns VDO when used. | ||
+ | lvcreate --type vdo -L|--size Size[m|UNIT] VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -V|--virtualsize Size[m|UNIT] ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ --vdo ] | ||
+ | [ --vdopool LV_new ] | ||
+ | [ --compression y|n ] | ||
+ | [ --deduplication y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a thin LV, first creating a thin pool for it, | ||
+ | where the new thin pool is named by the --thinpool arg. | ||
+ | lvcreate --type thin -V|--virtualsize Size[m|UNIT] -L|--size Size[m|UNIT] --thinpool LV_new | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -T|--thin ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ --poolmetadatasize Size[m|UNIT] ] | ||
+ | [ --poolmetadataspare y|n ] | ||
+ | [ --discards passdown|nopassdown|ignore ] | ||
+ | [ --errorwhenfull y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a new LV, then attach the specified cachepool | ||
+ | which converts the new LV to type cache. | ||
+ | lvcreate --type cache -L|--size Size[m|UNIT] --cachepool LV_cachepool VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -H|--cache ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ --poolmetadatasize Size[m|UNIT] ] | ||
+ | [ --poolmetadataspare y|n ] | ||
+ | [ --cachemode writethrough|writeback|passthrough ] | ||
+ | [ --cachepolicy String ] | ||
+ | [ --cachesettings String ] | ||
+ | [ --cachemetadataformat auto|1|2 ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a new LV, then attach the specified cachevol | ||
+ | which converts the new LV to type cache. | ||
+ | lvcreate --type cache -L|--size Size[m|UNIT] --cachevol LV VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ --cachemode writethrough|writeback|passthrough ] | ||
+ | [ --cachepolicy String ] | ||
+ | [ --cachesettings String ] | ||
+ | [ --cachemetadataformat auto|1|2 ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a new LV, then attach a cachevol created from | ||
+ | the specified cache device, which converts the | ||
+ | new LV to type cache. | ||
+ | lvcreate --type cache -L|--size Size[m|UNIT] --cachedevice PV VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ --cachemode writethrough|writeback|passthrough ] | ||
+ | [ --cachepolicy String ] | ||
+ | [ --cachesettings String ] | ||
+ | [ --cachemetadataformat auto|1|2 ] | ||
+ | [ --cachesize Size[m|UNIT] ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a new LV, then attach the specified cachevol | ||
+ | which converts the new LV to type writecache. | ||
+ | lvcreate --type writecache -L|--size Size[m|UNIT] --cachevol LV VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ --cachesettings String ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a new LV, then attach a cachevol created from | ||
+ | the specified cache device, which converts the | ||
+ | new LV to type writecache. | ||
+ | lvcreate --type writecache -L|--size Size[m|UNIT] --cachedevice PV VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ --cachesize Size[m|UNIT] ] | ||
+ | [ --cachesettings String ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Common options for command: | ||
+ | [ -a|--activate y|n|ay ] | ||
+ | [ -A|--autobackup y|n ] | ||
+ | [ -C|--contiguous y|n ] | ||
+ | [ -M|--persistent y|n ] | ||
+ | [ -j|--major Number ] | ||
+ | [ -k|--setactivationskip y|n ] | ||
+ | [ -K|--ignoreactivationskip ] | ||
+ | [ -n|--name String ] | ||
+ | [ -p|--permission rw|r ] | ||
+ | [ -r|--readahead auto|none|Number ] | ||
+ | [ -W|--wipesignatures y|n ] | ||
+ | [ -Z|--zero y|n ] | ||
+ | [ --addtag Tag ] | ||
+ | [ --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit ] | ||
+ | [ --ignoremonitoring ] | ||
+ | [ --metadataprofile String ] | ||
+ | [ --minor Number ] | ||
+ | [ --monitor y|n ] | ||
+ | [ --nosync ] | ||
+ | [ --noudevsync ] | ||
+ | [ --reportformat basic|json ] | ||
+ | |||
+ | Common options for lvm: | ||
+ | [ -d|--debug ] | ||
+ | [ -h|--help ] | ||
+ | [ -q|--quiet ] | ||
+ | [ -v|--verbose ] | ||
+ | [ -y|--yes ] | ||
+ | [ -t|--test ] | ||
+ | [ --commandprofile String ] | ||
+ | [ --config String ] | ||
+ | [ --driverloaded y|n ] | ||
+ | [ --nolocking ] | ||
+ | [ --lockopt String ] | ||
+ | [ --longhelp ] | ||
+ | [ --profile String ] | ||
+ | [ --version ] | ||
+ | |||
+ | Use --longhelp to show all options and advanced commands. | ||
+ | </ | ||
+ | |||
+ | Créez maintenant un répertoire dans /mnt pour monter lv0 : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Créez un système de fichiers en **ext3** sur / | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | mke2fs 1.46.2 (28-Feb-2021) | ||
+ | Discarding device blocks: done | ||
+ | Creating filesystem with 360448 1k blocks and 90112 inodes | ||
+ | Filesystem UUID: f6c32097-8d4b-4e65-8880-4b733350193a | ||
+ | Superblock backups stored on blocks: | ||
+ | 8193, 24577, 40961, 57345, 73729, 204801, 221185 | ||
+ | |||
+ | Allocating group tables: done | ||
+ | Writing inode tables: done | ||
+ | Creating journal (8192 blocks): done | ||
+ | Writing superblocks and filesystem accounting information: | ||
+ | </ | ||
+ | |||
+ | Montez votre lv0 : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Vous allez maintenant copier le contenu du répertoire /home vers /mnt/lvm. | ||
+ | |||
+ | Saisissez donc la commande suivante : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Constatez ensuite le contenu de /mnt/lvm : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | total 13 | ||
+ | drwxr-xr-x 3 root root 1024 Apr 25 07:01 home | ||
+ | drwx------ 2 root root 12288 Apr 26 15:44 lost+found | ||
+ | </ | ||
+ | |||
+ | Une particularité du volume logique est la capacité de d' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Filesystem | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Dans la cas de notre exemple, la taille est de **331 Mo** avec **1,2 Mo** occupé. | ||
+ | |||
+ | ====LAB #2 - Etendre un Volume Logique à Chaud==== | ||
+ | |||
+ | Pour agrandir un volume logique, le paquet **lvm2** contient les commandes **lvextend** et **resize2fs** : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Rounding size to boundary between physical extents: 104.00 MiB. | ||
+ | Size of logical volume vg0/lv0 changed from 352.00 MiB (44 extents) to 456.00 MiB (57 extents). | ||
+ | Logical volume vg0/lv0 successfully resized. | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | **Important** - Notez que l' | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **lvextend** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | lvextend - Add space to a logical volume | ||
+ | |||
+ | Extend an LV by a specified size. | ||
+ | lvextend -L|--size [+]Size[m|UNIT] LV | ||
+ | [ -l|--extents [+]Number[PERCENT] ] | ||
+ | [ -r|--resizefs ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ --poolmetadatasize [+]Size[m|UNIT] ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Extend an LV by specified PV extents. | ||
+ | lvextend LV PV ... | ||
+ | [ -r|--resizefs ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Extend a pool metadata SubLV by a specified size. | ||
+ | lvextend --poolmetadatasize [+]Size[m|UNIT] LV_thinpool | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Extend an LV according to a predefined policy. | ||
+ | lvextend --usepolicies LV_snapshot_thinpool | ||
+ | [ -r|--resizefs ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Common options for command: | ||
+ | [ -A|--autobackup y|n ] | ||
+ | [ -f|--force ] | ||
+ | [ -m|--mirrors Number ] | ||
+ | [ -n|--nofsck ] | ||
+ | [ --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit ] | ||
+ | [ --nosync ] | ||
+ | [ --noudevsync ] | ||
+ | [ --reportformat basic|json ] | ||
+ | [ --type linear|striped|snapshot|mirror|raid|thin|cache|vdo|thin-pool|cache-pool|vdo-pool ] | ||
+ | |||
+ | Common options for lvm: | ||
+ | [ -d|--debug ] | ||
+ | [ -h|--help ] | ||
+ | [ -q|--quiet ] | ||
+ | [ -v|--verbose ] | ||
+ | [ -y|--yes ] | ||
+ | [ -t|--test ] | ||
+ | [ --commandprofile String ] | ||
+ | [ --config String ] | ||
+ | [ --driverloaded y|n ] | ||
+ | [ --nolocking ] | ||
+ | [ --lockopt String ] | ||
+ | [ --longhelp ] | ||
+ | [ --profile String ] | ||
+ | [ --version ] | ||
+ | |||
+ | Use --longhelp to show all options and advanced commands. | ||
+ | </ | ||
+ | |||
+ | Le volume ayant été agrandi, il est necessaire maintenant d' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Filesystem | ||
+ | / | ||
+ | root@debian11: | ||
+ | resize2fs 1.46.2 (28-Feb-2021) | ||
+ | Filesystem at / | ||
+ | old_desc_blocks = 2, new_desc_blocks = 2 | ||
+ | The filesystem on / | ||
+ | </ | ||
+ | |||
+ | Constatez maintenant la modification de la taille du volume : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Filesystem | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Vous noterez que la taille a augmentée mais que les données sont toujours présentes. | ||
+ | |||
+ | ====LAB #3 - Snapshots==== | ||
+ | |||
+ | Un snapshot est un instantané d'un système de fichiers. Dans cet exemple, vous allez créer un snapshot de votre lv0 : | ||
+ | |||
+ | Avant de commencer, créez un fichier de 10Mo dans le volume : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | 10+0 records in | ||
+ | 10+0 records out | ||
+ | 10485760 bytes (10 MB, 10 MiB) copied, 0.023862 s, 439 MB/s | ||
+ | </ | ||
+ | |||
+ | Créez maintenant un snapshot : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Rounding up size to full physical extent 24.00 MiB | ||
+ | Logical volume " | ||
+ | </ | ||
+ | |||
+ | Pour avoir une confirmation de la création du snapshot, utilisez la commande **lvs** : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | LV | ||
+ | lv0 vg0 owi-aos--- 456.00m | ||
+ | testsnap vg0 swi-a-s--- | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | **Important** - Notez que le snapshot est créé dans le même VG que le LV d' | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **lvs** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | lvs - Display information about logical volumes | ||
+ | |||
+ | lvs | ||
+ | [ -H|--history ] | ||
+ | [ -a|--all ] | ||
+ | [ -o|--options String ] | ||
+ | [ -S|--select String ] | ||
+ | [ -O|--sort String ] | ||
+ | [ --segments ] | ||
+ | [ --aligned ] | ||
+ | [ --binary ] | ||
+ | [ --configreport log|vg|lv|pv|pvseg|seg ] | ||
+ | [ --foreign ] | ||
+ | [ --ignorelockingfailure ] | ||
+ | [ --logonly ] | ||
+ | [ --nameprefixes ] | ||
+ | [ --noheadings ] | ||
+ | [ --nosuffix ] | ||
+ | [ --readonly ] | ||
+ | [ --reportformat basic|json ] | ||
+ | [ --rows ] | ||
+ | [ --separator String ] | ||
+ | [ --shared ] | ||
+ | [ --unbuffered ] | ||
+ | [ --units r|R|h|H|b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E ] | ||
+ | [ --unquoted ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ VG|LV|Tag ... ] | ||
+ | |||
+ | Common options for lvm: | ||
+ | [ -d|--debug ] | ||
+ | [ -h|--help ] | ||
+ | [ -q|--quiet ] | ||
+ | [ -v|--verbose ] | ||
+ | [ -y|--yes ] | ||
+ | [ -t|--test ] | ||
+ | [ --commandprofile String ] | ||
+ | [ --config String ] | ||
+ | [ --driverloaded y|n ] | ||
+ | [ --nolocking ] | ||
+ | [ --lockopt String ] | ||
+ | [ --longhelp ] | ||
+ | [ --profile String ] | ||
+ | [ --version ] | ||
+ | |||
+ | Use --longhelp to show all options and advanced commands. | ||
+ | </ | ||
+ | |||
+ | Créez maintenant un répertoire pour monter le snapshot : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Montez le snapshot : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Comparez le volume d' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | total 10294 | ||
+ | -rw-r--r-- 1 root root 10485760 Apr 26 15:50 10M | ||
+ | drwxr-xr-x 3 root root 1024 Apr 25 07:01 home | ||
+ | drwx------ 2 root root 12288 Apr 26 15:44 lost+found | ||
+ | root@debian11: | ||
+ | total 10294 | ||
+ | -rw-r--r-- 1 root root 10485760 Apr 26 15:50 10M | ||
+ | drwxr-xr-x 3 root root 1024 Apr 25 07:01 home | ||
+ | drwx------ 2 root root 12288 Apr 26 15:44 lost+found | ||
+ | </ | ||
+ | |||
+ | Supprimez maintenant le fichier **10M** de votre volume d' | ||
+ | |||
+ | < | ||
+ | root@debian8: | ||
+ | </ | ||
+ | |||
+ | Constatez le résultat de cette suppression : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Filesystem | ||
+ | / | ||
+ | root@debian11: | ||
+ | Filesystem | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | <WRAP center round todo> | ||
+ | **A Faire** - Restaurez le fichier 10M à partir du snapshot. | ||
+ | </ | ||
+ | |||
+ | ====LAB #4 - Suppression des Volumes==== | ||
+ | |||
+ | La suppression d'un volume logique se fait grace à la commande **lvremove** : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | |||
+ | root@debian11: | ||
+ | Do you really want to remove active logical volume vg0/ | ||
+ | Logical volume " | ||
+ | |||
+ | root@debian11: | ||
+ | |||
+ | root@debian11: | ||
+ | Do you really want to remove active logical volume vg0/lv0? [y/n]: y | ||
+ | Logical volume " | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | **Important** - Notez que cette opération necéssite à ce que le volume logique soit démonté. | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **lvremove** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | lvremove - Remove logical volume(s) from the system | ||
+ | |||
+ | lvremove VG|LV|Tag|Select ... | ||
+ | [ -A|--autobackup y|n ] | ||
+ | [ -f|--force ] | ||
+ | [ -S|--select String ] | ||
+ | [ --nohistory ] | ||
+ | [ --noudevsync ] | ||
+ | [ --reportformat basic|json ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Common options for lvm: | ||
+ | [ -d|--debug ] | ||
+ | [ -h|--help ] | ||
+ | [ -q|--quiet ] | ||
+ | [ -v|--verbose ] | ||
+ | [ -y|--yes ] | ||
+ | [ -t|--test ] | ||
+ | [ --commandprofile String ] | ||
+ | [ --config String ] | ||
+ | [ --driverloaded y|n ] | ||
+ | [ --nolocking ] | ||
+ | [ --lockopt String ] | ||
+ | [ --longhelp ] | ||
+ | [ --profile String ] | ||
+ | [ --version ] | ||
+ | |||
+ | Use --longhelp to show all options and advanced commands. | ||
+ | </ | ||
+ | |||
+ | Le Volume Group peut aussi être supprimé : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Volume group " | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **vgremove** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | vgremove - Remove volume group(s) | ||
+ | |||
+ | vgremove VG|Tag|Select ... | ||
+ | [ -f|--force ] | ||
+ | [ -S|--select String ] | ||
+ | [ --noudevsync ] | ||
+ | [ --reportformat basic|json ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Common options for lvm: | ||
+ | [ -d|--debug ] | ||
+ | [ -h|--help ] | ||
+ | [ -q|--quiet ] | ||
+ | [ -v|--verbose ] | ||
+ | [ -y|--yes ] | ||
+ | [ -t|--test ] | ||
+ | [ --commandprofile String ] | ||
+ | [ --config String ] | ||
+ | [ --driverloaded y|n ] | ||
+ | [ --nolocking ] | ||
+ | [ --lockopt String ] | ||
+ | [ --longhelp ] | ||
+ | [ --profile String ] | ||
+ | [ --version ] | ||
+ | |||
+ | Use --longhelp to show all options and advanced commands. | ||
+ | </ | ||
+ | |||
+ | Ainsi que le volume physique : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Labels on physical volume "/ | ||
+ | Labels on physical volume "/ | ||
+ | Labels on physical volume "/ | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **pvremove** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | pvremove - Remove LVM label(s) from physical volume(s) | ||
+ | |||
+ | pvremove PV ... | ||
+ | [ -f|--force ] | ||
+ | [ --reportformat basic|json ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Common options for lvm: | ||
+ | [ -d|--debug ] | ||
+ | [ -h|--help ] | ||
+ | [ -q|--quiet ] | ||
+ | [ -v|--verbose ] | ||
+ | [ -y|--yes ] | ||
+ | [ -t|--test ] | ||
+ | [ --commandprofile String ] | ||
+ | [ --config String ] | ||
+ | [ --driverloaded y|n ] | ||
+ | [ --nolocking ] | ||
+ | [ --lockopt String ] | ||
+ | [ --longhelp ] | ||
+ | [ --profile String ] | ||
+ | [ --version ] | ||
+ | |||
+ | Use --longhelp to show all options and advanced commands. | ||
+ | </ | ||
+ | |||
+ | ====LAB #5 - Volumes Logiques en Miroir==== | ||
+ | |||
+ | Re-créez maintenant votre Volume Group : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Physical volume "/ | ||
+ | Physical volume "/ | ||
+ | Physical volume "/ | ||
+ | </ | ||
+ | |||
+ | Créez le VG **vg0** : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Volume group " | ||
+ | </ | ||
+ | |||
+ | Créez maintenant un Logical Volume en miroir grâce à l' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Rounding up size to full physical extent 104.00 MiB | ||
+ | Logical volume " | ||
+ | </ | ||
+ | |||
+ | Constatez maintenant la présence du miroir : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | --- Logical volume --- | ||
+ | LV Path / | ||
+ | LV Name lv1 | ||
+ | VG Name vg0 | ||
+ | LV UUID 2AQE1P-kcp7-5w5O-9i3M-Ge6L-OSa7-HDmKii | ||
+ | LV Write Access | ||
+ | LV Creation host, time debian11, 2022-04-26 16:21:16 +0200 | ||
+ | LV Status | ||
+ | # open 0 | ||
+ | LV Size 104.00 MiB | ||
+ | Current LE 13 | ||
+ | Mirrored volumes | ||
+ | Segments | ||
+ | Allocation | ||
+ | Read ahead sectors | ||
+ | - currently set to 256 | ||
+ | Block device | ||
+ | |||
+ | --- Segments --- | ||
+ | Logical extents 0 to 12: | ||
+ | Type raid1 | ||
+ | Monitoring | ||
+ | Raid Data LV 0 | ||
+ | Logical volume | ||
+ | Logical extents | ||
+ | Raid Data LV 1 | ||
+ | Logical volume | ||
+ | Logical extents | ||
+ | Raid Metadata LV 0 lv1_rmeta_0 | ||
+ | Raid Metadata LV 1 lv1_rmeta_1 | ||
+ | </ | ||
+ | |||
+ | Le miroir s' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | --- Physical volume --- | ||
+ | PV Name / | ||
+ | VG Name vg0 | ||
+ | PV Size | ||
+ | Allocatable | ||
+ | PE Size 8.00 MiB | ||
+ | Total PE 24 | ||
+ | Free PE 10 | ||
+ | Allocated PE 14 | ||
+ | PV UUID | ||
+ | |||
+ | --- Physical Segments --- | ||
+ | Physical extent 0 to 0: | ||
+ | Logical volume | ||
+ | Logical extents | ||
+ | Physical extent 1 to 13: | ||
+ | Logical volume | ||
+ | Logical extents | ||
+ | Physical extent 14 to 23: | ||
+ | FREE | ||
+ | |||
+ | --- Physical volume --- | ||
+ | PV Name / | ||
+ | VG Name vg0 | ||
+ | PV Size | ||
+ | Allocatable | ||
+ | PE Size 8.00 MiB | ||
+ | Total PE 37 | ||
+ | Free PE 23 | ||
+ | Allocated PE 14 | ||
+ | PV UUID | ||
+ | |||
+ | --- Physical Segments --- | ||
+ | Physical extent 0 to 0: | ||
+ | Logical volume | ||
+ | Logical extents | ||
+ | Physical extent 1 to 13: | ||
+ | Logical volume | ||
+ | Logical extents | ||
+ | Physical extent 14 to 36: | ||
+ | FREE | ||
+ | |||
+ | --- Physical volume --- | ||
+ | PV Name / | ||
+ | VG Name vg0 | ||
+ | PV Size | ||
+ | Allocatable | ||
+ | PE Size 8.00 MiB | ||
+ | Total PE 49 | ||
+ | Free PE 49 | ||
+ | Allocated PE 0 | ||
+ | PV UUID | ||
+ | |||
+ | --- Physical Segments --- | ||
+ | Physical extent 0 to 48: | ||
+ | FREE | ||
+ | </ | ||
+ | |||
+ | En regardant la sortie de la commande **lsblk**, on observe : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | NAME | ||
+ | sda 8:0 0 | ||
+ | sdb 8:16 | ||
+ | ├─sdb1 | ||
+ | ├─sdb2 | ||
+ | └─sdb5 | ||
+ | sdc 8:32 | ||
+ | ├─sdc1 | ||
+ | ├─sdc2 | ||
+ | ├─sdc3 | ||
+ | ├─sdc4 | ||
+ | ├─sdc5 | ||
+ | ├─sdc6 | ||
+ | │ ├─vg0-lv1_rmeta_0 | ||
+ | │ │ └─vg0-lv1 | ||
+ | │ └─vg0-lv1_rimage_0 254:1 0 104M 0 lvm | ||
+ | │ | ||
+ | ├─sdc7 | ||
+ | │ ├─vg0-lv1_rmeta_1 | ||
+ | │ │ └─vg0-lv1 | ||
+ | │ └─vg0-lv1_rimage_1 254:3 0 104M 0 lvm | ||
+ | │ | ||
+ | ├─sdc8 | ||
+ | ├─sdc9 | ||
+ | ├─sdc10 | ||
+ | ├─sdc11 | ||
+ | └─sdc12 | ||
+ | sr0 | ||
+ | </ | ||
+ | |||
+ | La suppression du miroir se fait en utilisant la commande **lvconvert** en indiquant quel volume physique doit être vidé de son contenu : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Are you sure you want to convert raid1 LV vg0/lv1 to type linear losing all resilience? [y/n]: y | ||
+ | Logical volume vg0/lv1 successfully converted. | ||
+ | root@debian11: | ||
+ | NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT | ||
+ | sda | ||
+ | sdb | ||
+ | ├─sdb1 | ||
+ | ├─sdb2 | ||
+ | └─sdb5 | ||
+ | sdc | ||
+ | ├─sdc1 | ||
+ | ├─sdc2 | ||
+ | ├─sdc3 | ||
+ | ├─sdc4 | ||
+ | ├─sdc5 | ||
+ | ├─sdc6 | ||
+ | │ └─vg0-lv1 254:4 0 104M 0 lvm | ||
+ | ├─sdc7 | ||
+ | ├─sdc8 | ||
+ | ├─sdc9 | ||
+ | ├─sdc10 | ||
+ | ├─sdc11 | ||
+ | └─sdc12 | ||
+ | sr0 11:0 1 378M 0 rom | ||
+ | </ | ||
+ | |||
+ | De même, il est possible de créer un miroir pour un volume logique existant : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Are you sure you want to convert linear LV vg0/lv1 to raid1 with 2 images enhancing resilience? [y/n]: y | ||
+ | Logical volume vg0/lv1 successfully converted. | ||
+ | root@debian11: | ||
+ | NAME | ||
+ | sda 8:0 0 | ||
+ | sdb 8:16 | ||
+ | ├─sdb1 | ||
+ | ├─sdb2 | ||
+ | └─sdb5 | ||
+ | sdc 8:32 | ||
+ | ├─sdc1 | ||
+ | ├─sdc2 | ||
+ | ├─sdc3 | ||
+ | ├─sdc4 | ||
+ | ├─sdc5 | ||
+ | ├─sdc6 | ||
+ | │ ├─vg0-lv1_rmeta_0 | ||
+ | │ │ └─vg0-lv1 | ||
+ | │ └─vg0-lv1_rimage_0 254:1 0 104M 0 lvm | ||
+ | │ | ||
+ | ├─sdc7 | ||
+ | │ ├─vg0-lv1_rmeta_1 | ||
+ | │ │ └─vg0-lv1 | ||
+ | │ └─vg0-lv1_rimage_1 254:3 0 104M 0 lvm | ||
+ | │ | ||
+ | ├─sdc8 | ||
+ | ├─sdc9 | ||
+ | ├─sdc10 | ||
+ | ├─sdc11 | ||
+ | └─sdc12 | ||
+ | sr0 | ||
+ | </ | ||
+ | |||
+ | Supprimez de nouveau votre miroir : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Are you sure you want to convert raid1 LV vg0/lv1 to type linear losing all resilience? [y/n]: y | ||
+ | Logical volume vg0/lv1 successfully converted. | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **lvconvert** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | lvconvert - Change logical volume layout | ||
+ | |||
+ | Convert LV to linear. | ||
+ | lvconvert --type linear LV | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Convert LV to striped. | ||
+ | lvconvert --type striped LV | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ -R|--regionsize Size[m|UNIT] ] | ||
+ | [ -i|--interval Number ] | ||
+ | [ --stripes Number ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Convert LV to type mirror (also see type raid1), | ||
+ | lvconvert --type mirror LV | ||
+ | [ -m|--mirrors [+|-]Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ -R|--regionsize Size[m|UNIT] ] | ||
+ | [ -i|--interval Number ] | ||
+ | [ --stripes Number ] | ||
+ | [ --mirrorlog core|disk ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Convert LV to raid or change raid layout | ||
+ | (a specific raid level must be used, e.g. raid1). | ||
+ | lvconvert --type raid LV | ||
+ | [ -m|--mirrors [+|-]Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ -R|--regionsize Size[m|UNIT] ] | ||
+ | [ -i|--interval Number ] | ||
+ | [ --stripes Number ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Convert LV to raid1 or mirror, or change number of mirror images. | ||
+ | lvconvert -m|--mirrors [+|-]Number LV | ||
+ | [ -R|--regionsize Size[m|UNIT] ] | ||
+ | [ -i|--interval Number ] | ||
+ | [ --mirrorlog core|disk ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Convert raid LV to change number of stripe images. | ||
+ | lvconvert --stripes Number LV_raid | ||
+ | [ -i|--interval Number ] | ||
+ | [ -R|--regionsize Size[m|UNIT] ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Convert raid LV to change the stripe size. | ||
+ | lvconvert -I|--stripesize Size[k|UNIT] LV_raid | ||
+ | [ -i|--interval Number ] | ||
+ | [ -R|--regionsize Size[m|UNIT] ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Split images from a raid1 or mirror LV and use them to create a new LV. | ||
+ | lvconvert --splitmirrors Number -n|--name LV_new LV_cache_mirror_raid1 | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Split images from a raid1 LV and track changes to origin for later merge. | ||
+ | lvconvert --splitmirrors Number --trackchanges LV_cache_raid1 | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Merge LV images that were split from a raid1 LV. | ||
+ | lvconvert --mergemirrors VG|LV_linear_raid|Tag ... | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Convert LV to a thin LV, using the original LV as an external origin. | ||
+ | lvconvert --type thin --thinpool LV LV_linear_striped_thin_cache_raid | ||
+ | [ -T|--thin ] | ||
+ | [ -r|--readahead auto|none|Number ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ -Z|--zero y|n ] | ||
+ | [ --originname LV_new ] | ||
+ | [ --poolmetadata LV ] | ||
+ | [ --poolmetadatasize Size[m|UNIT] ] | ||
+ | [ --poolmetadataspare y|n ] | ||
+ | [ --metadataprofile String ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Attach a cache pool to an LV, converts the LV to type cache. | ||
+ | lvconvert --type cache --cachepool LV LV_linear_striped_thinpool_vdo_vdopool_vdopooldata_raid | ||
+ | [ -H|--cache ] | ||
+ | [ -Z|--zero y|n ] | ||
+ | [ -r|--readahead auto|none|Number ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ --cachemetadataformat auto|1|2 ] | ||
+ | [ --cachemode writethrough|writeback|passthrough ] | ||
+ | [ --cachepolicy String ] | ||
+ | [ --cachesettings String ] | ||
+ | [ --poolmetadata LV ] | ||
+ | [ --poolmetadatasize Size[m|UNIT] ] | ||
+ | [ --poolmetadataspare y|n ] | ||
+ | [ --metadataprofile String ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Attach a writecache to an LV, converts the LV to type writecache. | ||
+ | lvconvert --type writecache --cachevol LV LV_linear_striped_raid | ||
+ | [ --cachesettings String ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Attach a cache to an LV, converts the LV to type cache. | ||
+ | lvconvert --type cache --cachevol LV LV_linear_striped_thinpool_raid | ||
+ | [ -H|--cache ] | ||
+ | [ -Z|--zero y|n ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ --cachemetadataformat auto|1|2 ] | ||
+ | [ --cachemode writethrough|writeback|passthrough ] | ||
+ | [ --cachepolicy String ] | ||
+ | [ --cachesettings String ] | ||
+ | [ --poolmetadatasize Size[m|UNIT] ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Add a writecache to an LV, using a specified cache device. | ||
+ | lvconvert --type writecache --cachedevice PV LV_linear_striped_raid | ||
+ | [ --cachesize Size[m|UNIT] ] | ||
+ | [ --cachesettings String ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Add a cache to an LV, using a specified cache device. | ||
+ | lvconvert --type cache --cachedevice PV LV_linear_striped_thinpool_raid | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ --cachesize Size[m|UNIT] ] | ||
+ | [ --cachesettings String ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Convert LV to type thin-pool. | ||
+ | lvconvert --type thin-pool LV_linear_striped_cache_raid | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ -r|--readahead auto|none|Number ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ -Z|--zero y|n ] | ||
+ | [ --stripes Number ] | ||
+ | [ --discards passdown|nopassdown|ignore ] | ||
+ | [ --poolmetadata LV ] | ||
+ | [ --poolmetadatasize Size[m|UNIT] ] | ||
+ | [ --poolmetadataspare y|n ] | ||
+ | [ --metadataprofile String ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Convert LV to type cache-pool. | ||
+ | lvconvert --type cache-pool LV_linear_striped_raid | ||
+ | [ -Z|--zero y|n ] | ||
+ | [ -r|--readahead auto|none|Number ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ --cachemetadataformat auto|1|2 ] | ||
+ | [ --cachemode writethrough|writeback|passthrough ] | ||
+ | [ --cachepolicy String ] | ||
+ | [ --cachesettings String ] | ||
+ | [ --poolmetadata LV ] | ||
+ | [ --poolmetadatasize Size[m|UNIT] ] | ||
+ | [ --poolmetadataspare y|n ] | ||
+ | [ --metadataprofile String ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Convert LV to type vdopool. | ||
+ | lvconvert --type vdo-pool LV_linear_striped_cache_raid | ||
+ | [ -n|--name LV_new ] | ||
+ | [ -V|--virtualsize Size[m|UNIT] ] | ||
+ | [ --compression y|n ] | ||
+ | [ --deduplication y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Detach a cache from an LV. | ||
+ | lvconvert --splitcache LV_thinpool_cache_cachepool_vdopool_writecache | ||
+ | [ --cachesettings String ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Merge thin LV into its origin LV. | ||
+ | lvconvert --mergethin LV_thin ... | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Merge COW snapshot LV into its origin. | ||
+ | lvconvert --mergesnapshot LV_snapshot ... | ||
+ | [ -i|--interval Number ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Combine a former COW snapshot (second arg) with a former | ||
+ | origin LV (first arg) to reverse a splitsnapshot command. | ||
+ | lvconvert --type snapshot LV LV_linear_striped | ||
+ | [ -s|--snapshot ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ -Z|--zero y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Replace failed PVs in a raid or mirror LV. | ||
+ | Repair a thin pool. | ||
+ | Repair a cache pool. | ||
+ | lvconvert --repair LV_thinpool_cache_cachepool_mirror_raid | ||
+ | [ -i|--interval Number ] | ||
+ | [ --usepolicies ] | ||
+ | [ --poolmetadataspare y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Replace specific PV(s) in a raid LV with another PV. | ||
+ | lvconvert --replace PV LV_raid | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Poll LV to continue conversion. | ||
+ | lvconvert --startpoll LV_mirror_raid | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Add or remove data integrity checksums to raid images. | ||
+ | lvconvert --raidintegrity y|n LV_raid | ||
+ | [ --raidintegritymode String ] | ||
+ | [ --raidintegrityblocksize Number ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Common options for command: | ||
+ | [ -b|--background ] | ||
+ | [ -f|--force ] | ||
+ | [ --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit ] | ||
+ | [ --noudevsync ] | ||
+ | |||
+ | Common options for lvm: | ||
+ | [ -d|--debug ] | ||
+ | [ -h|--help ] | ||
+ | [ -q|--quiet ] | ||
+ | [ -v|--verbose ] | ||
+ | [ -y|--yes ] | ||
+ | [ -t|--test ] | ||
+ | [ --commandprofile String ] | ||
+ | [ --config String ] | ||
+ | [ --driverloaded y|n ] | ||
+ | [ --nolocking ] | ||
+ | [ --lockopt String ] | ||
+ | [ --longhelp ] | ||
+ | [ --profile String ] | ||
+ | [ --version ] | ||
+ | |||
+ | Use --longhelp to show all options and advanced commands. | ||
+ | </ | ||
+ | |||
+ | ====LAB #6 - Modifier les Attributs LVM==== | ||
+ | |||
+ | Pour consulter les attributs d'un LV, utilisez la commande **lvs** : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | LV | ||
+ | lv1 vg0 -wi-a----- 104.00m | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | Consultez **[[http:// | ||
+ | </ | ||
+ | |||
+ | La commande équivalente pour les Volume Groups est **vgs** : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | VG #PV #LV #SN Attr | ||
+ | vg0 | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | Consultez **[[http:// | ||
+ | </ | ||
+ | |||
+ | La commande équivalente pour les Physical Volumes est **pvs** : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | PV | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | Consultez **[[http:// | ||
+ | </ | ||
+ | |||
+ | Les commandes **lvchange**, | ||
+ | |||
+ | Par exemple, pour rendre inutilisable un Logical Volume, il convient d' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | LV | ||
+ | lv1 vg0 -wi-a----- 104.00m | ||
+ | root@debian11: | ||
+ | root@debian11: | ||
+ | LV | ||
+ | lv1 vg0 -wi------- 104.00m | ||
+ | </ | ||
+ | |||
+ | L' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | root@debian11: | ||
+ | LV | ||
+ | lv1 vg0 -wi-a----- 104.00m | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **lvchange** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | lvchange - Change the attributes of logical volume(s) | ||
+ | |||
+ | Change a general LV attribute. | ||
+ | For options listed in parentheses, | ||
+ | required, after which the others are optional. | ||
+ | lvchange | ||
+ | ( -C|--contiguous y|n, | ||
+ | -p|--permission rw|r, | ||
+ | -r|--readahead auto|none|Number, | ||
+ | -k|--setactivationskip y|n, | ||
+ | -Z|--zero y|n, | ||
+ | -M|--persistent n, | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | [ -a|--activate y|n|ay ] | ||
+ | [ --poll y|n ] | ||
+ | [ --monitor y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Resyncronize a mirror or raid LV. | ||
+ | Use to reset ' | ||
+ | lvchange --resync VG|LV_mirror_raid|Tag|Select ... | ||
+ | [ -a|--activate y|n|ay ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Resynchronize or check a raid LV. | ||
+ | lvchange --syncaction check|repair VG|LV_raid|Tag|Select ... | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Reconstruct data on specific PVs of a raid LV. | ||
+ | lvchange --rebuild PV VG|LV_raid|Tag|Select ... | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Activate or deactivate an LV. | ||
+ | lvchange -a|--activate y|n|ay VG|LV|Tag|Select ... | ||
+ | [ -P|--partial ] | ||
+ | [ -K|--ignoreactivationskip ] | ||
+ | [ --activationmode partial|degraded|complete ] | ||
+ | [ --poll y|n ] | ||
+ | [ --monitor y|n ] | ||
+ | [ --ignorelockingfailure ] | ||
+ | [ --sysinit ] | ||
+ | [ --readonly ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Reactivate an LV using the latest metadata. | ||
+ | lvchange --refresh VG|LV|Tag|Select ... | ||
+ | [ -P|--partial ] | ||
+ | [ --activationmode partial|degraded|complete ] | ||
+ | [ --poll y|n ] | ||
+ | [ --monitor y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Start or stop monitoring an LV from dmeventd. | ||
+ | lvchange --monitor y|n VG|LV|Tag|Select ... | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Start or stop processing an LV conversion. | ||
+ | lvchange --poll y|n VG|LV|Tag|Select ... | ||
+ | [ --monitor y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Make the minor device number persistent for an LV. | ||
+ | lvchange -M|--persistent y --minor Number LV | ||
+ | [ -j|--major Number ] | ||
+ | [ -a|--activate y|n|ay ] | ||
+ | [ --poll y|n ] | ||
+ | [ --monitor y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Common options for command: | ||
+ | [ -A|--autobackup y|n ] | ||
+ | [ -f|--force ] | ||
+ | [ -S|--select String ] | ||
+ | [ --ignoremonitoring ] | ||
+ | [ --noudevsync ] | ||
+ | [ --reportformat basic|json ] | ||
+ | |||
+ | Common options for lvm: | ||
+ | [ -d|--debug ] | ||
+ | [ -h|--help ] | ||
+ | [ -q|--quiet ] | ||
+ | [ -v|--verbose ] | ||
+ | [ -y|--yes ] | ||
+ | [ -t|--test ] | ||
+ | [ --commandprofile String ] | ||
+ | [ --config String ] | ||
+ | [ --driverloaded y|n ] | ||
+ | [ --nolocking ] | ||
+ | [ --lockopt String ] | ||
+ | [ --longhelp ] | ||
+ | [ --profile String ] | ||
+ | [ --version ] | ||
+ | |||
+ | Use --longhelp to show all options and advanced commands. | ||
+ | </ | ||
+ | |||
+ | ====LAB #7 - Volumes Logiques en Bandes==== | ||
+ | |||
+ | Un volume logique en bandes est créé pour augmenter, comme dans le cas du RAID, les performances des entrées et sorties. Pour créer ce volume, la commande **lvcreate** prend deux options supplémentaires : | ||
+ | |||
+ | * **-i** - indique le nombre de volumes de bandes, | ||
+ | * **-I** - indique la taille en Ko de chaque bande. | ||
+ | |||
+ | Saisissez donc la commande suivante : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Rounding up size to full physical extent 104.00 MiB | ||
+ | Rounding size 104.00 MiB (13 extents) up to stripe boundary size 112.00 MiB (14 extents). | ||
+ | Logical volume " | ||
+ | </ | ||
+ | |||
+ | Constatez la présence de vos bandes sur /dev/sdc7 et sur /dev/sdc9 : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | --- Logical volume --- | ||
+ | LV Path / | ||
+ | LV Name lv2 | ||
+ | VG Name vg0 | ||
+ | LV UUID gtqCux-8FIn-gCLc-35oB-TTsC-k7AZ-3PHIJI | ||
+ | LV Write Access | ||
+ | LV Creation host, time debian11, 2022-04-26 16:33:17 +0200 | ||
+ | LV Status | ||
+ | # open | ||
+ | LV Size 112.00 MiB | ||
+ | Current LE 14 | ||
+ | Segments | ||
+ | Allocation | ||
+ | Read ahead sectors | ||
+ | - currently set to 512 | ||
+ | Block device | ||
+ | |||
+ | --- Segments --- | ||
+ | Logical extents 0 to 13: | ||
+ | Type striped | ||
+ | Stripes | ||
+ | Stripe size 64.00 KiB | ||
+ | Stripe 0: | ||
+ | Physical volume | ||
+ | Physical extents | ||
+ | Stripe 1: | ||
+ | Physical volume | ||
+ | Physical extents | ||
+ | |||
+ | root@debian11: | ||
+ | NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT | ||
+ | sda | ||
+ | sdb | ||
+ | ├─sdb1 | ||
+ | ├─sdb2 | ||
+ | └─sdb5 | ||
+ | sdc | ||
+ | ├─sdc1 | ||
+ | ├─sdc2 | ||
+ | ├─sdc3 | ||
+ | ├─sdc4 | ||
+ | ├─sdc5 | ||
+ | ├─sdc6 | ||
+ | │ └─vg0-lv1 254:0 0 104M 0 lvm | ||
+ | ├─sdc7 | ||
+ | │ └─vg0-lv2 254:1 0 112M 0 lvm | ||
+ | ├─sdc8 | ||
+ | ├─sdc9 | ||
+ | │ └─vg0-lv2 254:1 0 112M 0 lvm | ||
+ | ├─sdc10 | ||
+ | ├─sdc11 | ||
+ | └─sdc12 | ||
+ | sr0 11:0 1 378M 0 rom | ||
+ | </ | ||
+ | |||
+ | |||
+ | Utilisez maintenant la commande **lvs** pour visualiser les volumes physiques utilisés par le volume logique : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | LV | ||
+ | lv1 vg0 -wi-a----- 104.00m | ||
+ | lv2 vg0 -wi-a----- 112.00m | ||
+ | </ | ||
+ | |||
+ | ====LAB #8 - Gérer les Métadonnées==== | ||
+ | |||
+ | Les métadonnées pour chaque Volume Group sont stockés dans un fichier texte au nom du Volume Group dans le répertoire **/ | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | # Generated by LVM2 version 2.03.11(2) (2021-01-08): | ||
+ | |||
+ | contents = "Text Format Volume Group" | ||
+ | version = 1 | ||
+ | |||
+ | description = " | ||
+ | |||
+ | creation_host = " | ||
+ | creation_time = 1650983597 | ||
+ | |||
+ | vg0 { | ||
+ | id = " | ||
+ | seqno = 11 | ||
+ | format = " | ||
+ | status = [" | ||
+ | flags = [] | ||
+ | extent_size = 16384 # 8 Megabytes | ||
+ | max_lv = 0 | ||
+ | max_pv = 0 | ||
+ | metadata_copies = 0 | ||
+ | |||
+ | physical_volumes { | ||
+ | |||
+ | pv0 { | ||
+ | id = " | ||
+ | device = "/ | ||
+ | |||
+ | status = [" | ||
+ | flags = [] | ||
+ | dev_size = 409600 | ||
+ | pe_start = 2048 | ||
+ | pe_count = 24 # 192 Megabytes | ||
+ | } | ||
+ | |||
+ | pv1 { | ||
+ | id = " | ||
+ | device = "/ | ||
+ | |||
+ | status = [" | ||
+ | flags = [] | ||
+ | dev_size = 614400 | ||
+ | pe_start = 2048 | ||
+ | pe_count = 37 # 296 Megabytes | ||
+ | } | ||
+ | |||
+ | pv2 { | ||
+ | id = " | ||
+ | device = "/ | ||
+ | |||
+ | status = [" | ||
+ | flags = [] | ||
+ | dev_size = 819200 | ||
+ | pe_start = 2048 | ||
+ | pe_count = 49 # 392 Megabytes | ||
+ | } | ||
+ | } | ||
+ | |||
+ | logical_volumes { | ||
+ | |||
+ | lv1 { | ||
+ | id = " | ||
+ | status = [" | ||
+ | flags = [] | ||
+ | creation_time = 1650982876 | ||
+ | creation_host = " | ||
+ | segment_count = 1 | ||
+ | |||
+ | segment1 { | ||
+ | start_extent = 0 | ||
+ | extent_count = 13 # 104 Megabytes | ||
+ | |||
+ | type = " | ||
+ | stripe_count = 1 # linear | ||
+ | |||
+ | stripes = [ | ||
+ | " | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | |||
+ | lv2 { | ||
+ | id = " | ||
+ | status = [" | ||
+ | flags = [] | ||
+ | creation_time = 1650983597 | ||
+ | creation_host = " | ||
+ | segment_count = 1 | ||
+ | |||
+ | segment1 { | ||
+ | start_extent = 0 | ||
+ | extent_count = 14 # 112 Megabytes | ||
+ | |||
+ | type = " | ||
+ | stripe_count = 2 | ||
+ | stripe_size = 128 # 64 Kilobytes | ||
+ | |||
+ | stripes = [ | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | Des archives sont créées lors de chaque modification d'un groupe de volumes et elles sont placés dans le répertoire **/ | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | vg0_00000-267942700.vg | ||
+ | vg0_00001-854434220.vg | ||
+ | vg0_00002-520659205.vg | ||
+ | vg0_00003-1606608177.vg | ||
+ | |||
+ | root@debian11: | ||
+ | |||
+ | File: / | ||
+ | VG name: vg0 | ||
+ | Description: | ||
+ | Backup Time: Tue Apr 26 13:54:06 2022 | ||
+ | |||
+ | |||
+ | File: / | ||
+ | VG name: vg0 | ||
+ | Description: | ||
+ | Backup Time: Tue Apr 26 13:55:59 2022 | ||
+ | |||
+ | |||
+ | File: / | ||
+ | VG name: vg0 | ||
+ | Description: | ||
+ | Backup Time: Tue Apr 26 15:47:38 2022 | ||
+ | |||
+ | |||
+ | File: / | ||
+ | VG name: vg0 | ||
+ | Description: | ||
+ | Backup Time: Tue Apr 26 15:53:12 2022 | ||
+ | |||
+ | |||
+ | File: / | ||
+ | VG name: vg0 | ||
+ | Description: | ||
+ | Backup Time: Tue Apr 26 16:15:45 2022 | ||
+ | |||
+ | |||
+ | File: / | ||
+ | VG name: vg0 | ||
+ | Description: | ||
+ | Backup Time: Tue Apr 26 16:16:19 2022 | ||
+ | |||
+ | |||
+ | File: / | ||
+ | VG name: vg0 | ||
+ | Description: | ||
+ | Backup Time: Tue Apr 26 16:17:28 2022 | ||
+ | |||
+ | |||
+ | File: / | ||
+ | VG name: vg0 | ||
+ | Description: | ||
+ | Backup Time: Tue Apr 26 16:20:56 2022 | ||
+ | |||
+ | |||
+ | File: / | ||
+ | VG name: vg0 | ||
+ | Description: | ||
+ | Backup Time: Tue Apr 26 16:21:16 2022 | ||
+ | |||
+ | |||
+ | File: / | ||
+ | VG name: vg0 | ||
+ | Description: | ||
+ | Backup Time: Tue Apr 26 16:24:33 2022 | ||
+ | |||
+ | |||
+ | File: / | ||
+ | VG name: vg0 | ||
+ | Description: | ||
+ | Backup Time: Tue Apr 26 16:25:20 2022 | ||
+ | |||
+ | |||
+ | File: / | ||
+ | VG name: vg0 | ||
+ | Description: | ||
+ | Backup Time: Tue Apr 26 16:25:49 2022 | ||
+ | |||
+ | |||
+ | File: / | ||
+ | VG name: vg0 | ||
+ | Description: | ||
+ | Backup Time: Tue Apr 26 16:33:17 2022 | ||
+ | |||
+ | |||
+ | File: / | ||
+ | VG name: vg0 | ||
+ | Description: | ||
+ | Backup Time: Tue Apr 26 16:37:00 2022 | ||
+ | </ | ||
+ | |||
+ | La commande **vgcfgbackup** est utilisée pour sauvegarder les métadonnées manuellement dans le fichier **/ | ||
+ | |||
+ | La commande **vgcfgrestore** permet de restaurer une sauvegarde. Avec l' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Volume group " | ||
+ | |||
+ | root@debian11: | ||
+ | vg0 | ||
+ | </ | ||
+ | |||
+ | Il est aussi possible de modifier l' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Volume group " | ||
+ | |||
+ | root@debian11: | ||
+ | systemd-private-7644749265b24b9a8f6a8695c083cfaa-ModemManager.service-KFBiWe | ||
+ | systemd-private-7644749265b24b9a8f6a8695c083cfaa-systemd-logind.service-3fbzgg | ||
+ | systemd-private-7644749265b24b9a8f6a8695c083cfaa-systemd-timesyncd.service-Gyzrhf | ||
+ | vg0_backup | ||
+ | </ | ||
+ | |||
+ | =====Concepts RAID===== | ||
+ | |||
+ | Les solutions RAID ou //Redundant Array of Independent Disks// ou encore //Redundant Array of Inexpensive Disks// permettent la combinaison de plusieurs disques de façon à ce que ceux-ci soient vu comme un seul disque logique. | ||
+ | |||
+ | Les solutions RAID sont issues du travail fourni par l' | ||
+ | |||
+ | * Addition des capacités, | ||
+ | * Amélioration des performances, | ||
+ | * Apporter la tolérance de panne. | ||
+ | |||
+ | Deux concepts sont fondamentaux à la compréhension des solutions RAID. | ||
+ | |||
+ | ====Disques en miroir==== | ||
+ | |||
+ | La technique des disques en miroir consiste à dupliquer l' | ||
+ | |||
+ | ====Bandes de données==== | ||
+ | |||
+ | La technique des bandes de données, autrement appelée //data striping// consiste à couper les données à enregistrer en segments séquentiels et contigus pour les enregistrer sur plusieurs disques physiques. L' | ||
+ | |||
+ | =====Types de RAID===== | ||
+ | |||
+ | ====RAID 0 - Concaténation==== | ||
+ | |||
+ | Création de volume par récupération de l' | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ===Avantages=== | ||
+ | |||
+ | * Récupération de l' | ||
+ | |||
+ | ===Inconvénients=== | ||
+ | |||
+ | * Pas de protection des données, | ||
+ | * Pas d' | ||
+ | |||
+ | ====RAID 0 - Striping==== | ||
+ | |||
+ | Création de volume sur plusieurs disques afin d' | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ===Avantages=== | ||
+ | |||
+ | * Augmentation des performances d'E/S par écriture en parallèle sur les disques. | ||
+ | |||
+ | ===Inconvénients=== | ||
+ | |||
+ | * Pas de protection des données. | ||
+ | |||
+ | ====RAID 1 - Miroir==== | ||
+ | |||
+ | Création d'un volume où les disques sont en miroir. Quand les deux disques sont connectés à des contrôleurs de disques différents, | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ===Avantages=== | ||
+ | |||
+ | * Protection des données contre une défaillance d'un disque. | ||
+ | |||
+ | ===Inconvénients=== | ||
+ | |||
+ | * Coûteux à cause de l' | ||
+ | |||
+ | ====RAID 1+0 - Striping en Miroir==== | ||
+ | |||
+ | Le RAID 1+0 ou encore 0+1 est une technique qui réunit le RAID 0 et le RAID 1. On l' | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ===Avantages=== | ||
+ | |||
+ | * Protection des données contre une défaillance d'un disque. | ||
+ | * Augmentation des performances d'E/S par écriture en parallèle sur les disques. | ||
+ | |||
+ | ===Inconvénients=== | ||
+ | |||
+ | * Coûteux à cause de l' | ||
+ | |||
+ | ====RAID 2 - Miroir avec Contrôle d' | ||
+ | |||
+ | Le RAID 2 est une technique de miroir avec contrôle de correction d' | ||
+ | |||
+ | ====RAID 3 et 4 - Striping avec Parité==== | ||
+ | |||
+ | Les RAID 3 et 4 sont des technologies avec bandes de parité distribuées sur un seul disque : | ||
+ | |||
+ | {{: | ||
+ | |||
+ | En RAID 3, la taille des segments n’est pas modifiable et est fixée à 512 octets (en RAID 3 : un segment = un secteur de disque dur = 512 octets). | ||
+ | |||
+ | En RAID 4, la taille des segments est variable et se modifie en temps réel. Cela implique que les informations de parité doivent être mise à jour à chaque écriture afin de vérifier si la taille des segments a été modifiée. | ||
+ | |||
+ | ===Avantages=== | ||
+ | |||
+ | * Protection des données contre une défaillance d'un disque. | ||
+ | |||
+ | ===Inconvénients=== | ||
+ | |||
+ | * Création d'un goulot d' | ||
+ | |||
+ | ====RAID 5 - Striping avec Parité Distribuée==== | ||
+ | |||
+ | Le RAID 5 est une technologie avec bandes de parité distribuées sur plusieurs disques : | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ===Avantages=== | ||
+ | |||
+ | * Protection des données contre une défaillance d'un disque, | ||
+ | * Evite le goulot d' | ||
+ | |||
+ | ===Inconvénients=== | ||
+ | |||
+ | * Lecture moins performante qu' | ||
+ | |||
+ | ====Au délà de RAID 5==== | ||
+ | |||
+ | Il existe aussi deux autres technologies RAID, toute deux issues de la technologie RAID 5 : | ||
+ | |||
+ | * RAID 6 | ||
+ | * //Disk Striping with Double Distributed Parity// | ||
+ | * RAID TP | ||
+ | * //Disk Striping with Triple Distributed Parity// | ||
+ | |||
+ | ====LAB #9 - Mise en Place du RAID 5 Logiciel==== | ||
+ | |||
+ | ===9.1 - Préparer le disque=== | ||
+ | |||
+ | Rappelez-vous avoir modifié les types de 4 partitions du disque **/ | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Disk /dev/sda: 32 GiB, 34359738368 bytes, 67108864 sectors | ||
+ | Disk model: QEMU HARDDISK | ||
+ | Units: sectors of 1 * 512 = 512 bytes | ||
+ | Sector size (logical/ | ||
+ | I/O size (minimum/ | ||
+ | Disklabel type: dos | ||
+ | Disk identifier: 0xf2e3a71a | ||
+ | |||
+ | Device | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | |||
+ | |||
+ | Disk /dev/sdb: 64 GiB, 68719476736 bytes, 134217728 sectors | ||
+ | Disk model: QEMU HARDDISK | ||
+ | Units: sectors of 1 * 512 = 512 bytes | ||
+ | Sector size (logical/ | ||
+ | I/O size (minimum/ | ||
+ | |||
+ | |||
+ | Disk /dev/sdc: 4 GiB, 4294967296 bytes, 8388608 sectors | ||
+ | Disk model: QEMU HARDDISK | ||
+ | Units: sectors of 1 * 512 = 512 bytes | ||
+ | Sector size (logical/ | ||
+ | I/O size (minimum/ | ||
+ | Disklabel type: dos | ||
+ | Disk identifier: 0x304308a3 | ||
+ | |||
+ | Device | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | |||
+ | |||
+ | Disk / | ||
+ | Units: sectors of 1 * 512 = 512 bytes | ||
+ | Sector size (logical/ | ||
+ | I/O size (minimum/ | ||
+ | |||
+ | |||
+ | Disk / | ||
+ | Units: sectors of 1 * 512 = 512 bytes | ||
+ | Sector size (logical/ | ||
+ | I/O size (minimum/ | ||
+ | |||
+ | |||
+ | Disk / | ||
+ | Units: sectors of 1 * 512 = 512 bytes | ||
+ | Sector size (logical/ | ||
+ | I/O size (minimum/ | ||
+ | </ | ||
+ | |||
+ | Dans le cas de cet exemple les quatre partitions concernées par la mise en place d'un RAID 5 sont : | ||
+ | |||
+ | < | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | ===9.2 - Créer une Unité RAID=== | ||
+ | |||
+ | La création d'une unité RAID avec la commande **mdadm** se fait grâce aux options passées en arguments à la commande : | ||
+ | |||
+ | < | ||
+ | mdadm --create <unité RAID> [options] <unités physiques> | ||
+ | </ | ||
+ | |||
+ | Sous Debian 11, mdadm n'est pas installé par défaut : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Saisissez maintenant la commande suivante : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | mdadm: /dev/sdc8 appears to contain a reiserfs file system | ||
+ | size = 512000K | ||
+ | Continue creating array? y | ||
+ | mdadm: Defaulting to version 1.2 metadata | ||
+ | mdadm: array /dev/md1 started. | ||
+ | </ | ||
+ | |||
+ | Les options dans la ligne de commande sont : | ||
+ | |||
+ | ^ Option Courte ^ Option Longue ^ Description ^ | ||
+ | | -l | - -level | Le niveau RAID - **linear, 0,1,2,4 ou 5** | | ||
+ | | -n | - -raid-devices=< | ||
+ | |||
+ | Les options de la commande **mdadm** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Any parameter that does not start with ' | ||
+ | or, for --examine-bitmap, | ||
+ | The first such name is often the name of an md device. | ||
+ | names are often names of component devices. | ||
+ | |||
+ | Some common options are: | ||
+ | --help | ||
+ | mode specific help message | ||
+ | --help-options | ||
+ | --version | ||
+ | --verbose | ||
+ | --quiet | ||
+ | --brief | ||
+ | --export | ||
+ | | ||
+ | --force | ||
+ | |||
+ | --assemble | ||
+ | --build | ||
+ | --create | ||
+ | --detail | ||
+ | --examine | ||
+ | --examine-bitmap -X: Display the detail of a bitmap file | ||
+ | --examine-badblocks: | ||
+ | --monitor | ||
+ | --grow | ||
+ | --incremental -I : add/remove a single device to/from an array as appropriate | ||
+ | --query | ||
+ | | ||
+ | --auto-detect | ||
+ | </ | ||
+ | |||
+ | La commande **mdadm** utilise des sous-commandes ou //mode majeurs// : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | mdadm is used for building, managing, and monitoring | ||
+ | Linux md devices (aka RAID arrays) | ||
+ | Usage: mdadm --create device options... | ||
+ | Create a new array from unused devices. | ||
+ | mdadm --assemble device options... | ||
+ | Assemble a previously created array. | ||
+ | mdadm --build device options... | ||
+ | Create or assemble an array without metadata. | ||
+ | mdadm --manage device options... | ||
+ | make changes to an existing array. | ||
+ | mdadm --misc options... devices | ||
+ | report on or modify various md related devices. | ||
+ | mdadm --grow options device | ||
+ | resize/ | ||
+ | mdadm --incremental device | ||
+ | add/remove a device to/from an array as appropriate | ||
+ | mdadm --monitor options... | ||
+ | Monitor one or more array for significant changes. | ||
+ | mdadm device options... | ||
+ | Shorthand for --manage. | ||
+ | Any parameter that does not start with ' | ||
+ | or, for --examine-bitmap, | ||
+ | The first such name is often the name of an md device. | ||
+ | names are often names of component devices. | ||
+ | |||
+ | For detailed help on the above major modes use --help after the mode | ||
+ | | ||
+ | mdadm --assemble --help | ||
+ | For general help on options use | ||
+ | mdadm --help-options | ||
+ | </ | ||
+ | |||
+ | Chaque sous-commande bénéficie d'un aide spécifique, | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Usage: | ||
+ | |||
+ | This usage will initialise a new md array, associate some | ||
+ | | ||
+ | array with some devices missing, use the special word ' | ||
+ | place of the relevant device name. | ||
+ | |||
+ | | ||
+ | raid superblocks or filesystems. | ||
+ | the variance in device size exceeds 1%. | ||
+ | If any discrepancy is found, the user will be prompted for confirmation | ||
+ | | ||
+ | | ||
+ | |||
+ | If the --size option is given then only that many kilobytes of each | ||
+ | | ||
+ | If no --size is given, the apparent size of the smallest drive given | ||
+ | is used for raid level 1 and greater, and the full device is used for | ||
+ | other levels. | ||
+ | |||
+ | | ||
+ | --bitmap= | ||
+ | : or an internal bitmap if ' | ||
+ | --chunk= | ||
+ | --rounding= | ||
+ | --level= | ||
+ | --parity= | ||
+ | --layout= | ||
+ | --raid-devices= | ||
+ | --spare-devices= | ||
+ | --size= | ||
+ | --data-offset= | ||
+ | : of array data. | ||
+ | --force | ||
+ | : insert a missing drive for RAID5. | ||
+ | --run -R : insist of running the array even if not all | ||
+ | : devices are present or some look odd. | ||
+ | --readonly | ||
+ | --name= | ||
+ | --bitmap-chunk= | ||
+ | --delay= | ||
+ | --write-journal= | ||
+ | --consistency-policy= : Specify the policy that determines how the array | ||
+ | -k : maintains consistency in case of unexpected shutdown. | ||
+ | </ | ||
+ | |||
+ | Les //modes majeurs// de la commande **mdadm** peuvent être visualisés grâce à la commande suivante : | ||
+ | |||
+ | < | ||
+ | root@debian8: | ||
+ | mdadm is used for building, managing, and monitoring | ||
+ | Linux md devices (aka RAID arrays) | ||
+ | Usage: mdadm --create device options... | ||
+ | Create a new array from unused devices. | ||
+ | mdadm --assemble device options... | ||
+ | Assemble a previously created array. | ||
+ | mdadm --build device options... | ||
+ | Create or assemble an array without metadata. | ||
+ | mdadm --manage device options... | ||
+ | make changes to an existing array. | ||
+ | mdadm --misc options... devices | ||
+ | report on or modify various md related devices. | ||
+ | mdadm --grow options device | ||
+ | resize/ | ||
+ | mdadm --incremental device | ||
+ | add/remove a device to/from an array as appropriate | ||
+ | mdadm --monitor options... | ||
+ | Monitor one or more array for significant changes. | ||
+ | mdadm device options... | ||
+ | Shorthand for --manage. | ||
+ | Any parameter that does not start with ' | ||
+ | or, for --examine-bitmap, | ||
+ | The first such name is often the name of an md device. | ||
+ | names are often names of component devices. | ||
+ | |||
+ | For detailed help on the above major modes use --help after the mode | ||
+ | | ||
+ | mdadm --assemble --help | ||
+ | For general help on options use | ||
+ | mdadm --help-options | ||
+ | </ | ||
+ | |||
+ | Constatez maintenant les informations concernant le RAID 5 créé : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Personalities : [raid6] [raid5] [raid4] | ||
+ | md1 : active raid5 sdc10[3] sdc8[1] sdc5[0] | ||
+ | 1019904 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU] | ||
+ | |||
+ | unused devices: < | ||
+ | </ | ||
+ | |||
+ | Grâce à la commande mdadm, il est possible d' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | /dev/md1: 996.00MiB raid5 3 devices, 0 spares. Use mdadm --detail for more detail. | ||
+ | </ | ||
+ | |||
+ | L' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | /dev/md1: | ||
+ | | ||
+ | | ||
+ | Raid Level : raid5 | ||
+ | Array Size : 1019904 (996.00 MiB 1044.38 MB) | ||
+ | Used Dev Size : 509952 (498.00 MiB 522.19 MB) | ||
+ | Raid Devices : 3 | ||
+ | Total Devices : 3 | ||
+ | | ||
+ | |||
+ | | ||
+ | State : clean | ||
+ | Active Devices : 3 | ||
+ | | ||
+ | Failed Devices : 0 | ||
+ | Spare Devices : 0 | ||
+ | |||
+ | Layout : left-symmetric | ||
+ | Chunk Size : 512K | ||
+ | |||
+ | Consistency Policy : resync | ||
+ | |||
+ | Name : debian11: | ||
+ | UUID : c0f945a0: | ||
+ | Events : 18 | ||
+ | |||
+ | Number | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | Notez la ligne **Persistence : Superblock is persistent**. En effet, cette implémentation de RAID inscrit les caractéristiques du volume dans un //super bloc// persistant en début de chaque unité de type bloc dans le volume. | ||
+ | |||
+ | Cependant, il necéssaire de renseigner le fichier **/ | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | # mdadm.conf | ||
+ | # | ||
+ | # !NB! Run update-initramfs -u after updating this file. | ||
+ | # !NB! This will ensure that initramfs has an uptodate copy. | ||
+ | # | ||
+ | # Please refer to mdadm.conf(5) for information about this file. | ||
+ | # | ||
+ | |||
+ | # by default (built-in), scan all partitions (/ | ||
+ | # containers for MD superblocks. alternatively, | ||
+ | # wildcards if desired. | ||
+ | #DEVICE partitions containers | ||
+ | |||
+ | # automatically tag new arrays as belonging to the local system | ||
+ | HOMEHOST < | ||
+ | |||
+ | # instruct the monitoring daemon where to send mail alerts | ||
+ | MAILADDR root | ||
+ | |||
+ | # definitions of existing MD arrays | ||
+ | |||
+ | # This configuration was auto-generated on Sun, 01 May 2022 13:26:29 +0200 by mkconf | ||
+ | </ | ||
+ | |||
+ | Ecrasez le contenu de ce fichier avec les informations suivantes : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | root@debian11: | ||
+ | root@debian11: | ||
+ | DEVICE /dev/sdc5 /dev/sdc8 / | ||
+ | ARRAY /dev/md1 metadata=1.2 name=debian11: | ||
+ | </ | ||
+ | |||
+ | Mettez à jour l' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | update-initramfs: | ||
+ | </ | ||
+ | |||
+ | Chaque unité peut être examinée individuellement : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | / | ||
+ | Magic : a92b4efc | ||
+ | Version : 1.2 | ||
+ | Feature Map : 0x0 | ||
+ | Array UUID : c0f945a0: | ||
+ | Name : debian11: | ||
+ | Creation Time : Sun May 1 13:27:48 2022 | ||
+ | Raid Level : raid5 | ||
+ | Raid Devices : 3 | ||
+ | |||
+ | Avail Dev Size : 1019904 (498.00 MiB 522.19 MB) | ||
+ | Array Size : 1019904 (996.00 MiB 1044.38 MB) | ||
+ | Data Offset : 4096 sectors | ||
+ | Super Offset : 8 sectors | ||
+ | | ||
+ | State : clean | ||
+ | Device UUID : 1d34dda2: | ||
+ | |||
+ | Update Time : Sun May 1 13:27:53 2022 | ||
+ | Bad Block Log : 512 entries available at offset 16 sectors | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | Chunk Size : 512K | ||
+ | |||
+ | | ||
+ | Array State : AAA (' | ||
+ | </ | ||
+ | |||
+ | ===9.3 - Remplacer une Unité Défaillante=== | ||
+ | |||
+ | A ce stade il est intéressant de noter comment réagir lors d'une défaillance d'un disque. Dans notre cas nous allons indiquer au système que la partition /dev/sdc5 est devenue défaillante : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | mdadm: set /dev/sdc5 faulty in /dev/md1 | ||
+ | </ | ||
+ | |||
+ | L' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | /dev/md1: | ||
+ | | ||
+ | | ||
+ | Raid Level : raid5 | ||
+ | Array Size : 1019904 (996.00 MiB 1044.38 MB) | ||
+ | Used Dev Size : 509952 (498.00 MiB 522.19 MB) | ||
+ | Raid Devices : 3 | ||
+ | Total Devices : 3 | ||
+ | | ||
+ | |||
+ | | ||
+ | State : clean, degraded | ||
+ | Active Devices : 2 | ||
+ | | ||
+ | Failed Devices : 1 | ||
+ | Spare Devices : 0 | ||
+ | |||
+ | Layout : left-symmetric | ||
+ | Chunk Size : 512K | ||
+ | |||
+ | Consistency Policy : resync | ||
+ | |||
+ | Name : debian11: | ||
+ | UUID : c0f945a0: | ||
+ | Events : 20 | ||
+ | |||
+ | Number | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | </ | ||
+ | |||
+ | Il est maintenant nécessaire de supprimer /dev/sdc5 de notre RAID 5 : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | mdadm: hot removed /dev/sdc5 from /dev/md1 | ||
+ | </ | ||
+ | |||
+ | A l' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | /dev/md1: | ||
+ | | ||
+ | | ||
+ | Raid Level : raid5 | ||
+ | Array Size : 1019904 (996.00 MiB 1044.38 MB) | ||
+ | Used Dev Size : 509952 (498.00 MiB 522.19 MB) | ||
+ | Raid Devices : 3 | ||
+ | Total Devices : 2 | ||
+ | | ||
+ | |||
+ | | ||
+ | State : clean, degraded | ||
+ | Active Devices : 2 | ||
+ | | ||
+ | Failed Devices : 0 | ||
+ | Spare Devices : 0 | ||
+ | |||
+ | Layout : left-symmetric | ||
+ | Chunk Size : 512K | ||
+ | |||
+ | Consistency Policy : resync | ||
+ | |||
+ | Name : debian11: | ||
+ | UUID : c0f945a0: | ||
+ | Events : 21 | ||
+ | |||
+ | Number | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | Constatez maintenant l' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Personalities : [raid6] [raid5] [raid4] | ||
+ | md1 : active raid5 sdc10[3] sdc8[1] | ||
+ | 1019904 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [_UU] | ||
+ | |||
+ | unused devices: < | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | **iMPORTANT** - Notez que le RAID a 2 unités au lieu de trois. | ||
+ | </ | ||
+ | |||
+ | Nous avons déjà utilisé **/ | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | |||
+ | root@debian11: | ||
+ | / | ||
+ | type: LUKS2 | ||
+ | cipher: | ||
+ | keysize: 512 bits | ||
+ | key location: keyring | ||
+ | device: | ||
+ | sector size: 512 | ||
+ | offset: | ||
+ | size: 991232 sectors | ||
+ | mode: read/ | ||
+ | </ | ||
+ | |||
+ | Avant de supprimer LUKs, il convient de supprimer la dernière passphrase : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Enter passphrase to be deleted: fenestros123456789 | ||
+ | |||
+ | WARNING! | ||
+ | ======== | ||
+ | This is the last keyslot. Device will become unusable after purging this key. | ||
+ | |||
+ | Are you sure? (Type ' | ||
+ | </ | ||
+ | |||
+ | Supprimez maintenant LUKs : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Vérifiez de nouveau le statut : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | / | ||
+ | |||
+ | root@debian11: | ||
+ | NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT | ||
+ | sda | ||
+ | ├─sda1 | ||
+ | ├─sda2 | ||
+ | └─sda5 | ||
+ | sdb | ||
+ | sdc | ||
+ | ├─sdc1 | ||
+ | ├─sdc2 | ||
+ | ├─sdc3 | ||
+ | ├─sdc4 | ||
+ | ├─sdc5 | ||
+ | ├─sdc6 | ||
+ | │ └─vg0-lv1 254:0 0 104M 0 lvm | ||
+ | ├─sdc7 | ||
+ | │ └─vg0-lv2 254:1 0 112M 0 lvm | ||
+ | ├─sdc8 | ||
+ | │ └─md1 | ||
+ | ├─sdc9 | ||
+ | │ └─vg0-lv2 254:1 0 112M 0 lvm | ||
+ | ├─sdc10 | ||
+ | │ └─md1 | ||
+ | ├─sdc11 | ||
+ | └─sdc12 | ||
+ | sr0 11:0 1 378M 0 rom | ||
+ | </ | ||
+ | |||
+ | Pour ajouter un autre disque à notre RAID afin de remplacer /dev/sdc5 il convient d' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | mdadm: added / | ||
+ | </ | ||
+ | |||
+ | L' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | /dev/md1: | ||
+ | | ||
+ | | ||
+ | Raid Level : raid5 | ||
+ | Array Size : 1019904 (996.00 MiB 1044.38 MB) | ||
+ | Used Dev Size : 509952 (498.00 MiB 522.19 MB) | ||
+ | Raid Devices : 3 | ||
+ | Total Devices : 3 | ||
+ | | ||
+ | |||
+ | | ||
+ | State : clean, degraded, recovering | ||
+ | Active Devices : 2 | ||
+ | | ||
+ | Failed Devices : 0 | ||
+ | Spare Devices : 1 | ||
+ | |||
+ | Layout : left-symmetric | ||
+ | Chunk Size : 512K | ||
+ | |||
+ | Consistency Policy : resync | ||
+ | |||
+ | Rebuild Status : 56% complete | ||
+ | |||
+ | Name : debian11: | ||
+ | UUID : c0f945a0: | ||
+ | Events : 32 | ||
+ | |||
+ | Number | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | root@debian11: | ||
+ | /dev/md1: | ||
+ | | ||
+ | | ||
+ | Raid Level : raid5 | ||
+ | Array Size : 1019904 (996.00 MiB 1044.38 MB) | ||
+ | Used Dev Size : 509952 (498.00 MiB 522.19 MB) | ||
+ | Raid Devices : 3 | ||
+ | Total Devices : 3 | ||
+ | | ||
+ | |||
+ | | ||
+ | State : clean | ||
+ | Active Devices : 3 | ||
+ | | ||
+ | Failed Devices : 0 | ||
+ | Spare Devices : 0 | ||
+ | |||
+ | Layout : left-symmetric | ||
+ | Chunk Size : 512K | ||
+ | |||
+ | Consistency Policy : resync | ||
+ | |||
+ | Name : debian11: | ||
+ | UUID : c0f945a0: | ||
+ | Events : 40 | ||
+ | |||
+ | Number | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | Vérifiez la prise en compte de la configuration : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT | ||
+ | sda | ||
+ | ├─sda1 | ||
+ | ├─sda2 | ||
+ | └─sda5 | ||
+ | sdb | ||
+ | sdc | ||
+ | ├─sdc1 | ||
+ | ├─sdc2 | ||
+ | ├─sdc3 | ||
+ | ├─sdc4 | ||
+ | ├─sdc5 | ||
+ | ├─sdc6 | ||
+ | │ └─vg0-lv1 254:0 0 104M 0 lvm | ||
+ | ├─sdc7 | ||
+ | │ └─vg0-lv2 254:1 0 112M 0 lvm | ||
+ | ├─sdc8 | ||
+ | │ └─md1 | ||
+ | ├─sdc9 | ||
+ | │ └─vg0-lv2 254:1 0 112M 0 lvm | ||
+ | ├─sdc10 | ||
+ | │ └─md1 | ||
+ | ├─sdc11 | ||
+ | │ └─md1 | ||
+ | └─sdc12 | ||
+ | sr0 11:0 1 378M 0 rom | ||
+ | |||
+ | root@debian11: | ||
+ | md1 : active raid5 sdc11[4] sdc10[3] sdc8[1] | ||
+ | 1019904 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU] | ||
+ | |||
+ | unused devices: < | ||
+ | </ | ||
+ | |||
+ | Dernièrement, | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | root@debian11: | ||
+ | root@debian11: | ||
+ | DEVICE /dev/sdc11 /dev/sdc8 / | ||
+ | ARRAY /dev/md1 metadata=1.2 name=debian11: | ||
+ | </ | ||
+ | |||
+ | Mettez à jour l' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | update-initramfs: | ||
+ | </ | ||
+ | |||
+ | =====LAB #10 - autofs===== | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# apt install autofs | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# systemctl enable --now autofs | ||
+ | Created symlink / | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# systemctl status autofs | ||
+ | ● autofs.service - Automounts filesystems on demand | ||
+ | | ||
+ | | ||
+ | Main PID: 67631 (automount) | ||
+ | Tasks: 5 (limit: 100949) | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | Oct 11 09:26:39 centos8.ittraining.loc systemd[1]: Starting Automounts filesystems on demand... | ||
+ | Oct 11 09:26:39 centos8.ittraining.loc systemd[1]: Started Automounts filesystems on demand. | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | # | ||
+ | # Init system options | ||
+ | # | ||
+ | # If the kernel supports using the autofs miscellanous device | ||
+ | # and you wish to use it you must set this configuration option | ||
+ | # to " | ||
+ | # | ||
+ | USE_MISC_DEVICE=" | ||
+ | # | ||
+ | # Use OPTIONS to add automount(8) command line options that | ||
+ | # will be used when the daemon is started. | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# vi / | ||
+ | [root@centos8 ~]# cat / | ||
+ | # | ||
+ | # Init system options | ||
+ | # | ||
+ | # If the kernel supports using the autofs miscellanous device | ||
+ | # and you wish to use it you must set this configuration option | ||
+ | # to " | ||
+ | # | ||
+ | USE_MISC_DEVICE=" | ||
+ | # | ||
+ | # Use OPTIONS to add automount(8) command line options that | ||
+ | # will be used when the daemon is started. | ||
+ | # | ||
+ | OPTIONS=" | ||
+ | # | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# systemctl restart autofs | ||
+ | [root@centos8 ~]# systemctl status autofs | ||
+ | ● autofs.service - Automounts filesystems on demand | ||
+ | | ||
+ | | ||
+ | Main PID: 67756 (automount) | ||
+ | Tasks: 5 (limit: 100949) | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | Oct 11 09:32:05 centos8.ittraining.loc systemd[1]: Starting Automounts filesystems on demand... | ||
+ | Oct 11 09:32:06 centos8.ittraining.loc systemd[1]: Started Automounts filesystems on demand. | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | # | ||
+ | # Sample auto.master file | ||
+ | # This is a ' | ||
+ | # mount-point [map-type[, | ||
+ | # For details of the format look at auto.master(5). | ||
+ | # | ||
+ | /misc / | ||
+ | # | ||
+ | # NOTE: mounts done from a hosts map will be mounted with the | ||
+ | # " | ||
+ | # | ||
+ | # | ||
+ | /net -hosts | ||
+ | # | ||
+ | # Include / | ||
+ | # The included files must conform to the format of this file. | ||
+ | # | ||
+ | +dir:/ | ||
+ | # | ||
+ | # If you have fedfs set up and the related binaries, either | ||
+ | # built as part of autofs or installed from another package, | ||
+ | # uncomment this line to use the fedfs program map to access | ||
+ | # your fedfs mounts. | ||
+ | #/ | ||
+ | # | ||
+ | # Include central master map if it can be found using | ||
+ | # nsswitch sources. | ||
+ | # | ||
+ | # Note that if there are entries for /net or /misc (as | ||
+ | # above) in the included master map any keys that are the | ||
+ | # same will not be seen as the first read key seen takes | ||
+ | # precedence. | ||
+ | # | ||
+ | +auto.master | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | # | ||
+ | # This is an automounter map and it has the following format | ||
+ | # key [ -mount-options-separated-by-comma ] location | ||
+ | # Details may be found in the autofs(5) manpage | ||
+ | |||
+ | cd -fstype=iso9660, | ||
+ | |||
+ | # the following entries are samples to pique your imagination | ||
+ | # | ||
+ | #boot | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | #jaz -fstype=ext2 | ||
+ | # | ||
+ | </ | ||
+ | ----- | ||
+ | Copyright © 2022 Hugh Norris. |