1

I am running out of space in the /var partition. I have plenty of space in my /home partition. How do I shrink the /home partition to make more space for the /var partition?

I have read some blogs that say to use the GParted Live CD. As a new user, I'm not quite sure if this is the ideal route. What is the best way to create more space for /var ?

Output of df -h :

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        19G  7.1G   11G  41% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            7.9G  8.0K  7.9G   1% /dev
tmpfs           1.6G  1.5M  1.6G   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            7.9G  624K  7.9G   1% /run/shm
none            100M   60K  100M   1% /run/user
/dev/sda4       454M   75M  352M  18% /boot
/dev/sda5       2.3G  2.1G   36M  99% /var
/dev/sda3       178G  1.3G  168G   1% /home
/dev/sda6       2.8G  5.8M  2.6G   1% /tmp
/dev/sdb1       3.7T  401G  3.3T  11% /hdd
parmeh723
  • 33
  • 1
  • 1
  • 5

1 Answers1

0

I'll take a shot at an answer for this, and assume that if I'm drastically wrong you have a good backup! I'm not entirely sure this will work, but it seems reasonable.

1st: Most of what you are going to need to do, you can't do from a running linux on your hard disk: Linux makes a lot of use of the /var directory structure, so the first thing to do is to make a live USB or CD so that you can manipulate your HD from 'outside'

2nd: Read up on the 'mount' command, and 'umount'. You'll need them.

3rd: Read up on a suitable copy that hopefully retains permissions and subdirectories. I think you're going to want cp -a

procedure, in basic terms:

a) Boot from the live CD/USB. Choose the 'Try Ubuntu option. Open a terminal and get gedit sudo apt-get install gedit

b) mount /dev/sda2 as a suitably named directory, such as /mydrive mount /dev/sda2 /mydrive

c) mount your too-small /var, /dev/sda5 as another directory, /oldvar mount /dev/sda5 /oldvar

d) copy the /oldvar to a new /var structure cp -a /oldvar /mydrive/var

e) edit your fstab so that the old /var does not get mounted. gedit /mydrive/etc/fstab

Look for the line of code in that file which mounts the /var filesystem, and put a '#' at the start of that line so that it is commented out

f) reboot and cross your fingers.

Note that we have not deleted the partition at /dev/sda5, and that we only commented out the fstab entry corresponding to your /var directory. If this fails, you should be able to boot again from the live USB, edit the fstab file again to remove the comment, and be back in business.

Charles Green
  • 21,859