preload preload preload preload

LVM : étendre un Volume Groupe par ajout d'un nouveau disque dur


Le vendredi 07 décembre 2012 par madpellzo Système, Linux, LVM 61 commentaires
Cet article va vous expliquer comment étendre une partition montée au dessous de LVM (un logical volume) par extension du volume group sur lequel il est posé, par ajout d'un disque dur supplémentaire (et oui, LVM est en fait un jeu de poupée russe !)

LVM (pour Logical Volume Manager) est un formidable outil de gestion de l'espace de stockage. LVM est un véritable jeu de poupée russe.
Commençons par un peu de vocabulaire. Dans l'ordre, de la couche la plus basse (les disques durs) vers la couche la plus haute : le file système.
- Vos disques durs câblé dans votre serveur ou dans un SAN
- Physical Volume : ce sont vos disques durs ou un volume RAID ou un volume provenant d'un SAN
- Volume Group : concaténation des volumes physiques
- Logical Volume : découpage des volumes groupes
- File system : système de fichier posé au dessus des volumes groupes

Rentrons dans le vif du sujet : on a un disque dur déjà en place avec une distribution Linux qui tourne dessus :
- un physical volume : /dev/vda5
- un volume groupe qui prend tout ce physical volume : /dev/vg00
- un volume logique sur leqquel l'OS est installé appartenant /dev/vg00 : /dev/vg00/root sur lequel est montée la partition root (le /)
On souhaite étendre / par ajout d'un nouveau disque dur. On éteint donc la machine, on rajout le nouveau disque et on redémarre la machine. On se retrouve alors avec un nouveau disque : /dev/vdb On va commencé par créer une partition LVM qui va occuper tout ce nouveau disque :

# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x3657f1c2.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

On affiche la table de pratition (vide évidemment) :

Command (m for help): p

Disk /dev/vdb: 21.5 GB, 21474836480 bytes
16 heads, 63 sectors/track, 41610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3657f1c2

   Device Boot      Start         End      Blocks   Id  System

On crée une nouvelle parition

Command (m for help): n

On choisit une partition type "primary"

Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p

On lui donne un numéro (c'est la première donc "1"):

Partition number (1-4, default 1): 1
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):
Using default value 41943039

On va "typer" la partition, c'est a dire que l'on va indiquer que cette partition est une partition LVM, elle sera donc prise en charge par LVM.

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

8e est le code pour LVM, vu qu'il n'y a qu'une partition, pas besoin de la sélection, fdisk l'a fait pour vous. On affiche la table de partition :

Command (m for help): p

Disk /dev/vdb: 21.5 GB, 21474836480 bytes
16 heads, 63 sectors/track, 41610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3657f1c2

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048    41943039    20970496   8e  Linux LVM

On a bien une partition de type "LVM" Enfin, on écrit la table:

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.

Voilà pour la partie "bas niveau". Maintenant, occupons-nous de LVM
Nous allons commencer par étendre le volume groupe vg00 sur ce nouveau physical volume

# vgextend vg00 /dev/vdb1
  No physical volume label read from /dev/vdb1
  Physical volume "/dev/vdb1" successfully created
  Volume group "vg00" successfully extended

La commande "vgdisplay /dev/vg00" va vous montrer que la taille de vg00 a augmenter avec le nouveau disque.
Nous allons maintenant étendre le volume groupe à la totalité de l'esapce libre de vg00:

# lvextend -l +100%FREE /dev/vg00/root
  Extending logical volume root to 37.85 GiB
  Logical volume root successfully resized

Un petit coup de "lvdisplay /dev/vg00/root" vous montre qu'en effet la taille du locial volume a augmenté (de la taille du disque que vous avez insérer dans votre serveur). Vous pouvez bien évidemment étendre le logical volume à la taille souhaitée si vous souhaitez ajouter un autre logical volume par la suite sur l'espace disponible.
Il nous reste plus qu'à étendre le file système du logical volume :

# resize2fs /dev/vg00/root
resize2fs 1.42 (29-Nov-2011)
Filesystem at /dev/vg00/root is mounted on /; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 3
Performing an on-line resize of /dev/vg00/root to 9921536 (4k) blocks.
The filesystem on /dev/vg00/root is now 9921536 blocks long.

Et voilà ! Le tout n'a nécessité qu'un reboot pour installer le nouveau disque dur, ensuite, tout ce fait en "live" !

Mots clés : aucun

  • Commentaires

  • Avatar Gravatar
     Sil20
     #1 Le 30 octobre 2013

    Merci :-)

  • Avatar Gravatar
     Bruno
     #2 Le 14 février 2014

    Super tuto.
    j'ai un peu flippé lors de l'étape de resize ...ca n'en finissait pas ! mais tout a parfaitement marché.

    Merci.

  • Avatar Gravatar
     greg
     #3 Le 03 juin 2014

    super, merci
    lvdisplay pour voir le nom de votre volumegroup

  • Avatar Gravatar
     frack
     #4 Le 18 mai 2016

    Super,
    très clair.
    En plus ça marche :-)
    Quoi? des fois les tutos marchent pas!!! :-)

  • Avatar Gravatar
     Da Silva Renaud
     #5 Le 06 avril 2017

    Pratique et concis pour utiliser lvm. C'est vraiment souple de redimensionner une partition en ajoutant une autre partition du disque non contingente !

    Super tuto ! Merci

  • Avatar Gravatar
     bandar Bola
     #6 Le 10 juillet 2017

    May I just say what a relief to find somebody who truly knows what they're discussing over the internet.

    You definitely understand how to bring an issue to light and make it important.

    More people need to check this out and understand this side of your story.
    I was surprised that you are not more popular given that you certainly possess the gift.

  • Avatar Gravatar
     Pantai Pangandaran
     #7 Le 10 juillet 2017

    I've been surfing online more than 3 hours today, yet I never
    found any interesting article like yours. It is pretty worth enough for me.
    In my view, if all webmasters and bloggers made good
    content as you did, the web will be much more useful than ever before.

  • Avatar Gravatar
     backlink
     #8 Le 10 juillet 2017

    This is the right web site for everyone who would like to find out
    about this topic. You understand so much its almost tough to argue with you
    (not that I personally will need to…HaHa). You certainly put a new spin on a topic that has been written about for ages.
    Wonderful stuff, just wonderful!

  • Avatar Gravatar
     Backlink Pbn
     #9 Le 10 juillet 2017

    Everything is very open with a clear description of the challenges.
    It was truly informative. Your website is very helpful.
    Thank you for sharing!

  • Avatar Gravatar
     Aspoker88.net
     #10 Le 10 juillet 2017

    Ridiculous quest there. What happened after? Take care!

  • Avatar Gravatar
     ZS
     #11 Le 12 juillet 2017

    Super Tuto Merci beaucoup

  • Avatar Gravatar
     Tour komodo National Park
     #12 Le 14 juillet 2017

    Hi! I've been reading your website for some time now and
    finally got the courage to go ahead and give you a shout out from
    Porter Tx! Just wanted to say keep up the great job!

  • Avatar Gravatar
     Jasa Backlink
     #13 Le 15 juillet 2017

    Thank you for any other informative site. The place else could I
    am getting that type of info written in such an ideal means?
    I have a undertaking that I'm simply now running on, and I
    have been at the glance out for such information.

  • Avatar Gravatar
     indonesia travel packages
     #14 Le 17 juillet 2017

    Awesome post.

  • Avatar Gravatar
     Jasa backlink
     #15 Le 22 juillet 2017

    This article gives clear idea designed for the new
    visitors of blogging, that genuinely how to do blogging and site-building.

  • Avatar Gravatar
     judi poker online
     #16 Le 26 juillet 2017

    Hi there to all, since I am really eager of reading this blog's post
    to be updated regularly. It carries nice information.

  • Avatar Gravatar
     bus pariwisata
     #17 Le 26 juillet 2017

    I seriously love your site.. Pleasant colors & theme. Did you develop this website yourself?
    Please reply back as I'm wanting to create my own website and would like to know where you got this from or exactly what the theme is called.
    Kudos!

  • Avatar Gravatar
     Daftar hotel di bali
     #18 Le 27 juillet 2017

    Hello to every one, as I am genuinely keen of reading this web site's post to be updated on a regular basis.

    It consists of fastidious data.

  • Avatar Gravatar
     Paket Umroh Promo
     #19 Le 27 juillet 2017

    Hello friends, how is everything, and what you wish for to say concerning this piece of writing, in my view its truly remarkable for me.

  • Avatar Gravatar
     penginapan murah di jakarta
     #20 Le 28 juillet 2017

    Thank you for sharing your thoughts. I truly appreciate your efforts and I
    will be waiting for your next post thank you once again.

  • Avatar Gravatar
     https://www.barneseagles.com/
     #21 Le 28 juillet 2017

    I'm really enjoying the design and layout of your blog.
    It's a very easy on the eyes which makes it much more pleasant for me to come here and visit more often. Did you hire
    out a developer to create your theme? Exceptional work!

  • Avatar Gravatar
     agen judi Bola online
     #22 Le 29 juillet 2017

    Hello, Neat post. There's a problem together with your website in intrernet explorer, would check this?

    IE still is the market leader and a huge portion of folks will
    pass over your great writing due to this problem.

  • Avatar Gravatar
     jasa Backlink
     #23 Le 30 juillet 2017

    If you want to increase your knowledge simply keep visiting this web site and be updated with the
    most recent information posted here.

  • Avatar Gravatar
     Rickey
     #24 Le 01 août 2017

    It's an remarkable paragraph in support of all the web people; they will take advantage from
    it I am sure.

  • Avatar Gravatar
     Watch Movie
     #25 Le 02 août 2017

    What's up to every single one, it's in fact a pleasant for me to
    go to seee this web page, it contains useful Information.

  • Avatar Gravatar
     pokemon the movie 2000 stream
     #26 Le 05 août 2017

    Hello, i read yoսr blog occasionally and i own a similar оne and
    i waѕ just wondering if you get a lot of ѕpam
    сomments? If so how dо you prevent it, any plugin or anything you can recommend?
    I get so much lately it's driving me inssane
    so anyy hеlp is very much appreciated.

  • Avatar Gravatar
     Diary Of A Wimpy Kid: The Long Haul
     #27 Le 05 août 2017

    Ⴝweet blog! I found it while surfing around
    on Yahoo News. Do y᧐u have any tips on how to get listed in Yaһoo News?

    I've been trying for а while but I never seem to get there!

    Thank you

  • Avatar Gravatar
     Tsui Hark's Vampire Hunters (2003)
     #28 Le 05 août 2017

    Greaqt delivery.Sound argumentѕ. Қeep up the amazing spіrіt.

  • Avatar Gravatar
     Komodo Tours
     #29 Le 07 août 2017

    Howdy! Do you use Twitter? I'd like to follow you if that would be okay.
    I'm definitely enjoying your blog and look forward to new updates.

  • Avatar Gravatar
     package tours komodo dragon
     #30 Le 07 août 2017

    This piece of writing is really a nice one it helps new web viewers, who are wishing for blogging.

  • Avatar Gravatar
     Eco Tours Flores Komodo
     #31 Le 09 août 2017

    Hello, just wanted to mention, I loved this blog
    post. It was helpful. Keep on posting!

  • Avatar Gravatar
     Krim Muka
     #32 Le 17 août 2017

    My spouse and I stumbled over here coming from a different
    page and thought I may as well check things out. I like what I
    see so i am just following you. Look forward to exploring your web page
    repeatedly.

  • Avatar Gravatar
     jasa backlink
     #33 Le 19 août 2017

    I believe what you said made a lot of sense. However, what about this?
    suppose you added a little information? I ain't
    saying your content is not solid., but suppose you added a title that makes people desire more?

    I mean LVM : étendre un Volume Groupe par ajout d'un nouveau disque dur - Madpellzo
    is a little boring. You ought to glance at Yahoo's front page and see how they create article titles to grab
    people interested. You might try adding a video or a related
    picture or two to grab readers excited about everything've written. Just my opinion, it
    might make your posts a little bit more interesting.

  • Avatar Gravatar
     wonderfull indonesia
     #34 Le 31 août 2017

    Howdy! I know this is kinda off topic but I was wondering
    which blog platform are you using for this site? I'm getting fed up
    of Wordpress because I've had issues with hackers and I'm looking at options for
    another platform. I would be awesome if you could point
    me in the direction of a good platform.

  • Avatar Gravatar
     kecelakaan
     #35 Le 31 août 2017

    After checking out a few of the blog articles on your web site, I honestly appreciate your technique of blogging.
    I bookmarked it to my bookmark site list and will be checking back in the near future.
    Take a look at my website too and tell me your opinion.

  • Avatar Gravatar
     Pangandaran
     #36 Le 02 septembre 2017

    This blog was... how do you say it? Relevant!!

    Finally I've found something which helped me. Many thanks!

  • Avatar Gravatar
     Qiu Qiu
     #37 Le 07 septembre 2017

    Fastidious response in return of this matter with genuine arguments
    and explaining the whole thing concerning that.

  • Avatar Gravatar
     Bedroom
     #38 Le 30 septembre 2017

    Thank you for sharing your info. I truly appreciate
    your efforts and I will be waiting for your further post thank you once again.

  • Avatar Gravatar
     Tour Pangandaran 2D1N
     #39 Le 05 octobre 2017

    I have read so many posts regarding the blogger lovers except this article is truly a nice post, keep
    it up.

  • Avatar Gravatar
     Harga Mesin Ro
     #40 Le 11 octobre 2017

    I used to be recommended this blog via my cousin. I'm not certain whether this publish is written through
    him as no one else know such distinctive about my difficulty.
    You're incredible! Thanks!

  • Avatar Gravatar
     agen Bola
     #41 Le 18 octobre 2017

    I am regular visitor, how are you everybody?

    This post posted at this web page is actually fastidious.

  • Avatar Gravatar
     Domino Poker
     #42 Le 23 octobre 2017

    Hello are using Wordpress for your blog platform? I'm new to the blog world but I'm trying to get started
    and set up my own. Do you need any html coding knowledge to make your own blog?
    Any help would be greatly appreciated!

  • Avatar Gravatar
     Agen Bola Online
     #43 Le 23 octobre 2017

    A fascinating discussion is worth comment. I believe that you should write
    more on this topic, it might not be a taboo matter but
    typically people don't discuss such subjects. To the next!
    All the best!!

  • Avatar Gravatar
     Agen Bola Online
     #44 Le 24 octobre 2017

    Whats up this is somewhat of off topic but I was wanting
    to know if blogs use WYSIWYG editors or if you
    have to manually code with HTML. I'm starting a blog soon but have no coding
    knowledge so I wanted to get guidance from
    someone with experience. Any help would be enormously appreciated!

  • Avatar Gravatar
     jasa seo
     #45 Le 25 octobre 2017

    I'm truly enjoying the design and layout of your blog.

    It's a very easy on the eyes which makes it much more pleasant for me to come here and visit
    more often. Did you hire out a developer to
    create your theme? Fantastic work!

  • Avatar Gravatar
     Bola 168
     #46 Le 06 novembre 2017

    I constantly spent my half an hour to read this website's content daily along
    with a cup of coffee.

  • Avatar Gravatar
     Bola168
     #47 Le 06 novembre 2017

    Greetings from Ohio! I'm bored to tears at work so I decided to browse your site on my iphone during lunch break.

    I love the info you present here and can't wait to take a look when I get home.
    I'm shocked at how fast your blog loaded on my cell phone ..
    I'm not even using WIFI, just 3G .. Anyhow, fantastic blog!

  • Avatar Gravatar
     wisata Komodo
     #48 Le 07 novembre 2017

    Hi, i think that i saw you visited my site so
    i came to “return the favor”.I'm attempting to find things to enhance my web site!I suppose
    its ok to use a few of your ideas!!

  • Avatar Gravatar
     Bonus Bola168
     #49 Le 12 novembre 2017

    Heya i'm for the primary time here. I came across this board and I to find It truly useful & it helped me out a lot.
    I'm hoping to offer one thing again and aid others like you aided me.

  • Avatar Gravatar
     Bandar taruhan bola
     #50 Le 13 novembre 2017

    Everything composed was very logical. But, think on this, what if you were to create a killer headline?
    I ain't suggesting your information isn't good., but what if you added a headline that makes people want more?

    I mean LVM : étendre un Volume Groupe par ajout d'un nouveau disque dur - Madpellzo is a little plain. You might look at Yahoo's
    home page and watch how they write post headlines to grab viewers to click.
    You might add a related video or a pic or two to grab people excited about
    everything've written. Just my opinion, it might bring your website a little
    bit more interesting.

  • Avatar Gravatar
     shit
     #51 Le 15 novembre 2017

    The art of ghazal singing has been able to entice millions round
    the globe. A model with 3 CCD includes a sensor that picks up all the different colors (Red,
    Green, and Blue) producing superior color reproduction. Here it is possible to shop by
    theme or browse an entire selection of themes in case you are
    sill unsure on what to base the party.

  • Avatar Gravatar
     poker Indonesia
     #52 Le 23 novembre 2017

    Hi, I do think this is a great blog. I stumbledupon it ;) I
    may come back yet again since i have bookmarked it.
    Money and freedom is the best way to change, may you be rich and continue to guide others.

  • Avatar Gravatar
     Bandar Sakong
     #53 Le 24 novembre 2017

    What's up colleagues, pleasant post and pleasant arguments commented at this place, I am really enjoying by these.

  • Avatar Gravatar
     Poker Online
     #54 Le 24 novembre 2017

    It's perfect time to make some plans for the future and it
    is time to be happy. I've read this post and if I could I desire
    to suggest you few interesting things or advice. Perhaps
    you could write next articles referring to this article. I desire
    to read even more things about it!

  • Avatar Gravatar
     Charmain
     #55 Le 11 décembre 2017

    Hi there, this weekend is pleasant designed for me, because this point
    in time i am reading this wonderful educational paragraph here at my house.

  • Avatar Gravatar
     Rudolf
     #56 Le 11 décembre 2017

    This is the perfect webpage for everyone who wishes to find
    out about this topic. You realize so much its almost tough to argue with
    you (not that I actually will need to…HaHa).
    You definitely put a brand new spin on a subject which has been written about for decades.

    Great stuff, just great!

  • Avatar Gravatar
     Qiu Qiu
     #57 Le 15 décembre 2017

    Heya i am for the first time here. I came across this board and I in finding It truly helpful & it helped me out a lot.
    I'm hoping to present something back and aid others like you aided me.

  • Avatar Gravatar
     taruhan
     #58 Le 03 janvier 2018

    Very good info. Lucky me I found your blog by accident (stumbleupon).
    I've book marked it for later!

  • Avatar Gravatar
     Http://www.eventticketsexpress.com
     #59 Le 03 janvier 2018

    Write more, thats all I have to say. Literally, it
    seems as though you relied on the video to
    make your point. You definitely know what youre talking about, why waste your intelligence
    on just posting videos to your weblog when you
    could be giving us something informative to read?

  • Avatar Gravatar
     Appadanatv.net
     #60 Le 03 janvier 2018

    Howdy just wanted to give you a quick heads up.
    The words in your content seem to be running off the screen in Safari.
    I'm not sure if this is a formatting issue or something to do with web browser compatibility but I thought
    I'd post to let you know. The design look great
    though! Hope you get the problem fixed soon. Thanks

  • Avatar Gravatar
     agen
     #61 Le 05 janvier 2018

    Thank you for the auspicious writeup. It in fact was
    a amusement account it. Look advanced to far added agreeable from you!

    However, how could we communicate?

  • Ecrire un commentaire








    Quelle est la première lettre du mot wlolqq ?