<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><title>Diviser un groupe de volumes</title><link href="style.css" rel="stylesheet" type="text/css" /><meta content="DocBook XSL Stylesheets V1.73.2" name="generator" /><link rel="start" href="index.html" title="Guide pratique de LVM" /><link rel="up" href="ch13.html" title="Chapitre 13. Recettes" /><link rel="prev" href="ch13s06.html" title="Déplacer un groupe de volumes vers un autre système" /><link rel="next" href="ch13s08.html" title="Convertir le système de fichiers racine en LVM 1" /></head><body><div class="navheader"><table summary="Navigation header" width="100%"><tr><th align="center" colspan="3">Diviser un groupe de volumes</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="ch13s06.html">Précédent</a> </td><th align="center" width="60%">Chapitre 13. Recettes</th><td align="right" width="20%"> <a accesskey="n" href="ch13s08.html">Suivant</a></td></tr></table><hr /></div><div class="sect1" lang="fr"><div class="titlepage"><div><div><h2 class="title"><a id="recipesplitvg" />Diviser un groupe de volumes</h2></div></div></div><p> Supposons que nous devons rajouter le nouveau groupe d'utilisateurs « <span class="quote">design</span> » au système. Un moyen de le gérer est d'ajouter un groupe de volumes au système pour y mettre leurs données. Ici, nous n'avons pas de nouveau disque mais beaucoup d'espace libre sur les disques existants qui peut être réalloué. </p><div class="sect2" lang="fr"><div class="titlepage"><div><div><h3 class="title"><a id="N10C14" />Déterminer l'espace libre</h3></div></div></div><pre class="screen"> # pvscan pvscan -- reading all physical volumes (this may take a while...) pvscan -- ACTIVE PV "/dev/sda" of VG "dev" [1.95 GB / 0 free] pvscan -- ACTIVE PV "/dev/sdb" of VG "sales" [1.95 GB / 1.27 GB free] pvscan -- ACTIVE PV "/dev/sdc" of VG "ops" [1.95 GB / 564 MB free] pvscan -- ACTIVE PV "/dev/sdd" of VG "dev" [1.95 GB / 0 free] pvscan -- ACTIVE PV "/dev/sde" of VG "ops" [1.95 GB / 1.9 GB free] pvscan -- ACTIVE PV "/dev/sdf" of VG "dev" [1.95 GB / 1.33 GB free] pvscan -- ACTIVE PV "/dev/sdg1" of VG "ops" [996 MB / 432 MB free] pvscan -- ACTIVE PV "/dev/sdg2" of VG "dev" [996 MB / 632 MB free] pvscan -- total: 8 [13.67 GB] / in use: 8 [13.67 GB] / in no VG: 0 [0] </pre><p> Nous décidons de réallouer /dev/sdg1 et /dev/sdg2 à « <span class="quote">design</span> ». Il faut commencer par déplacer tous les extents physiques dans des espaces libres d'autres volumes (dans notre cas /dev/sdf pour le VG dev et /dev/sde pour ops). </p></div><div class="sect2" lang="fr"><div class="titlepage"><div><div><h3 class="title"><a id="N10C1F" />Déplacer les données des disques à réutiliser</h3></div></div></div><p> De l'espace est toujours utilisé sur les volumes choisis, il faut donc déplacer les données autre part. </p><p> Déplacez tous les extents physiques utilisés de /dev/sdg1 vers /dev/sde et de /dev/sdg2 vers /dev/sdf. </p><pre class="screen"> # pvmove /dev/sdg1 /dev/sde pvmove -- moving physical extents in active volume group "ops" pvmove -- WARNING: moving of active logical volumes may cause data loss! pvmove -- do you want to continue? [y/n] y pvmove -- doing automatic backup of volume group "ops" pvmove -- 141 extents of physical volume "/dev/sdg1" successfully moved # pvmove /dev/sdg2 /dev/sdf pvmove -- moving physical extents in active volume group "dev" pvmove -- WARNING: moving of active logical volumes may cause data loss! pvmove -- do you want to continue? [y/n] y pvmove -- doing automatic backup of volume group "dev" pvmove -- 91 extents of physical volume "/dev/sdg2" successfully moved </pre></div><div class="sect2" lang="fr"><div class="titlepage"><div><div><h3 class="title"><a id="N10C29" />Créer un nouveau groupe de volumes</h3></div></div></div><p> Maintenant, séparez /dev/sdg2 de dev et ajoutez-le à un nouveau groupe appelé « <span class="quote">design</span> ». Il est possible de faire cela avec vgreduce et vgcreate, mais vgsplit combine les deux commandes. </p><pre class="screen"> # vgsplit dev design /dev/sdg2 vgsplit -- doing automatic backup of volume group "dev" vgsplit -- doing automatic backup of volume group "design" vgsplit -- volume group "dev" successfully split into "dev" and "design" </pre></div><div class="sect2" lang="fr"><div class="titlepage"><div><div><h3 class="title"><a id="N10C34" />Enlever le volume restant</h3></div></div></div><p> Ensuite, enlevez /dev/sdg1 de ops et ajoutez-le dans design. </p><pre class="screen"> # vgreduce ops /dev/sdg1 vgreduce -- doing automatic backup of volume group "ops" vgreduce -- volume group "ops" successfully reduced by physical volume: vgreduce -- /dev/sdg1 # vgextend design /dev/sdg1 vgextend -- INFO: maximum logical volume size is 255.99 Gigabyte vgextend -- doing automatic backup of volume group "design" vgextend -- volume group "design" successfully extended </pre></div><div class="sect2" lang="fr"><div class="titlepage"><div><div><h3 class="title"><a id="N10C3C" />Créer le nouveau volume logique</h3></div></div></div><p> Maintenant, créez un volume logique. Au lieu d'allouer tout l'espace disponible, gardez un peu d'espace de réserve au cas où vous en auriez besoin ailleurs. </p><pre class="screen"> # lvcreate -L750M -n users design lvcreate -- rounding up size to physical extent boundary "752 MB" lvcreate -- doing automatic backup of "design" lvcreate -- logical volume "/dev/design/users" successfully created </pre></div><div class="sect2" lang="fr"><div class="titlepage"><div><div><h3 class="title"><a id="N10C44" />Créez un système de fichiers sur le volume</h3></div></div></div><pre class="screen"> # mke2fs /dev/design/users mke2fs 1.18, 11-Nov-1999 for EXT2 FS 0.5b, 95/08/09 Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 96384 inodes, 192512 blocks 9625 blocks (5.00<!-- ) reserved for the super user First data block=0 6 block groups 32768 blocks per group, 32768 fragments per group 16064 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840 Writing inode tables: done Writing superblocks and filesystem accounting information: done </pre></div><div class="sect2" lang="fr"><div class="titlepage"><div><div><h3 class="title"><a id="N10C4A" />Montez le nouveau volume</h3></div></div></div><pre class="screen"> # mkdir -p /mnt/design/users # mount /dev/design/users /mnt/design/users/ </pre><p> C'est aussi une bonne d'idée d'ajouter une entrée dans /etc/fstab pour ce système de fichiers : </p><pre class="screen"> /dev/design/user /mnt/design/users ext2 defaults 1 2 </pre></div></div><div class="navfooter"><hr /><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="ch13s06.html">Précédent</a> </td><td align="center" width="20%"><a accesskey="u" href="ch13.html">Niveau supérieur</a></td><td align="right" width="40%"> <a accesskey="n" href="ch13s08.html">Suivant</a></td></tr><tr><td valign="top" align="left" width="40%">Déplacer un groupe de volumes vers un autre système </td><td align="center" width="20%"><a accesskey="h" href="index.html">Sommaire</a></td><td valign="top" align="right" width="40%"> Convertir le système de fichiers racine en LVM 1</td></tr></table></div></body></html>