Você pode criar um volumegroup no LVM que todos os volumes lógicos criados sob ele serão thin provisioned?

3

Eu gostaria de saber se é possível criar um grupo de volume no LVM que todos os volumes lógicos criados sob ele serão thin provisioned?

Isso será usado no RHEL 6, que inclui o thin provisioning no LVM.

Estou aberto a alternativas também.

    
por awmusic12635 24.05.2013 / 17:54

2 respostas

1

A resposta agora eu acredito é 'meio que não'. Eu tenho usado esse recurso por alguns dias agora no Ubuntu 14.04, e parece que o recurso thinpool foi adicionado como um tipo de volume lógico, em vez de no nível de grupo de volume, o que parece ser uma quebra de abstração estranha. provavelmente há razões, não especularemos aqui). De qualquer forma, você pode fazer um thinpool que ocupa quase todo o grupo de volume (lvcreate reclama se você fizer o mesmo tamanho exato), e então alias um comando ou escrever um script que chama lvcreate com o nome thinpool pré-preenchido, e você basicamente tem o que você quer.

    
por 20.05.2015 / 09:52
1

Sim, você pode criar um grupo de volumes para o provisionamento thin. A seguir estão as etapas detalhadas, copiadas de aqui :

# pvcreate /dev/sdd
Writing physical volume data to disk "/dev/sdd"
Physical volume "/dev/sdd" successfully created

I can see now that I have a new physical volume.

# pvdisplay
"/dev/sdd" is a new physical volume of "1.36 TiB"         --- NEW Physical volume ---         PV Name /dev/sdd        VG Name         PV Size 1.36 TiB
  Allocatable NO      PE Size 0       Total PE 0      Free PE 0       Allocated PE 0
  PV UUID Ndb90e-xkJX-Lagt-VePO-ZNLQ-udVn-SN65et

Next we need to create a volume group.

  # vgcreate vg_1 /dev/sdd        Volume group "vg_1" successfully created

Now that we have both the physical volume and volume group, lets add some logical volumes. To begin, we want to add a logical volume pool to hold our thinly provisioned volumes within it.

  # lvcreate --size 10G --type thin-pool --thinpool thin_pool vg_1
  Rounding up size to full physical extent 4.00 MiB       Logical volume

"thin_pool" created

I created a 10GB pool for this test.

  # lvs       LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
  thin_pool vg_1 twi-a-tz 10.00g 0.00

Now we can add the thin volume itself, a 4GB logical volume within thin_pool.

  # lvcreate -V4G -T vg_1/thin_pool --name lv1        Logical volume "lvl"

created

Now that we have everything created, lets look at what we have.

  # lvs       LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
  lv1 vg_1 Vwi-a-tz 4.00g thin_pool 0.00      thin_pool vg_1 twi-a-tz

10.00g 0.00

You can see when calling lvs that 0% of the lv is taken so far.

Next let’s format the new logical volume, and mount it.

  # mkfs.ext4 /dev/vg_1/lv1       # mount /dev/vg_1/lv1 /mnt

With df we can see that 4GB is available.

  # df -h         ...         /dev/mapper/vg_1-lv1 4.0G 136M 3.7G 4% /mnt

Our used space comes from the filesystem and we can see with lvs that the orgin data is filling up.

  # lvs       LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
  lv1 vg_1 Vwi-aotz 4.00g thin_pool 4.73      thin_pool vg_1 twi-a-tz

10.00g 1.89

Copying a iso image into our thin lv we can see it expand further.

  # cp /home/sean/Downloads/ubuntu-12.10-beta2-server-amd64.iso /mnt
  # lvs       LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
  lv1 vg_1 Vwi-aotz 4.00g thin_pool 7.73      thin_pool vg_1 twi-a-tz

10.00g 6.37 # df -h .... /dev/mapper/vg_1-lv1 4.0G 827M 3.0G 22% /mnt

Lastly, looking at our thin pool, you can also see the space taken within the pool by the thin lv.

# lvdisplay
--- Logical volume ---
LV Name thin_pool
VG Name vg_1
LV UUID kD3VC1-FBNj-wHER-iFhE-NjES-GDoS-sFCnwF
LV Write Access read/write
LV Creation host, time fedora, 2012-10-11 21:43:51 -0700
LV Pool transaction ID 1
LV Pool metadata thin_pool_tmeta
LV Pool data thin_pool_tdata
LV Pool chunk size 64.00 KiB
LV Zero new blocks yes
LV Status available
# open 0
LV Size 10.00 GiB
Allocated pool data 8.64%
Allocated metadata 4.30%
Current LE 2560
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:4


--- Logical volume ---
LV Path /dev/vg_1/lv1
LV Name lv1
VG Name vg_1
LV UUID b7FLSq-dMTi-mEbl-vZxq-Ocol-9Y2o-AEBhgL
LV Write Access read/write
LV Creation host, time fedora, 2012-10-11 21:44:11 -0700
LV Pool name thin_pool
LV Status available
# open 1
LV Size 4.00 GiB
Mapped size 21.60%
Current LE 1024
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:5
    
por 24.05.2013 / 18:59

Tags