Skip to content

Create Space on Target

rossphilipson edited this page Oct 27, 2014 · 5 revisions

Create a little space on target

This works within the 1G that is spare on a default install.

 df -h
 lvresize -L +1G  /dev/xenclient/root 
 resize2fs -p /dev/xenclient/root
 df -h

Create a lot of space on target

This is for when you need more expansion than will fit in the spare room of the install.

If SELinux is enforcing you need to turn that off:

$ nr

$ setenforce 0

First you have to stop the monit daemon (don't ask):

$ /etc/init.d/monit stop

Stop xenmgr so nobody use storage anymore:

$ /etc/init.d/xenmgr stop

$ umount /storage

Resize storage filesystem (shrink it to 100G):

$ e2fsck -f /dev/xenclient/storage

$ resize2fs /dev/xenclient/storage 100G

Make the storage lv 101G to be on the safe side:

$ lvresize /dev/xenclient/storage -L101G

Remount storage and restart xenmgr:

$ mount /storage

$ /etc/init.d/xenmgr start

Make more space on root (10G):

$ lvresize /dev/xenclient/root -L10G

Do the online resize in the background:

$ resize2fs /dev/xenclient/root &

df will tell you live how big root is:

$ df -h

NOTE: it takes a while for the root resize. Don't start installing packages etc. until it is done.

NOTE: it should be possible to restart xenmgr but this may not always work out for you. It is better to just reboot when you are done.

Here it is as a script

 # Stop xenmgr so nobody use storage anymore:
 /etc/init.d/monit stop
 /etc/init.d/xenmgr stop
 umount /storage
 # Resize storage filesystem (shrink it to 100G):
 e2fsck -f /dev/xenclient/storage || exit 1
 resize2fs /dev/xenclient/storage 100G || exit 1
 # Make the storage lv 101G to be on the safe side:
 lvresize /dev/xenclient/storage -L101G
 # Remount storage and restart xenmgr:
 mount /storage
 /etc/init.d/xenmgr start
 # Make more space on root (10G):
 lvresize /dev/xenclient/root -L10G
 # Do the online resize in the background:
 resize2fs /dev/xenclient/root &
 # df will tell you live how big root is:
 df -h