Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

The /var/lib contains some unreadable contents, one of which is the mysql folder. I wanted to see the size of the /var/lib folder and the mysql folder in particular. Right-clicking on it and clicking on the "Properties" option gives me this:

The Properties dialog box

In case you need the specs:

  • Ubuntu 12.10
  • Nautilus 3.4.2

EDIT:

`du -sh /var/lib` gives me this:
du: cannot read directory `/var/lib/sudo': Permission denied
du: cannot read directory `/var/lib/tor': Permission denied
du: cannot read directory `/var/lib/udisks2': Permission denied
du: cannot read directory `/var/lib/php5': Permission denied
du: cannot read directory `/var/lib/openfire': Permission denied
du: cannot read directory `/var/lib/gdm': Permission denied
du: cannot read directory `/var/lib/lightdm': Permission denied
du: cannot read directory `/var/lib/polkit-1': Permission denied
du: cannot read directory `/var/lib/mysql': Permission denied
du: cannot read directory `/var/lib/libvirt/qemu': Permission denied
du: cannot read directory `/var/lib/libvirt/sanlock': Permission denied
du: cannot read directory `/var/lib/libvirt/images': Permission denied
du: cannot read directory `/var/lib/libvirt/boot': Permission denied
266M    /var/lib

and sudo du -sh /var/lib gives this:

309M    /var/lib
share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

sudo du -sh lib/ should do the job. It is showing the size greater than it shows in "Properties" window. root login is required as only root may be having access to some files. Hence the permission denied and unreadable content errors.

share|improve this answer
    
Man page of du says its an estimate size, is it possible to get an exact size? –  Jobin Apr 19 '13 at 15:09
    
It seems the estimate is the best possible bet, but at least the approx. size is known. Thanks, @Jay! –  Jobin Apr 19 '13 at 15:36
add comment

This is normal behavior. Some of the sub-directories in /var/lib are owned by the services that store files there and cannot be read by other users.

You can view the contents and get sizes of folders/files from the terminal.

share|improve this answer
add comment
sudo du -b /var/lib/

gives you an integer in bytes. That's about as exact as you can get! Make sure you leave the trailing / because sudo du -b /var/lib will return the size of every file in there.

share|improve this answer
    
Please read the man page of du. –  Jobin Apr 19 '13 at 15:21
    
The absolute file space, since one of the reasons I want this is, is to know the size of mysql database. –  Jobin Apr 19 '13 at 15:48
    
Another thing you can do is use mysqldump and just look at the size of the file it dumps –  Scott Apr 19 '13 at 16:07
add comment

Your Answer

 
discard

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.