Adding More Space for My Servers Root Partition

GParted

Today, when I checked my servers disk space, I found that the root (/) partition is almost full. So I have to clean some unused files or add more space.

First step, I cleaned the /var/spool/mail/root because its size was very large. The command is

#cat /dev/null > /var/spool/mail/root

Second, I added more disk space by shrinking /home directory which is not highly occupied.

  • I downloaded the GNU Partition Editor (gparted), burned the iso file into CD, and then booted it in the server. Select the GUI mode.
  • Click the Gparted icon in the Desktop
  • select /home partition
  • insert the new lower size and click apply
  • there will be an unallocated space, click this and add new partition button, select ext3 filesystem and then click apply
  • close gparted interface, click exit icon, choose reboot, and press OK
  • remove the CD from the server

After that, I boot the Linux OS from disk, and then mount the newly created partition to /var directory, becase I think it will need a large disk space.

ssh root@myserver
mkdir /xvar
mount -t ext3 /dev/sda6 /xvar
rsync -av /var /xvar
umount /xvar
mount -t ext3 /dev/sda6 /var
rm -r /xvar

To make this permanent, add this line to /etc/fstab

/dev/sda6 /var ext3 defaults 1 2

Now, have more disk space in my servers root partition🙂

2 responses to “Adding More Space for My Servers Root Partition

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: