How to swap or extend CentOS partition

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 KenwardDirectorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott SilvaNetwork AdministratorCommented:
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...
Sanga CollinsSystems AdminCommented:
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 AdministratorCommented:
IF you can unmount /home on a running system... Sometimes you can't...
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

Chris KenwardDirectorAuthor 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 KenwardDirectorAuthor 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
Sanga CollinsSystems AdminCommented:
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.

Sanga CollinsSystems AdminCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Chris KenwardDirectorAuthor 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.

Sanga CollinsSystems AdminCommented:
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 KenwardDirectorAuthor 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.

Chris KenwardDirectorAuthor Commented:
So appreciate the input from the experts!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Distributions

From novice to tech pro — start learning today.