See how much space is available on physical disk:
[root@centos ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 volg0 lvm2 a-- 199.00g 21.00g
See what sizes your logical volumes are:
[root@centos ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home volg0 -wi-ao---- 16.00g
opt volg0 -wi-ao---- 32.00g
root volg0 -wi-ao---- 32.00g
swap volg0 -wi-ao---- 66.00g
var volg0 -wi-ao---- 32.00g
See what size your filesystems are:
[root@centos ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/volg0-root 32G 1.2G 29G 4% /
devtmpfs 32G 0 32G 0% /dev
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 32G 9.0M 32G 1% /run
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/sda1 976M 129M 796M 14% /boot
/dev/mapper/volg0-home 16G 45M 15G 1% /home
/dev/mapper/volg0-var 32G 172M 30G 1% /var
/dev/mapper/volg0-opt 32G 49M 30G 1% /opt
tmpfs 6.3G 0 6.3G 0% /run/user/0
Resize your logical volume - in this case /var adding 10G to current 32G = 42G:
[root@centos ~]# lvresize -L 42G /dev/mapper/volg0-var
Size of logical volume volg0/var changed from 32.00 GiB (8192 extents) to 42.00 GiB (10752 extents).
Logical volume var successfully resized.
Underlining volume is expanded, but not filesystem on top:
[root@centos ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/volg0-root 32G 1.2G 29G 4% /
devtmpfs 32G 0 32G 0% /dev
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 32G 9.0M 32G 1% /run
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/sda1 976M 129M 796M 14% /boot
/dev/mapper/volg0-home 16G 45M 15G 1% /home
/dev/mapper/volg0-var 32G 172M 30G 1% /var
/dev/mapper/volg0-opt 32G 49M 30G 1% /opt
tmpfs 6.3G 0 6.3G 0% /run/user/0
So resize filesystem on top:
[root@centos ~]# resize2fs /dev/mapper/volg0-var
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/mapper/volg0-var is mounted on /var; on-line resizing required
old_desc_blocks = 4, new_desc_blocks = 6
The filesystem on /dev/mapper/volg0-var is now 11010048 blocks long.
See now filesystem is 42GB in size:
[root@centos ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/volg0-root 32G 1.2G 29G 4% /
devtmpfs 32G 0 32G 0% /dev
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 32G 9.0M 32G 1% /run
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/sda1 976M 129M 796M 14% /boot
/dev/mapper/volg0-home 16G 45M 15G 1% /home
/dev/mapper/volg0-var 42G 172M 40G 1% /var
/dev/mapper/volg0-opt 32G 49M 30G 1% /opt
tmpfs 6.3G 0 6.3G 0% /run/user/0
Job done:
[root@centos ~]#
No comments:
Post a Comment