Resizing Partitions on Live RHEL/cPanel Server
Posted
by
Timothy R. Butler
on Server Fault
See other posts from Server Fault
or by Timothy R. Butler
Published on 2014-06-01T22:39:17Z
Indexed on
2014/06/02
3:31 UTC
Read the original article
Hit count: 359
I've resized many partitions over the years on Linux, Windows and Mac OS X -- but always using a GUI. However, the time has come where the preset partition sizes my data center placed on my server aren't the right sizes and I need to resize a production server's disks. I could fiddle with it and probably do OK, but given that it is a production server, I wanted to get some advice about the right way to do this. I do have KVM over IP access, so if it is best to take the server offline and boot off a rescue partition, I can do that.
root [/var/lib/mysql]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 9.9G 2.1G 7.3G 23% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
/dev/sda1 99M 77M 18M 82% /boot
/dev/sda8 884G 463G 376G 56% /home
/dev/sda3 9.9G 8.0G 1.5G 85% /usr
/dev/sda5 9.9G 9.1G 308M 97% /var
/usr/tmpDSK 2.0G 38M 1.8G 3% /tmp
As you can see /var and /usr are quite close to being full and I've actually had to symlink some logs on /usr to directories in /home to balance things out. What I would like to do is to add 6-10 GB each to /usr and /var, presumably taking the space from /home.
As I think about how the disk is arranged, the best thought I've come up with is to reduce /home by 16 GB, say, and move /var to the spot freed up, then allocating /var's space to /usr. However, that would put /var at the far end of the disk, which seems less than idea, given that MySQL has all of its data on that partition. I'd love to take the space out of the closer end of /usr, but I assume that would take a very arduous (and perhaps risky) process of moving all of the data in /usr around. I seem to recall having such a process fail for me on a computer in the past.
The other option might be to merge / and /usr since / is underutilized, though I'm not sure if that's a good idea.
Do you have any suggestions both on the best reallocation plan and the commands to use to accomplish it?
UPDATE: I should add -- here's the partition table. There's one unused partition, which, if memory serves, was the original tmp location before I created a tmp image:
Name Flags Part Type FS Type [Label] Size (MB)
------------------------------------------------------------------------------
Unusable 1.05*
sda1 Boot Primary Linux ext2 106.96*
sda2 Primary Linux ext3 10737.42*
sda3 Primary Linux ext3 10737.42*
sda5 NC Logical Linux ext3 10738.47*
sda6 NC Logical Linux swap / Solaris 2148.54*
sda7 NC Logical Linux ext3 1074.80*
sda8 NC Logical Linux ext3 964098.53*
© Server Fault or respective owner