How to swap or extend CentOS partition

Chris Kenward
Chris Kenward used Ask the Experts™
on
Hi Folks

I have created a 500Gb server which I'm intending to use as a mail server. I have suddenly realised that the unit has defaulted to a 50Gb "/" partition or volume and a 480Gb "/home" partition or volume (sorry not sure on the terminology).

I began rsyncing the data from my original mail server (Zimbra) and after a couple of Gb had been transferred I realised that it was all being copied to the "/" partition which at 50Gb is WAY too small.

Is there a way to tell the server to reverse the partitions or actually delete the "/home" volume and only have the one volume, i.e. the "/' volume?

Or is the only way around this issue to destroy the whole thing and rebuild from scratch?

Many thanks in anticipation of some help with this.
Chris
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Scott SilvaNetwork Administrator

Commented:
You should be able to find a partition resizing utility on CD and boot from it... Then you can shrink the /home partition, move it to the end of the drive, and enlarge the root...

Commented:
copy /home/* to a new temporary directory

unmount /home

mount /opt on the same partition that was formerly /home

rename temp directory to /home

Finally modify /etc/fstab so that /opt mounts to the 480Gb partition.

You can now rebuild your zimbra server.
Scott SilvaNetwork Administrator

Commented:
IF you can unmount /home on a running system... Sometimes you can't...
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

Chris KenwardDirector

Author

Commented:
Hi Scott and Sanga

Thanks for your quick response - wow - that was fast. Couple of things:

Although I'm pretty much OK at a lot of the admin tasks I need to do on the server(s) I run, there are limits to my ability.
The server is a VPS running on VMware Esxi and I do everything via ssh using terminal on a Mac so running a CD utility is a problem for me I think.
I'm not sure how to unmount a drive and don't know whether this is possible while the CentOS unit is running?
Not sure where the "/opt" came from in Sanga's reply.

All the best
Chris
Chris KenwardDirector

Author

Commented:
I have access to the Gnome GUI because I haven't disabled it yet. This means I can access the Disk Utility. I tried unmounting the "/" but it said cannot because it's busy. I tried and succeeded in unmounting the "/home" partition....

Does this help?

All the best
Chris

Commented:
Provided /home is on a different partition, you can ssh login as root and unmount it to perform maintenance tasks. The way I accomplish this is by using an X11 capable ssh client.

On the centos Server, enable sshd X11 forwarding. This will allow you to open graphical utilities like gparted that will make life a lot simpler.

yum install gparted
yum install xauth  dejavu-lgc-sans-fonts

enable X11 forwarding in the /etc/ssh/sshd_config file:

# grep X11 /etc/ssh/sshd_config
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes

Finally in an ssh client such as MobaXterm

ssh -X -Y root@ipaddress

once logged in, you can run gparted from the command line and the gui will open giving you access to drive and partition management tools like unmount and resize.

You can attempt to resize the home partition, but i do not think you will be able to resize the root partition.

/opt partition:
Since this is a zimbra server and the default install directory is /opt/zimbra I always make /opt a mount point on a seperate partition or drive. This way if the zimbra mail store outgrows the partition, your entire server does not come to a halt due to no space on root.
The best setup i have found for /opt is a logical volume. Reason being when full you can just add another partition or drive to your virtual machine and then combine that new space with the existing logical volume allowing you to grow your server.
This can all be done while the server is live and users would never know.






gparted
Commented:
Oh if you have access to gnome you can do the following:

- make directory /hometemp
- copy everything in /home/* to /hometemp/
- using the gui, unmount /home
- mv /hometemp to /home
- edit /etc/fstab and change the mount point that references /home to /opt

reboot the server.

Now /home will be on the root partion, and /opt will be the 480gb partition
Chris KenwardDirector

Author

Commented:
Hi Sanga

Sadly this didn't work for me - perhaps I typed something wrong... I ended up with the /opt partition but the zimbra folder is gone. No matter - I'll rebuild the server from scratch. It's probably what I should have done in the first place.

Thanks both for your suggestions. Much appreciate the time you've spent on this for me.

Cheers
Chris
Commented:
Hi Chris,

Did you move the zimbra folder before starting this process?

If so then it was probably still there. You can retrieve it by unmounting /opt and then navigating to /opt/zimbra on the original root partition. You can then move the zimbra folder from /opt/zimbra to a temp location and then continue with the steps to move /opt back to the 480Gb drive.

Either way. A reinstall is indeed the best option if you are able to do so. A clean well planned zimbra setup from the start always helps with the stability of the server. If you have any additional questions on getting that going please do not hesitate to ask.
Chris KenwardDirector

Author

Commented:
Hi Sanga

Thanks again - although we didn't resolve it I really do appreciate your help with this.

I've blown the unit away and am now in the process of rebuilding. All the best to you.

Regards
Chris
Chris KenwardDirector

Author

Commented:
So appreciate the input from the experts!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial