Ask Your Question
0

How to increase lvm size ( partitions already messed up )

asked 2014-04-13 09:54:27 -0600

oglop gravatar image

updated 2014-09-12 19:08:28 -0600

mether gravatar image

hi all i have two partitions one is used for f20 , and another is ntfs. i didn't know that gparted should not be used any more, and system-config-lvm has retired and not in repo anymore, so i boot up with live usb, and use gparted to resize ntfs partition and add free space to my fedora partition ( absurdly slow .. is this the correct way of doing it ? ). but the free space is not showing, so i ran the following command in live usb

lvextend -l 100%FREE /dev/mapper/fedora-root

after rebooting, the free space shown in df ~ or gparted is 100% , did i mess it up ? current gparted chart: image description

[root@localhost liveuser]# pvs
  PV         VG     Fmt  Attr PSize   PFree
  /dev/sda2  fedora lvm2 a--  195.11g    0 
[root@localhost liveuser]# vgs
  VG     #PV #LV #SN Attr   VSize   VFree
  fedora   1   2   0 wz--n- 195.11g    0 
[root@localhost liveuser]# lvs
  LV   VG     Attr       LSize   Pool Origin Data%  Move Log Cpy%Sync Convert
  root fedora -wi-a----- 191.11g                                             
  swap fedora -wi-ao----   4.00g 

[root@localhost liveuser]# df -h
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/live-rw  3.9G  3.1G  753M  81% /
devtmpfs             1.9G     0  1.9G   0% /dev
tmpfs                2.0G   84K  2.0G   1% /dev/shm
tmpfs                2.0G  992K  2.0G   1% /run
tmpfs                2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sdb1            3.8G  1.5G  2.4G  39% /run/initramfs/live
tmpfs                2.0G   16K  2.0G   1% /tmp
varcacheyum          2.0G     0  2.0G   0% /var/cache/yum
vartmp               2.0G     0  2.0G   0% /var/tmp


[root@localhost liveuser]# vgdisplay 
  --- Volume group ---
  VG Name               fedora
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  6
  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               195.11 GiB
  PE Size               4.00 MiB
  Total PE              49949
  Alloc PE / Size       49949 / 195.11 GiB
  Free  PE / Size       0 / 0   
  VG UUID               GDeYpW-7cmv-40j9-GnDZ-SpAG-K3yQ-vjcC7X

[root@localhost liveuser]# pvdisplay 
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               fedora
  PV Size               195.11 GiB / not usable 1.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              49949
  Free PE               0
  Allocated PE          49949
  PV UUID               eSMc5f-35PH-UGTV-v0zM-32W4-ZR2u-Zp0cfo

[root@localhost liveuser]# lvdisplay 
  --- Logical volume ---
  LV Path                /dev/fedora/swap
  LV Name                swap
  VG Name                fedora
  LV UUID                nwrMog-WQhJ-UlJm-psg3-VQ6C-xHzj-kFTc0d
  LV Write Access        read/write
  LV Creation host, time localhost, 2013-07-14 01:27:54 -0400
  LV Status              available
  # open                 2
  LV Size                4.00 GiB
  Current LE             1024
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:3

  --- Logical volume ---
  LV Path                /dev/fedora/root
  LV Name                root
  VG Name                fedora
  LV UUID                jsJ8VY-NEMc-SKt3-yeNz-hcDo-aZDt-RR7Otz
  LV Write Access        read/write
  LV Creation host, time localhost, 2013-07-14 01:28:13 -0400
  LV Status              available
  # open                 1
  LV Size                191.11 GiB
  Current LE             48925
  Segments               1
  Allocation             inherit
  Read ahead ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-04-13 15:21:46 -0600

Rabin gravatar image

In the above command you used, you allocated all the free PE to the root LVM, if you look on the output of lvs you'll see that the size of root lvm is ~190G, but if run df, you'll see that the actual size of the filesystem is smaller.

what you need to do, after extending the lvm is to resize the filesystem on it with, resize2fs, e.g:

resize2fs /dev/fedora/root
edit flag offensive delete link more

Comments

do you mean run this in live usb?

[root@localhost liveuser]# resize2fs /dev/fedora/root
resize2fs 1.42.8 (20-Jun-2013)
The filesystem is already 50099200 blocks long.  Nothing to do!

still free pe is 0, but after reboot into "real installed" fedora, the size shown in df is correct. at least the size shown in file manager is correct, but the gparted gui still shows free space 0.

one more question, are my steps correct when i want to move freespace from the ntfs partition to my / ? the gparted step is painfully slow ( 8hrs+) , what is the recommended way of doing it ?

oglop gravatar imageoglop ( 2014-04-13 19:32:52 -0600 )edit

Hi @Rabin i've come to this situation again, but this time i want to do it correctly, i know gparted is not the correct tool to resize lvm partitions now, but what is the correct procedures then ? in Fedora 20

oglop gravatar imageoglop ( 2014-05-14 22:15:15 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2014-04-13 09:54:27 -0600

Seen: 6,745 times

Last updated: Apr 13 '14