Hi,
One of our servers has a too small root partition on LVM and needs to be resized. Can / be safely increased online, without a reboot?
[root@zaxen02 ~]# lvscan ACTIVE '/dev/LVM01/root' [4.00 GB] inherit ACTIVE '/dev/LVM01/home' [20.00 GB] inherit ACTIVE '/dev/LVM01/var' [4.00 GB] inherit ACTIVE '/dev/LVM01/swap' [4.00 GB] inherit ACTIVE '/dev/LVM01/log' [1.00 GB] inherit ACTIVE '/dev/LVM01/webmin' [2.00 GB] inherit ACTIVE '/dev/LVM01/xenstored' [2.00 GB] inherit ACTIVE '/dev/LVM01/xensave' [2.00 GB] inherit ACTIVE '/dev/LVM01/opennation-net_img' [10.00 GB] inherit ACTIVE '/dev/LVM01/opennation-net_swap' [1.00 GB] inherit ACTIVE '/dev/LVM01/pluto_img' [100.00 GB] inherit ACTIVE '/dev/LVM01/pluto_swap' [1.00 GB] inherit ACTIVE '/dev/LVM01/tmp' [5.00 GB] inherit [root@zaxen02 ~]# pvscan PV /dev/md1 VG LVM01 lvm2 [232.69 GB / 76.69 GB free] Total: 1 [232.69 GB] / in use: 1 [232.69 GB] / in no VG: 0 [0 ] [root@zaxen02 ~]#
On 10-07-11 02:27 PM, Rudi Ahlers wrote:
Hi,
One of our servers has a too small root partition on LVM and needs to be resized. Can / be safely increased online, without a reboot?
[root@zaxen02 ~]# lvscan ACTIVE '/dev/LVM01/root' [4.00 GB] inherit ACTIVE '/dev/LVM01/home' [20.00 GB] inherit ACTIVE '/dev/LVM01/var' [4.00 GB] inherit ACTIVE '/dev/LVM01/swap' [4.00 GB] inherit ACTIVE '/dev/LVM01/log' [1.00 GB] inherit ACTIVE '/dev/LVM01/webmin' [2.00 GB] inherit ACTIVE '/dev/LVM01/xenstored' [2.00 GB] inherit ACTIVE '/dev/LVM01/xensave' [2.00 GB] inherit ACTIVE '/dev/LVM01/opennation-net_img' [10.00 GB] inherit ACTIVE '/dev/LVM01/opennation-net_swap' [1.00 GB] inherit ACTIVE '/dev/LVM01/pluto_img' [100.00 GB] inherit ACTIVE '/dev/LVM01/pluto_swap' [1.00 GB] inherit ACTIVE '/dev/LVM01/tmp' [5.00 GB] inherit [root@zaxen02 ~]# pvscan PV /dev/md1 VG LVM01 lvm2 [232.69 GB / 76.69 GB free] Total: 1 [232.69 GB] / in use: 1 [232.69 GB] / in no VG: 0 [0 ] [root@zaxen02 ~]#
It depends mainly on the filesystem you are using. The ext[3|4] filesystems are fine. You'll have to extend the LV, and then separately extend the filesystem itself.
Please test this on a non-production server before trying it on your live server, just to be safe and to be sure that you've got your syntax right.
On Sun, Jul 11, 2010 at 8:39 PM, Digimer linux@alteeve.com wrote:
On 10-07-11 02:27 PM, Rudi Ahlers wrote:
Hi,
One of our servers has a too small root partition on LVM and needs to be resized. Can / be safely increased online, without a reboot?
[root@zaxen02 ~]# lvscan ACTIVE '/dev/LVM01/root' [4.00 GB] inherit ACTIVE '/dev/LVM01/home' [20.00 GB] inherit ACTIVE '/dev/LVM01/var' [4.00 GB] inherit ACTIVE '/dev/LVM01/swap' [4.00 GB] inherit ACTIVE '/dev/LVM01/log' [1.00 GB] inherit ACTIVE '/dev/LVM01/webmin' [2.00 GB] inherit ACTIVE '/dev/LVM01/xenstored' [2.00 GB] inherit ACTIVE '/dev/LVM01/xensave' [2.00 GB] inherit ACTIVE '/dev/LVM01/opennation-net_img' [10.00 GB] inherit ACTIVE '/dev/LVM01/opennation-net_swap' [1.00 GB] inherit ACTIVE '/dev/LVM01/pluto_img' [100.00 GB] inherit ACTIVE '/dev/LVM01/pluto_swap' [1.00 GB] inherit ACTIVE '/dev/LVM01/tmp' [5.00 GB] inherit [root@zaxen02 ~]# pvscan PV /dev/md1 VG LVM01 lvm2 [232.69 GB / 76.69 GB free] Total: 1 [232.69 GB] / in use: 1 [232.69 GB] / in no VG: 0 [0 ] [root@zaxen02 ~]#
It depends mainly on the filesystem you are using. The ext[3|4] filesystems are fine. You'll have to extend the LV, and then separately extend the filesystem itself.
Please test this on a non-production server before trying it on your live server, just to be safe and to be sure that you've got your syntax right.
-- Digimer E-Mail: linux@alteeve.com AN!Whitepapers: http://alteeve.com Node Assassin: http://nodeassassin.org _______________________________________________
The server runs on CentOS 5.5 with ext3 (don't trust ext4 yet). I don't have a test server setup for this, but it's a good idea to setup one with a similar partition layout and try it there first :)
I just wanted to know whether it's safe for root to be resized without a reboot or not.
On 12 July 2010 11:12, Rudi Ahlers Rudi@softdux.com wrote:
One of our servers has a too small root partition on LVM and needs to be resized. Can / be safely increased online, without a reboot?
Yes. If you use system-config-lvm and using ext3, it will let you do it all within a nice GUI as well.
On Mon, Jul 12, 2010 at 12:17 PM, Hakan Koseoglu hakan@koseoglu.org wrote:
On 12 July 2010 11:12, Rudi Ahlers Rudi@softdux.com wrote:
One of our servers has a too small root partition on LVM and needs to be resized. Can / be safely increased online, without a reboot?
Yes. If you use system-config-lvm and using ext3, it will let you do it all within a nice GUI as well. -- Hakan (m1fcj) - http://www.hititgunesi.org _______________________________________________
It's a console-only server, i.e. no X installed. So I'll have to setup a test server to see if I can do it without breaking abything
On Mon, Jul 12, 2010 at 2:15 PM, Max Hetrick maxhetrick@verizon.net wrote:
Rudi Ahlers wrote:
It's a console-only server, i.e. no X installed. So I'll have to setup a test server to see if I can do it without breaking abything
There should be no issues doing it live.
# lvextend -L+1G /dev/myvg/myvol # resize2fs /dev/myvg/myvol
Regards, Max _______________________________________________
Thanx Max, it seems like the upgrade has gone through well:
[root@zaxen02 ~]# lvscan ACTIVE '/dev/LVM01/root' [4.00 GB] inherit ACTIVE '/dev/LVM01/home' [20.00 GB] inherit ACTIVE '/dev/LVM01/var' [4.00 GB] inherit ACTIVE '/dev/LVM01/swap' [4.00 GB] inherit ACTIVE '/dev/LVM01/log' [1.00 GB] inherit ACTIVE '/dev/LVM01/webmin' [2.00 GB] inherit ACTIVE '/dev/LVM01/xenstored' [2.00 GB] inherit ACTIVE '/dev/LVM01/xensave' [2.00 GB] inherit ACTIVE '/dev/LVM01/opennation-net_img' [10.00 GB] inherit ACTIVE '/dev/LVM01/opennation-net_swap' [1.00 GB] inherit ACTIVE '/dev/LVM01/pluto_img' [100.00 GB] inherit ACTIVE '/dev/LVM01/pluto_swap' [1.00 GB] inherit ACTIVE '/dev/LVM01/tmp' [5.00 GB] inherit [root@zaxen02 ~]# lvextend -L+5G /dev/LVM01/root Extending logical volume root to 9.00 GB Logical volume root successfully resized [root@zaxen02 ~]# resize2fs /dev/LVM01/root resize2fs 1.39 (29-May-2006) Filesystem at /dev/LVM01/root is mounted on /; on-line resizing required Performing an on-line resize of /dev/LVM01/root to 2359296 (4k) blocks. The filesystem on /dev/LVM01/root is now 2359296 blocks long.
[root@zaxen02 ~]# lvscan ACTIVE '/dev/LVM01/root' [9.00 GB] inherit ACTIVE '/dev/LVM01/home' [20.00 GB] inherit ACTIVE '/dev/LVM01/var' [4.00 GB] inherit ACTIVE '/dev/LVM01/swap' [4.00 GB] inherit ACTIVE '/dev/LVM01/log' [1.00 GB] inherit ACTIVE '/dev/LVM01/webmin' [2.00 GB] inherit ACTIVE '/dev/LVM01/xenstored' [2.00 GB] inherit ACTIVE '/dev/LVM01/xensave' [2.00 GB] inherit ACTIVE '/dev/LVM01/opennation-net_img' [10.00 GB] inherit ACTIVE '/dev/LVM01/opennation-net_swap' [1.00 GB] inherit ACTIVE '/dev/LVM01/pluto_img' [100.00 GB] inherit ACTIVE '/dev/LVM01/pluto_swap' [1.00 GB] inherit ACTIVE '/dev/LVM01/tmp' [5.00 GB] inherit [root@zaxen02 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/LVM01-root 8.8G 3.0G 5.4G 36% / /dev/mapper/LVM01-home 20G 6.7G 12G 37% /home /dev/md0 190M 79M 102M 44% /boot /dev/mapper/LVM01-var 3.9G 1.1G 2.7G 29% /var tmpfs 3.8G 0 3.8G 0% /dev/shm /dev/mapper/LVM01-log 1008M 84M 873M 9% /var/log none 3.8G 160K 3.8G 1% /var/lib/xenstored /dev/mapper/LVM01-tmp 5.0G 2.2G 2.6G 46% /tmp
On Mon, Jul 12, 2010 at 01:56:57PM -0700, Gordon Messmer wrote:
On 07/12/2010 05:15 AM, Max Hetrick wrote:
There should be no issues doing it live.
# lvextend -L+1G /dev/myvg/myvol # resize2fs /dev/myvg/myvol
Though I'm late to the party, I'd like to note that "fsadm" can be used as well:
fsadm -e -y resize /dev/myvg/myvol 4G
If I'm reading the man page correctly, -e will umount the filesystem before resizing, which is not what the OP wants. (It might work by leaving out -e.)
--keith
On 07/12/2010 02:07 PM, Keith Keller wrote:
If I'm reading the man page correctly, -e will umount the filesystem before resizing, which is not what the OP wants. (It might work by leaving out -e.)
Yeah, my bad. Don't use -e. ;)
You can't umount /. I'm not sure if fsadm would go ahead since unmount isn't required (you only need to unmount an extX filesystem to shrink it), or if the tool would exit and tell the user not to use -e.