Add disk space lvm vm

Jan 16, 2014
40
0
26
Hi,
I'am trying to extend the space in the disks of my vms.
I followed the link http://pve.proxmox.com/wiki/Resizing_disks but at the step "Linux client with LVM" I can't do
Code:
pvcreate /dev/sda6
  Device /dev/sda6 not found (or ignored by filtering).


Before in the master server I've tried to do
Code:
qemu-nbd -c /dev/nbd0 vm-107-disk-1.qcow2
and I correctly see new free space. But in the vm-107 I can't add this free space.

Where am I wrong? Thanks.
 
i think it's best if you could post at least
- the linux client .conf
- linux client fdisk -l
- vgs/vgdisplay output

for someone to understand what's happening...

Marco
 
- the linux client .conf

Code:
[B]root@server# cat /etc/pve/nodes/vs1/qemu-server/107.conf[/B]
balloon: 256
bootdisk: ide0
cores: 1
ide0: local:107/vm-107-disk-1.qcow2,format=qcow2,size=42G
ide2: local:iso/debian-7.1.0-amd64-netinst.iso,media=cdrom
memory: 4000
name: Prova
net0: e1000=5E:A9:53:A5:5A:9D,bridge=vmbr0
ostype: l26
sockets: 1

- linux client fdisk -l
Code:
[B]root@client:~# fdisk -l[/B]

Disk /dev/sda: 34.4 GB, 34359738368 bytes
255 heads, 63 sectors/track, 4177 cylinders, total 67108864 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: 0x000bf262

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758    67106815    33302529    5  Extended
/dev/sda5          501760    67106815    33302528   8e  Linux LVM

Disk /dev/mapper/Prova-root: 33.0 GB, 33025949696 bytes
255 heads, 63 sectors/track, 4015 cylinders, total 64503808 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: 0x00000000

Disk /dev/mapper/Prova-root doesn't contain a valid partition table

Disk /dev/mapper/Prova-swap_1: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 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: 0x00000000

Disk /dev/mapper/Prova-swap_1 doesn't contain a valid partition table


- vgs/vgdisplay output
Code:
[B]root@client:~# vgs Prova [/B]
  VG       #PV #LV #SN Attr   VSize  VFree
  Prova   1   2   0 wz--n- 31,76g    0 


[B]root@client:~# vgdisplay Prova [/B]
  --- Volume group ---
  VG Name               Prova
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               31,76 GiB
  PE Size               4,00 MiB
  Total PE              8130
  Alloc PE / Size       8130 / 31,76 GiB
  Free  PE / Size       0 / 0   
  VG UUID               e9GqEG-2zOq-Vr3Q-tmzq-4gqq-kJUv-Aqnceg

If I do:
Code:
[B]root@server# qemu-nbd -c /dev/nbd0 vm-107-disk-1.qcow2 [/B]
[B]root@server# cfdisk /dev/nbd0[/B]
i obtain this screenshot:
screen.png

At this point (from http://pve.proxmox.com/wiki/Resizing_disks) I should do:

Code:
[B]root@server:~# pvscan [/B]
  PV /dev/sda5   VG Prova   lvm2 [31,76 GiB / 0    free]
  Total: 1 [31,76 GiB] / in use: 1 [31,76 GiB] / in no VG: 0 [0   ]
[B]root@server:~# pvresize /dev/sda5[/B]
  Physical volume "/dev/sda5" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized
[B]root@server:~# pvscan[/B] 
  PV /dev/sda5   VG Prova   lvm2 [31,76 GiB / 0    free]
  Total: 1 [31,76 GiB] / in use: 1 [31,76 GiB] / in no VG: 0 [0   ]
[B]root@server:~# lvdisplay[/B] 
  --- Logical volume ---
  LV Path                /dev/Prova/root
  LV Name                root
  VG Name                Prova
  LV UUID                RNV3mi-2y2t-WqCd-2G1s-GxkQ-d2he-Lrf7uB
  LV Write Access        read/write
  LV Creation host, time Prova, 2014-01-09 10:57:48 +0100
  LV Status              available
  # open                 1
  LV Size                30,76 GiB
  Current LE             7874
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0
   
  --- Logical volume ---
  LV Path                /dev/Prova/swap_1
  LV Name                swap_1
  VG Name                Prova
  LV UUID                McPVUt-2xWb-r6zs-gsiF-2trN-nqJ2-yXlrEB
  LV Write Access        read/write
  LV Creation host, time Prova, 2014-01-09 10:57:49 +0100
  LV Status              available
  # open                 2
  LV Size                1,00 GiB
  Current LE             256
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:1
   
[B]root@server:~# lvresize -l +100%FREE /dev/Prova/root[/B]
  New size (7874 extents) matches existing size (7874 extents)
  Run `lvresize --help' for more information.

but i can't extend the size..
 
Your volume group prova has no more free space:
Free PE / Size 0 / 0

so this command lvresize -l +100%FREE /dev/Prova/root fail since there are no more free space to allocate.

You will need to extend the volume group to be able to extend the logical volume.
 
ide0: local:107/vm-107-disk-1.qcow2,format=qcow2,size=42G
root@client:~# fdisk -l
Disk /dev/sda: 34.4 GB, 34359738368 bytes

...after resizing vmdisk in pve, did you "stop" and "start" the vm (restart or reboot from vm does not work)? if not, the vm will never see enlarged vmdisk.

Marco
 
Last edited:
...after resizing vmdisk in pve, did you "stop" and "start" the vm (restart or reboot from vm does not work)? if not, the vm will never see enlarged vmdisk.

Marco

Tnx Marco I've finally solved.

- I stoppped and started the vm as you wrote before.
- After this I could see the "free space" using cfdisk.
- Using the "free space" I created a new lvm partition
- At this point:
Code:
[B]root@client:~# pvcreate /dev/sda6[/B]
  Device /dev/sda6 not found (or ignored by filtering).
[B]
root@client:~# partx -a /dev/sda[/B]
partx: /dev/sda: error adding partitions 1-2
partx: /dev/sda: error adding partition 5
[B]
root@client:~# cat /proc/partitions 
[/B]major minor  #blocks  name

   8        0   44040192 sda
   8        1     248832 sda1
   8        2          1 sda2
   8        5   33302528 sda5
   8        6   10486752 sda6
  11        0     227328 sr0
 254        0   32251904 dm-0
 254        1    1048576 dm-1
[B]
root@client:~# pvcreate /dev/sda6[/B]
  Writing physical volume data to disk "/dev/sda6"
  Physical volume "/dev/sda6" successfully created
[B]
root@client:~# pvs[/B]
  PV         VG       Fmt  Attr PSize  PFree 
  /dev/sda5  Prova lvm2 a--  31,76g     0 
  /dev/sda6           lvm2 a--  10,00g 10,00g
[B]
root@client:~# vgextend Prova /dev/sda6[/B]
  Volume group "Prova" successfully extended
[B]
root@client:~# pvs[/B]
  PV         VG       Fmt  Attr PSize  PFree 
  /dev/sda5  Prova lvm2 a--  31,76g     0 
  /dev/sda6  Prova lvm2 a--  10,00g 10,00g
[B]
root@client:~# vgs[/B]
  VG       #PV #LV #SN Attr   VSize  VFree 
  Prova   2   2   0 wz--n- 41,75g 10,00g

[B]root@Prova:~# lvdisplay[/B] 
  --- Logical volume ---
  LV Path                /dev/Prova/root
  LV Name                root
  VG Name                Prova
  LV UUID                RNV3mi-2y2t-WqCd-2G1s-GxkQ-d2he-Lrf7uB
  LV Write Access        read/write
  LV Creation host, time Prova, 2014-01-09 10:57:48 +0100
  LV Status              available
  # open                 1
  LV Size                30,75 GiB
  Current LE             10433
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0
   
  --- Logical volume ---
  LV Path                /dev/Prova/swap_1
  LV Name                swap_1
  VG Name                Prova
  LV UUID                McPVUt-2xWb-r6zs-gsiF-2trN-nqJ2-yXlrEB
  LV Write Access        read/write
  LV Creation host, time Prova, 2014-01-09 10:57:49 +0100
  LV Status              available
  # open                 2
  LV Size                1,00 GiB
  Current LE             256
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:1

[B]root@client:~# resize2fs /dev/Prova/root[/B]
resize2fs 1.42.5 (29-Jul-2012)
Filesystem at /dev/Prova/root is mounted on /; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 3
Performing an on-line resize of /dev/Prova/root to 10683392 (4k) blocks.
The filesystem on /dev/Prova/root is now 10683392 blocks long.

[B]root@client:~# df -alh[/B]
File system                Dim. Usati Dispon. Uso% Montato su
[U][I][B]rootfs                      41G  1,1G     38G   3% /[/B][/I][/U]
sysfs                         0     0       0    - /sys
proc                          0     0       0    - /proc
udev                        10M     0     10M   0% /dev
devpts                        0     0       0    - /dev/pts
tmpfs                      374M  208K    374M   1% /run
/dev/mapper/Prova-root   41G  1,1G     38G   3% /
tmpfs                      5,0M     0    5,0M   0% /run/lock
tmpfs                      748M     0    748M   0% /run/shm
/dev/sda1                  228M   18M    199M   9% /boot
rpc_pipefs                    0     0       0    - /var/lib/nfs/rpc_pipefs

And that's all. Tnx Marco.
 
Last edited: