Have such partitions/volumes/mountpoints:

=$ LC_ALL=C df -hP | column -t
Filesystem              Size  Used  Avail  Use%  Mounted  on
/dev/mapper/vg0-rootlv  19G   854M  17G    5%    /
/dev/mapper/vg0-homelv  19G   343M  18G    2%    /home
/dev/mapper/vg0-optlv   19G   192M  18G    2%    /opt
/dev/mapper/vg0-varlv   19G   357M  18G    2%    /var

Question is: how can I grow /home and /var partitions (to 100GB and 400GB respectively)?

Is it safe to do it online with database running on this server?

link|improve this question

74% accept rate
You can do this online but you need to have free space in the VG or the ability to add a physical volume and grow it. use vgdisplay to check if you have free space available. – egorgry Apr 22 '11 at 15:07
I have the free space. – depesz Apr 22 '11 at 16:44
feedback

1 Answer

up vote 3 down vote accepted

First check if you have free space in volume group:

vgs

then resize the volumes:

lvresize -L 400G /dev/mapper/vg0-varlv
lvresize -L 100G /dev/mapper/vg0-homelv

and resize the filesystems residing on them:

resize2fs /dev/mapper/vg0-varlv
resize2fs /dev/mapper/vg0-homelv

I have to note though that resizing a partition from 20GB to 400GB will make your inodes quite sparse. If it is at all possible I strongly recommend creating new volumes with new filesystems and moving data there. You can copy the files during normal operation and then just rsync the changed files to new partition during downtime.

link|improve this answer
Can you elaborate on "inodes quite sparse"? What does it mean, what are the drawbacks? – depesz Apr 22 '11 at 18:29
ext file systems have the available number of inodes set at file system creation time, resizing the FS will make the inodes more sparse. So, unless the FS was created with -O resize_inode you may run into a situation in which you have free space on disk but no inodes to address it. If you know that most files will be big it's not a problem, but if the files will be small you may have problems down the line. – Hubert Kario Apr 22 '11 at 19:19
Thanks a lot, it's clear now. – depesz Apr 22 '11 at 19:54
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.