Resizing disk

caplam

Active Member
Nov 14, 2018
19
0
41
Hi,
I added a disk to a host (1TB)
I added a lvm thinpool on that disk intially 100G.
I added to a guest a raw disk on that thinpool. Initially the size of the disk was 32G.
Ineed more room on that raw disk.
I resized the thin pool to 498G.
I resized the disk to 282G.
With dmesg i see that the guest see the new capacity.
When i try resize2fs /dev/sdb1 it tells me :
resize2fs 1.43.4 (31-Jan-2017)

Le système de fichiers a déjà 8388347 blocs (4k). Rien à faire !
Here the result of fdisk -l /dev/sdb

Disque /dev/sdb : 282 GiB, 302795194368 octets, 591396864 secteurs​

Unités : secteur de 1 × 512 = 512 octets​

Taille de secteur (logique / physique) : 512 octets / 512 octets​

taille d'E/S (minimale / optimale) : 512 octets / 512 octets​

Type d'étiquette de disque : gpt​

Identifiant de disque : BFBD7680-147B-448F-A223-D3F9E9B86358​


Périphérique Début Fin Secteurs Taille Type​

/dev/sdb1 2048 67108830 67106783 32G Système de fichiers Linux​


I certainly miss something obvious but i don't see what.

Edit: a detail which can be important: my guest is dedicated to docker. The second disk (the one i need to extend) is mounted in /home/docker/disk2.
i created docker volumes in it.



 
Last edited:
First - when resizing a thin-pool make sure to also increase the metadatasize of the pool (otherwise you could/will eventually lose data!).

Else: If the guest already sees that '/dev/sdb' is larger - I guess the missing step is to adapt the partition-table in the guest.
/dev/sdb is larger, /dev/sdb1 not yet

Hope that helps!
 
thanks for your answer.
I'll dig to see how to resize metadata pool (i thought it was done automatically).
I know that i have to resize /dev/sdb1 but i don't know how. Resize2fs tells me the size il already correct.

here is the result of lvdisplay on the host:
Code:
lvdisplay vgdocker

  --- Logical volume ---

  LV Name                lvdocker

  VG Name                vgdocker

  LV UUID                1CY4KS-7dZr-0C7i-QApW-Zuli-jXJd-75eKW9

  LV Write Access        read/write

  LV Creation host, time pve, 2018-11-15 09:31:20 +0100

  LV Pool metadata       lvdocker_tmeta

  LV Pool data           lvdocker_tdata

  LV Status              available

  # open                 2

  LV Size                498.00 GiB

  Allocated pool data    6.43%

  Allocated metadata     3.61%

  Current LE             127488

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     256

  Block device           253:11

  

  --- Logical volume ---

  LV Path                /dev/vgdocker/vm-106-disk-0

  LV Name                vm-106-disk-0

  VG Name                vgdocker

  LV UUID                FZLZZP-UdCU-9gn0-Zmhx-QPGr-GcfH-2qohpk

  LV Write Access        read/write

  LV Creation host, time pve, 2018-11-15 09:56:11 +0100

  LV Pool name           lvdocker

  LV Status              available

  # open                 1

  LV Size                282.00 GiB

  Mapped size            11.35%

  Current LE             72192

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     256

  Block device           253:13
 
Last edited:
If I read that correctly - you have increased the thinpool size (lvdocker), but not the LVSize of vm-106-disk-0 - use lvresize or the GUI for that (after resizing the metadata) .
I usually prefer the output of `lvs -a` and `vgs`, for these things, since it's a bit more concise and clearer.

After the LV vm-106-disk-0 is resized - you need to do the steps in the guest.
 
the vm-106-disk-0 is already resized. It shows 282Gib and 11,35% mapped
In the guest i only see 32Gib

Code:
lvs- a vgdocker

 LV               VG       Attr       LSize   Pool     Origin Data%  Meta%  Move Log Cpy%Sync Convert

  lvdocker         vgdocker twi-aotz-- 498.00g                 6.43   3.61                            

  [lvdocker_tdata] vgdocker Twi-ao---- 498.00g                                                        

  [lvdocker_tmeta] vgdocker ewi-ao---- 128.00m                                                        

  [lvol0_pmspare]  vgdocker ewi------- 128.00m                                                        

  vm-106-disk-0    vgdocker Vwi-aotz-- 282.00g lvdocker        11.35
 
sorry - misread the sizes - I thought you wanted vm-106-disk-0 to have 498G
check the output of `lsblk` in the guest - I guess /dev/sdb will have 282G, but /dev/sdb1 will still be 32G:
in that case you need to resize the partition 1 of /dev/sdb (with parted/gdisk/sgdisk), and afterwards you can resize the filesystem on it.
 
I extended the metadata pool. I understood that it has to be around 1% of thinpool.
Code:
lvextend --poolmetadatasize +4.9G vgdocker/lvdocker


lvs -a vgdocker

  LV               VG       Attr       LSize   Pool     Origin Data%  Meta%  Move Log Cpy%Sync Convert

  lvdocker         vgdocker twi-aotz-- 498.00g                 7.22   0.11                            

  [lvdocker_tdata] vgdocker Twi-ao---- 498.00g                                                        

  [lvdocker_tmeta] vgdocker ewi-ao----   5.03g                                                        

  [lvol0_pmspare]  vgdocker ewi------- 128.00m                                                        

  vm-106-disk-0    vgdocker Vwi-aotz-- 282.00g lvdocker        12.74

I couldn't resize my partition on line perhaps because it's mounted.
I could to it with gparted live cd. No need for resize2fs after that.
Code:
fdisk -l /dev/sdb

Disque /dev/sdb : 282 GiB, 302795194368 octets, 591396864 secteurs

Unités : secteur de 1 × 512 = 512 octets

Taille de secteur (logique / physique) : 512 octets / 512 octets

taille d'E/S (minimale / optimale) : 512 octets / 512 octets

Type d'étiquette de disque : gpt

Identifiant de disque : BFBD7680-147B-448F-A223-D3F9E9B86358


Périphérique Début       Fin  Secteurs Taille Type

/dev/sdb1     2048 591394815 591392768   282G Système de fichiers Linux