Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This isn't a problem as such, more a request for information based on ignorance of the Linux filesystem. The very short question is:

How do I find out how much free and used space there is on the volume from which Ubuntu is running?

More detail:

I'm running Ubuntu 12.04 from a 64Gb USB3 stick, created from booting up a year-old Ubuntu 12.04 DVD and running Startup Disk Creator. The reason for this is that the Master Boot Record on my hard disk, holding Windoze 7, has gone belly-up, and whilst awaiting a recovery disk I'm running Ubunto off USB or DVD as a 'trial'. (And will continue to run Ubuntu after restoring Windoze, as I've rediscovered my love of the penguin :o))

After installing Ubuntu on the stick I ran the software update app, which downloaded some 450Mb of updates and took a couple of hours to install to the stick. A couple of times I got a message saying that disk space was short. So I looked in the file manager (or whatever it's called these days) and couldn't see the stick listed, just:

  • hard disk (listed as 479Gb Filesystem)
  • two other partitions that had been created by Windoze
  • "4.3GB Filesystem" which when I try to open gives the error "Could not find /cow", and when I try to unmount it tells me I can't because it's not mounted - D'OH!!

Edit: screenshot of file manager

Edit: screenshot of low disk space warning

What I can't see is the USB stick from which I'm running Ubuntu. Where's it gone, anybody know?

This is tangentially related to a previous question of mine about system tools, in that I'm trying to get control and knowledge of the system in the newest incarnation of Ubuntu.

share|improve this question
You could post the screenshot at and then post the link here under comments or edit the post above (preferred) to show it. And, when you created the Ubuntu on USB, did you allocate space for a Persistant Filesystem so you can save files to the USB? – K7AAY Oct 31 '13 at 21:19
Thanks for the tip, kiloseven. I've uploaded screenshots of the file manager, and of a low disk space warning that's appeared just now. I did allocate 4Gb of persistent filespace when i created the Ubuntu USB. – Fred Riley Oct 31 '13 at 22:00
Can you run df -h in a terminal and post the results? – Braiam Oct 31 '13 at 22:13
Braiam, I've done that and uploaded the output to I wonder: is a 64Gb stick too small to install Ubuntu to? – Fred Riley Nov 1 '13 at 11:24
Ah, I think I may have sussed it. The mystery volume /cow is 4GB in size, so that must be the persistent filespace I set up when installing Ubuntu on the stick. With just 241Mb remaining I think that must be what's generating the 'low diskpace' errors I'm seeing. So how can you clear up persistent filespace? I'd forgotten about df, not having used Linux for a while, so thanks to all for the reminder, and to Chris K for the detailed response. – Fred Riley Nov 1 '13 at 11:32

There are a few tools I use when in this situation: df, du, and mount

du is the most useful for hunting down the culprit that filled up your filesystem:

$du -h --max-depth=1

However at the filesystem root, /, you won't have permission to access all of the directories to get a read on file sizes, so you'll need sudo to get full privileges. I just did this on our server at / and our raid is kinda big, so I bailed on that.

Examples follow:

15:08 chris@server /$ sudo du -h --max-depth=1
8.0K    ./mnt
16K     ./build
4.1G    ./opt
4.0K    ./backup
12K     ./media
13M     ./lib32
38M     ./root
300K    ./dev
6.0M    ./sbin
2.4G    ./lib
2.9G    ./var
4.0K    ./selinux
50M     ./home
2.3G    ./usr
0       ./proc
7.9M    ./bin
5.9M    ./tmp
200K    ./srv
4.0K    ./run
0       ./sys
4.0K    ./cdrom

I hit ctrl+c because I'm done waiting on /raid... So let's see what df says:

15:14 chris@server /$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb7              92G  9.0G   79G  11% /
none                  1.9G  300K  1.9G   1% /dev
none                  1.9G     0  1.9G   0% /dev/shm
none                  1.9G  7.3M  1.9G   1% /var/run
none                  1.9G     0  1.9G   0% /var/lock
none                  1.9G     0  1.9G   0% /lib/init/rw
/dev/sda1             3.6T  2.3T  1.2T  66% /raid
/dev/sdb9             276M   88M  175M  34% /boot
/dev/sdb8              88G  3.1G   81G   4% /var

Oh, wow, the raid is two-thirds full, maybe it's worth the wait to figure it out?

15:15 chris@server /raid$ !du
du -h --max-depth=1
852M    ./www
20K     ./investedin
9.8M    ./ups
99M     ./dealers
3.0G    ./photoshoot
69M     ./catalog_tech
86G     ./misc
4.9G    ./marketing
16G     ./pics
193G    ./Video
37G     ./mechanical_design
14M     ./tmp
16K     ./lost+found
93G     ./programs
16K     ./.Trash-1000
17G     ./Products
1.3G    ./vendors
1.1G    ./docs
128K    ./.Trash-1001
20M     ./customers
2.9M    ./po_invoices
18M     ./_SCANS

Well, it's still hanging out churning, so I'll be patient and let it go in the background. To analyze the above, I look through the sizes of the directories for who the disk hog is. Notice ./programs is 93G. If that's unexpected, you start drilling down that tree.

I prefer du -h --max-depth=1 because with any more depth, you get a ton of output and in this case, you might just need that one directory where a log has gone crazy (like on a website?)

Edited to add:
And mount isn't always applicable for your exact case, however, I have used Linux and the above techniques to rescue a Windows install with no free space. mount can help you see what hard drives are mounted where. Also notice how df also hints at the output from mount.

15:25 chris@server ~$ mount
/dev/sdb7 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
/dev/sda1 on /raid type ext4 (rw)
/dev/sdb9 on /boot type ext4 (rw)
/dev/sdb8 on /var type ext4 (rw)

What the above tells us is that the first hard drive's first partition (a hardware RAID 5) is on /raid and the actual "hard drive" in the computer is sdb. With / on sdb7, that reminds me this is the 2nd or 3rd OS I've had on this disk on this server. I put /var on a separate partition for when logs go crazy.

share|improve this answer
Anecdotal: du -h was hanging on me because I had a windows share mounted and the windows computer since moved, so du blocked while trying to re-establish the connection. – Chris K Oct 31 '13 at 22:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.