My sda1 is almost full. How to clean it?

8,556

Solution 1

Install Ubuntu Tweak and use the Computer Janitor to remove unnecessary files.

sudo add-apt-repository ppa:tualatrix/next  
sudo apt-get update  
sudo apt-get install ubuntu-tweak

I took this suggestion, as well as others, from here: Is system cleanup/optimization needed.

Solution 2

Cleaning up with ubuntu-tweak as @jos suggests is certainly a good idea and you should do it! That way you can get rid of for example old kernels and their headers that accumulate over time.

What @mikewhatever points out in the comment is nevertheless true. We can't possibly tell what is clogging up the root partition. Could be installed programs or large files in your home directory like videos.

You can find out how much space the contents of a directory is taking with

find / -type d -maxdepth 1 -exec du -sh '{}' 2>/dev/null \;

The find-part will return all directories in / and execute disk-usage du on each, printing the amount of space occupied by that directory. This way you'll get an overview where the largest files reside. Replace / in the command by any directory you'd like to look into.

Alternatively you could also list all files and their size above a certain size

find / -type f -size +100M -exec du -h '{}' 2>/dev/null \;

for example will find all files on the root filesystem that are at least 100MB in size.

Depending on what you find, the actions to take range from deleting unused large files in your home directory to uninstalling large packages that are not needed anymore.

As an alternative you could always re-size the disk file in VirtualBox, boot the VM from a Live image and use e.g GParted to enlarge the root partition. Make sure to make a backup or snapshot of the VM first!

Solution 3

Ubuntu comes with the excellent Disk Usage Analyzer, try it! It will show you in nice pie slices, what files take up most of your disk space and from there you can decide what to remove.

Share:
8,556

Related videos on Youtube

sop
Author by

sop

I do not like to write anything for now

Updated on September 18, 2022

Comments

  • sop
    sop over 1 year

    I have a problem with the space:

    $ df
    Filesystem     1K-blocks      Used Available Use% Mounted on
    /dev/sda1       78310344  71438848   2870524  97% /
    none                   4         0         4   0% /sys/fs/cgroup
    udev             2571916         4   2571912   1% /dev
    tmpfs             516544       888    515656   1% /run
    none                5120         0      5120   0% /run/lock
    none             2582704       384   2582320   1% /run/shm
    none              102400        64    102336   1% /run/user
    VMSahred       487873532 235847812 252025720  49% /media/sf_VMSahred
    

    I have an Ubuntu on VirtualBox. I have read this, but there is no answer or solution...

    I have read some other similar problems on other forums, and I can also tell that :

    $ cat /etc/fstab
    # /etc/fstab: static file system information.
    #
    # Use 'blkid' to print the universally unique identifier for a
    # device; this may be used with UUID= as a more robust way to name devices
    # that works even if disks are added and removed. See fstab(5).
    #
    # <file system> <mount point>   <type>  <options>       <dump>  <pass>
    # / was on /dev/sda1 during installation
    UUID=1c7c3746-d0a6-4ec4-a9a2-d26031c5bcb9 /               ext4    errors=remount-ro 0       1
    # swap was on /dev/sda5 during installation
    UUID=aea8d7ea-ad47-4b2a-b88f-b96a1ae1e331 none            swap    sw              0       0
    
    $ sudo blkid
    /dev/sda1: UUID="1c7c3746-d0a6-4ec4-a9a2-d26031c5bcb9" TYPE="ext4" 
    /dev/sda5: UUID="aea8d7ea-ad47-4b2a-b88f-b96a1ae1e331" TYPE="swap" 
    

    I am a little afraid to do some stupid things, so I am asking here: What to do? How to remove some unused things and free some space?

    P.S.: I want to install Matlab... :D

    • mikewhatever
      mikewhatever over 8 years
      It depends on what's there, which we know nothing about. Obviously, you are welcome to remove unused things.
  • Byte Commander
    Byte Commander over 8 years
    Or bleachbit...
  • sop
    sop over 8 years
    bleachbit on deepscan crashes... :(
  • sop
    sop over 8 years
    I have removed about 1G of old kernels... hope it works after restart ... lol
  • sop
    sop over 8 years
    It worked, I have not 88% use
  • sop
    sop over 8 years
    Using your command I have gained another 2% so I got to 86% use