Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Free up disk space
New on LowEndTalk? Please Register and read our Community Rules.

Free up disk space

markmark Member
edited October 2013 in Help

I'm using Ubuntu 12.04 server on a KVM with (allegedly) 1GB disk space. The system is only used as a PPTP and L2TP VPN and Squid proxy server, and is working fine for now but the disk is full and I was wondering what I could do to free up some space.

[email protected]:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/vda1 880M 880M 0 100% /

Edit: to add types of VPN server in use.


  • delete squid logs, make squid stop loggint to at least store.log in the future.

    Thanked by 1mark
  • I rarely use Squid, but need it there for when I'm out of the country. Squid logs are taking up no space at all.

    [email protected]:/var/log/squid3# ls -lh total 8.0K -rw-r----- 1 proxy proxy 0 Oct 22 08:53 access.log -rw-r----- 1 proxy proxy 400 Oct 21 05:14 access.log.1 -rw-r----- 1 proxy proxy 0 Oct 22 08:53 cache.log -rw-r----- 1 proxy proxy 0 Oct 20 19:55 cache.log.1 -rw-r----- 1 proxy proxy 20 Aug 17 01:47 cache.log.2.gz

  • Remove cached .deb files

    cd /var/cache/apt/archives
    du -ch
    rm –f *.deb

    Remove log files

    cd /var/log/

    Remove list of packages:

    rm -rf /var/lib/apt/lists/*
    (apt-get update will recreate it back)

    Thanked by 1mark
  • find / -type f -size +20M

  • Okay, so far then:

    [email protected]:/var/cache/apt/archives# du -ch 4.0K ./partial 16K . 16K total

    Nothing there unfortunately.

    Removing logs has freed 2.7M, removing package lists has freed 96M, thanks @Spirit.

    [email protected]:/var/lib/apt/lists# df -h Filesystem Size Used Avail Use% Mounted on /dev/vda1 880M 781M 56M 94% /

    Not sure about the maths there, but hey, it's an improvement.

    [email protected]:~# find / -type f -size +20M /sys/devices/pci0000:00/0000:00:02.0/resource0 /sys/devices/pci0000:00/0000:00:02.0/resource0_wc /var/cache/apt/pkgcache.bin.8h7RzK /var/cache/apt/pkgcache.bin.AI6H0L /var/cache/apt/pkgcache.bin.OlXlpm /var/cache/apt/pkgcache.bin.JoqYFC /var/cache/apt/pkgcache.bin.rcNFBE /var/cache/apt/pkgcache.bin /var/cache/apt/srcpkgcache.bin /var/cache/apt/pkgcache.bin.ACOu44 /var/cache/apt/pkgcache.bin.Bcm0kd /var/cache/apt/pkgcache.bin.jdlirS /var/cache/apt-xapian-index/index.1/termlist.DB /var/cache/apt-xapian-index/index.1/postlist.DB /proc/kcore find: ‘/proc/12467/task/12467/fd/5’: No such file or directory find: ‘/proc/12467/task/12467/fdinfo/5’: No such file or directory find: ‘/proc/12467/fd/5’: No such file or directory find: ‘/proc/12467/fdinfo/5’: No such file or directory

  • IshaqIshaq Member
    edited October 2013

    To delete downloaded packages (.deb) already installed (and no longer needed):

    sudo apt-get clean

    To remove all stored archives in your cache for packages that can not be downloaded anymore (thus packages that are no longer in the repository or that have a newer version in the repository):

    sudo apt-get autoclean

    To remove unnecessary packages (After uninstalling an app there could be packages you don't need anymore):

    sudo apt-get autoremove

    Thanked by 1mark
  • @Ishaq - I got some results from apt-get clean

    Big improvement so far, thanks all!

    [email protected]:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/vda1 880M 736M 101M 88% /

  • dannixdannix Member
    edited October 2013

    You could try review the packages which are installed and remove the ones which you don't need.

    You could also run du -a | sort -n and check which folders are eating up the most space.

    Eventually with the requirements you have you could also replace Ubuntu with Debian.

  • Try ls -l on your root directory and find out which directory is hogging the most space. The go into that directory and do the same until you find some stuff you don't need and delete it, that's how I'd go about doing it.

Sign In or Register to comment.