Incrementar HD.
Verificando as partições:
root@cpro30365:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            9.8G  4.0K  9.8G   1% /dev
tmpfs           2.0G  224K  2.0G   1% /run
/dev/dm-0       197G  181G  5.5G  98% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            5.0M     0  5.0M   0% /run/lock
none            9.8G     0  9.8G   0% /run/shm
none            100M     0  100M   0% /run/user
/dev/xvda1      228M   32M  185M  15% /boot
Para verificar os Physical Volumes (pvs)
root@cpro30365:~# pvs
  PV         VG     Fmt  Attr PSize   PFree
  /dev/xvda5 ubuntu lvm2 a--    9.76g    0 
  /dev/xvdb  ubuntu lvm2 a--  190.00g    0 
Para ver o tamanho dos discos:
Disk /dev/xvdb doesn't contain a valid partition table
Disk /dev/mapper/ubuntu-root doesn't contain a valid partition table
Disk /dev/mapper/ubuntu-swap_1 doesn't contain a valid partition table
Disk /dev/xvda: 10.7 GB, 10737418240 bytes
/dev/xvda1            2048      499711      248832   83  Linux
/dev/xvda2          501758    20969471    10233857    5  Extended
/dev/xvda5          501760    20969471    10233856   8e  Linux LVM
Disk /dev/xvdb: 472.4 GB, 472446402560 bytes
Então o HD xvdb está com 190g no pvs e fisicamente está com 472.4 GB, esse HD será expandido.
root@cpro30365:~# pvresize /dev/xvdb
Verificando o resultado:
root@cpro30365:~# pvs
  PV         VG     Fmt  Attr PSize   PFree  
  /dev/xvda5 ubuntu lvm2 a--    9.76g      0 
  /dev/xvdb  ubuntu lvm2 a--  440.00g 250.00g
Agora é preciso aumentar o Logical Volume (lvs)
root@cpro30365:~# lvs
  LV     VG     Attr      LSize   Pool Origin Data%  Move Log Copy%  Convert
  root   ubuntu -wi-ao--- 199.25g                                           
  swap_1 ubuntu -wi-ao--- 512.00m          
Nessa máquina tem dois lvs vamos aumentar o lv root para 300G.
root@cpro30365:~# lvextend -L300G /dev/ubuntu/root 
  Extending logical volume root to 300.00 GiB
  Logical volume root successfully resized
root@cpro30365:~# resize2fs /dev/ubuntu/root
resize2fs 1.42.9 (4-Feb-2014)
Filesystem at /dev/ubuntu/root is mounted on /; on-line resizing required
old_desc_blocks = 13, new_desc_blocks = 19
The filesystem on /dev/ubuntu/root is now 78643200 blocks long.
Verificando os lvs e pvs e partições:
root@cpro30365:~# lvs
  LV     VG     Attr      LSize   Pool Origin Data%  Move Log Copy%  Convert
  root   ubuntu -wi-ao--- 300.00g                                           
  swap_1 ubuntu -wi-ao--- 512.00m                                           

root@cpro30365:~# pvs
  PV         VG     Fmt  Attr PSize   PFree  
  /dev/xvda5 ubuntu lvm2 a--    9.76g      0 
  /dev/xvdb  ubuntu lvm2 a--  440.00g 149.25g

root@cpro30365:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            9.8G  4.0K  9.8G   1% /dev
tmpfs           2.0G  224K  2.0G   1% /run
/dev/dm-0       296G  181G  101G  65% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            5.0M     0  5.0M   0% /run/lock
none            9.8G     0  9.8G   0% /run/shm
none            100M     0  100M   0% /run/user
/dev/xvda1      228M   32M  185M  15% /boot
Resultado:
  • O PV /dev/xvdb estava com 190g e foi aumentado para 440g disponível 250g
  • A partição /dev/dm-0 estava com 197G e foi aumentada para 296G
  • O pv /dev/xvdb ficou com 149.25g , o espaço pode ser utilizado para aumentar os LVs.
IP
35.172.217.174