{"id":4986,"date":"2020-11-09T16:48:17","date_gmt":"2020-11-09T19:48:17","guid":{"rendered":"https:\/\/blog.clusterweb.com.br\/?p=4986"},"modified":"2020-11-09T16:51:24","modified_gmt":"2020-11-09T19:51:24","slug":"criando-e-adicionando-storage-lvm-thin-no-proxmox","status":"publish","type":"post","link":"https:\/\/blog.clusterweb.com.br\/?p=4986","title":{"rendered":"Criando e adicionando storage LVM-Thin no Proxmox"},"content":{"rendered":"<div class=\"section section-post-header\">\n<div class=\"section_wrapper clearfix\">\n<div class=\"column one post-header\">\n<div class=\"title_wrapper\">\n<h1 class=\"entry-title\"><img loading=\"lazy\" decoding=\"async\" class=\"scale-with-grid wp-post-image\" style=\"font-size: 16px;\" src=\"https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/imagem-1200x480.jpg\" alt=\"\" width=\"1200\" height=\"480\" \/><\/h1>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><!--more--><\/p>\n<div class=\"post-wrapper-content\">\n<div class=\"section the_content has_content\">\n<div class=\"section_wrapper\">\n<div class=\"the_content_wrapper\">\n<p>Hoje vou tratar de como adicionar um novo volume LVM no formato Thin usando um disco de 1TB para que ele seja adicionado como storage.<\/p>\n<blockquote><p><em>O LVM-Thin um formato de volume l\u00f3gico que permite Snapshot e Clone ao contr\u00e1rio do LVM. O LVM normalmente aloca blocos quando voc\u00ea cria um volume. Volume LVM-thin em vez disso, aloca blocos quando eles s\u00e3o escritos.<\/em><\/p><\/blockquote>\n<p>O PVE est\u00e1 instalado no disco\u00a0<em>\u201c\/dev\/sda\u201d<\/em>\u00a0e quero adicionar um segundo disco que no nosso caso \u00e9 o\u00a0<em>\u201c\/dev\/sdb\u201d<\/em><\/p>\n<p>Na imagem abaixo n\u00f3s vemos o status do disco, ele est\u00e1 sem parti\u00e7\u00e3o.<\/p>\n<pre><code>fdisk -l \/dev\/sdb<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-561\" src=\"https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-0.png\" sizes=\"auto, (max-width: 748px) 100vw, 748px\" srcset=\"https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-0.png 748w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-0-300x162.png 300w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-0-260x140.png 260w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-0-50x27.png 50w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-0-139x75.png 139w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-0-20x11.png 20w\" alt=\"\" width=\"748\" height=\"404\" \/><\/p>\n<p>Tamb\u00e9m podemos ver os grupos\/volumes LVM antes de adicionarmos o segundo disco com os comandos:<\/p>\n<pre><code>vgs lvs<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-562\" src=\"https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-1.png\" sizes=\"auto, (max-width: 749px) 100vw, 749px\" srcset=\"https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-1.png 749w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-1-300x163.png 300w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-1-260x141.png 260w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-1-50x27.png 50w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-1-138x75.png 138w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-1-20x11.png 20w\" alt=\"\" width=\"749\" height=\"406\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Primeiro vamos criar a parti\u00e7\u00e3o no formato Linux LVM:<\/p>\n<pre><code>cfdisk \/dev\/sdb<\/code><\/pre>\n<p>O cfdisk \u00e9 bem simples de usar, mas os passos s\u00e3o excluir a parti\u00e7\u00e3o se houver, criar e informar o\u00a0<em>\u201ctype\u201d<\/em>\u00a0como\u00a0<em>\u201cLinux LVM\u201d<\/em>\u00a0e salvar.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-563\" src=\"https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-2.png\" sizes=\"auto, (max-width: 751px) 100vw, 751px\" srcset=\"https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-2.png 751w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-2-300x161.png 300w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-2-260x140.png 260w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-2-50x27.png 50w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-2-140x75.png 140w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-2-20x11.png 20w\" alt=\"\" width=\"751\" height=\"403\" \/><\/p>\n<p>Podemos ver agora a parti\u00e7\u00e3o criada no tipo especificado.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-564\" src=\"https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-3.png\" sizes=\"auto, (max-width: 746px) 100vw, 746px\" srcset=\"https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-3.png 746w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-3-300x162.png 300w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-3-260x140.png 260w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-3-50x27.png 50w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-3-139x75.png 139w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-3-20x11.png 20w\" alt=\"\" width=\"746\" height=\"403\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Pr\u00f3ximo passo \u00e9 a cria\u00e7\u00e3o do volume f\u00edsico na parti\u00e7\u00e3o\u00a0<em>\u201c\/dev\/sdb1\u201d<\/em>, depois o grupo que chamei de \u201cpve2\u201d, e do volume l\u00f3gico com nome de \u201cdata2\u201d. Pode observar que os grupos\/volumes criados na instala\u00e7\u00e3o s\u00e3o pve e data por isso segui a mesma l\u00f3gica de nomes para o segundo grupo\/volume.<\/p>\n<p>Os comandos s\u00e3o nessa ordem:<\/p>\n<pre><code>pvcreate \/dev\/sdb1<\/code> <code>vgcreate pve2 \/dev\/sdb1<\/code> <code>lvcreate -T -l 100%FREE -n data2 pve2<\/code><\/pre>\n<p>Na cria\u00e7\u00e3o do volume l\u00f3gico vale observar que o par\u00e2metro \u201c-T\u201d \u00e9 para o formato\u00a0<em>Thin, \u201c-l 100%FREE\u201d para usar todo espa\u00e7o dispon\u00edvel na parti\u00e7\u00e3o e \u201c-n data2 pve2\u201d para dar o nome ao volume e vincular ao grupo \u201cpve2\u201d<\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-565\" src=\"https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-4.png\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" srcset=\"https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-4.png 750w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-4-300x162.png 300w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-4-260x141.png 260w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-4-50x27.png 50w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-4-139x75.png 139w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-4-20x11.png 20w\" alt=\"\" width=\"750\" height=\"406\" \/><\/p>\n<p>Vamos verificar se o processo ocorreu conforme deveria:<\/p>\n<pre><code>lvdisplay pve2\/data2<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-566\" src=\"https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-5.png\" sizes=\"auto, (max-width: 746px) 100vw, 746px\" srcset=\"https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-5.png 746w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-5-300x162.png 300w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-5-260x140.png 260w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-5-50x27.png 50w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-5-139x75.png 139w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-5-20x11.png 20w\" alt=\"\" width=\"746\" height=\"403\" \/><\/p>\n<p>Pronto, novo grupo\/volume criados, agora vamos para a interface gr\u00e1fica adicionar o storage.<\/p>\n<p>Menu\u00a0<em>\u201cDatacenter\u201d<\/em>, op\u00e7\u00e3o\u00a0<em>\u201cStorage\u201d<\/em>, bot\u00e3o\u00a0<em>\u201cAdd\u201d<\/em>, e\u00a0o tipo\u00a0<em>\u201cLVM-Thin\u201d<\/em>.<\/p>\n<p>Tendo a mesma l\u00f3gica dos nomes, na op\u00e7\u00e3o\u00a0<em>\u201cID<\/em>\u201d informo\u00a0<em>\u201clocal-lvm2\u201d<\/em>, \u00a0em\u00a0<em>\u201cVolume \u00a0group\u201d<\/em>\u00a0o grupo\u00a0<em>\u201cpve2\u201d<\/em>\u00a0e em\u00a0<em>\u201cThin Pool\u201d<\/em>\u00a0o volume\u00a0<em>\u201cdata2\u201d<\/em>. Em\u00a0<em>\u201cContent\u201d<\/em>\u00a0por padr\u00e3o as op\u00e7\u00f5es\u00a0<em>\u201cDisk Image, Container\u201d<\/em>\u00a0j\u00e1 est\u00e3o selecionadas, pois esse formato n\u00e3o permite backups ou imagens ISO.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-567\" src=\"https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-6.png\" sizes=\"auto, (max-width: 798px) 100vw, 798px\" srcset=\"https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-6.png 798w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-6-300x148.png 300w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-6-768x378.png 768w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-6-260x128.png 260w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-6-50x25.png 50w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-6-150x75.png 150w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-6-20x10.png 20w\" alt=\"\" width=\"798\" height=\"393\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Agora temos um novo\u00a0<em>Storage<\/em>\u00a0para utilizar. Lembrando que o\u00a0<em>LVM-Thin<\/em>\u00a0s\u00f3 permite formato de disco\u00a0<em>RAW.\u00a0<\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-574\" src=\"https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-7.png\" sizes=\"auto, (max-width: 927px) 100vw, 927px\" srcset=\"https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-7.png 927w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-7-300x105.png 300w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-7-768x268.png 768w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-7-260x91.png 260w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-7-50x17.png 50w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-7-150x52.png 150w, https:\/\/www.2w.eti.br\/wp-content\/uploads\/2017\/01\/proxmox-lvm-thin-7-20x7.png 20w\" alt=\"\" width=\"927\" height=\"324\" \/><\/p>\n<p><em>Observa\u00e7\u00f5es:<\/em><\/p>\n<blockquote><p><em>Um fato interessante de usar LVM para armazenar o disco virtual\u00a0\u00e9 sobre desempenho, pois ele \u00e9 criado em um volume\u00a0logico e com isso uma camada a menos.<\/em><\/p>\n<p><em>Como o formato LVM-Thin faz aloca\u00e7\u00e3o din\u00e2mica devemos ter cuidado com o tamanho de disco virtual da VMs, pois podemos criar discos maiores que o total do volume. \u00a0No exemplo desse artigo temos um volume de<\/em><em>\u00a0931GB, ent\u00e3o a soma dos discos virtuais n\u00e3o pode ser maior que o espa\u00e7o do storage em quest\u00e3o. \u00a0<\/em><\/p>\n<p>Volumes LVM-Thin n\u00e3o podem ser compartilhadas entre v\u00e1rios n\u00f3s, portanto, voc\u00ea s\u00f3 pode us\u00e1-las como armazenamento local.<\/p><\/blockquote>\n<blockquote><p>Outra quest\u00e3o \u00e9 sobre o fato de n\u00e3o ser criado um\u00a0<em>\u201carquivo\u201d do tipo RAW, mas \u00e9 um volume logico. Ent\u00e3o para transferir o \u201cdisco\u201d para outro host o mais simples \u00e9\u00a0fazer um backup\/restore usando uma m\u00eddia\u00a0externa ou transferindo\u00a0o backup para o outro host usando o \u201cscp\u201d. Se caso houver necessidade \u00e9 poss\u00edvel\u00a0montar o volume LVM em outro host e fazer a transfer\u00eancia.<\/em><\/p><\/blockquote>\n<blockquote><p>Referencias:<\/p>\n<p><a href=\"https:\/\/pve.proxmox.com\/wiki\/Storage_Model\">https:\/\/pve.proxmox.com\/wiki\/Storage_Model<\/a><\/p>\n<p><a href=\"https:\/\/pve.proxmox.com\/wiki\/Storage:_LVM_Thin\">https:\/\/pve.proxmox.com\/wiki\/Storage:_LVM_Thin<\/a><\/p><\/blockquote>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1,730,42,51,439,495,514,1162,691],"tags":[1504,770,351,1505,361,693,1155],"class_list":["post-4986","post","type-post","status-publish","format-standard","hentry","category-viazap","category-clusterweb","category-leitura-recomendada","category-linux-linuxrs","category-midia","category-profissional-de-ti","category-programacao","category-proxmox","category-virtualizacao-2","tag-adicionando","tag-criando","tag-e","tag-lvm-thin","tag-no","tag-proxmox","tag-storage"],"_links":{"self":[{"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/posts\/4986","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4986"}],"version-history":[{"count":2,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/posts\/4986\/revisions"}],"predecessor-version":[{"id":4990,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/posts\/4986\/revisions\/4990"}],"wp:attachment":[{"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4986"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4986"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4986"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}