disk space used up

I have upgraded to 13.04 and lose disk space, ... I have a 3 TB hard disk, and had yesterday still 890 GB free, ... today all is gone!

Disk Usage Analyzer does not give me a clue and says that it could not read all directories due to missing permission. How can I start it as root, believing that this would give me all permissions.

Log files don't show me also anything useful for that matter.


To run a graphical application as root, you would use the commands gksu or gksudo. However, these have been removed from Ubuntu 13.04 for various reasons.

So, in order to run Disk Usage Analyzer as root, here are two methods:

Method 1

  1. Open a terminal, Ctrl+Alt+T. Type sudo apt-get install gksu, this will install gksu and gksudo.
  2. To run Disk Usage Analyzer as root, do the following command:

    gksudo baobab

Method 2

  1. Open a terminal, Ctrl+Alt+T. Type sudo -i. This will log you in as root in the terminal.
  2. Run Disk Usage Analyzer by typing:

    baobab

In both cases, don't close the terminal until you are done, because closing the terminal will also close Disk Usage Analyzer.

Further to your problem, you can use the command df -h to show you the sizes of your partitions and see how much space is available.


baobab Disk Usage Analyzer GUI, and ncdu GUI-like command-line tool

Tested on Ubuntu 18.04 and 20.04.

Running the Disk Usage Analyzer as root can be done from the terminal simply with this:

sudo baobab

Additionally, you can use a command-line tool which works very well, called ncdu. It's very intuitive and easy to use. Once it's running, use the arrow keys to navigate around your file system and drill down into folders of interest which show large disk usage. This is a command-line tool, but GUI-like in its nature. Run it with:

sudo ncdu

sudo may not even be required for it. For a help menu while in ncdu, press Shift + ?.

Note that I believe ncdu stands for "ncurses Disk Usage", where ncurses is the library or tool that makes an interactive, graphics-like interface possible in the terminal.

ncdu is a truly wonderful, fast, and very easy-to-use tool. I love it can easily be used over ssh sessions too. It is my "go-to" tool whenever I need to quickly analyze disk space usage, whether on my local machine or remoted into another machine.

The baobab Disk Usage Analyzer GUI tool is my secondary tool. I use it only rarely when I need to see more insight all at once, rather than drilling down manually into large folders with ncdu.

Other, related tools

  1. To quickly see your disk and partition usage, run:
    df -h
    
    Look especially for the row where the far right column, which is the "Mounted on" column, has just a / in it. This is your root directory. You'll be able to quickly see how much disk space overall is used and available in your root dir. To quickly focus on and highlight just this line, run:
    df -h | grep -B 1000 -A 1000 '.*/$'
    
  2. To quickly see individual file and folder usage for just the one folder you are in now, run:
    du -h
    
    To see just the last line, which is the sum-total of everything in your current folder, run:
    du -sh
    
    The -s says to 's'ummarize, which means to just output the last line. That output is exactly identical to what you get with du -h | tail -n 1.

References:

  1. I've previously documented all of this to myself in my eRCaGuy_dotfiles repo in this file here: git & Linux cmds, help, tips & tricks - Gabriel.txt. For more information, search that document for the above commands.

Keywords: see and analyze disk usage and disk space in Linux Ubuntu