LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-25-2007, 07:41 PM   #1
JosephS
Member
 
Registered: Jun 2007
Distribution: Debian Jessie, Bunsenlabs
Posts: 586

Rep: Reputation: 38
Varrying info about disk usage on /home


I tried getting info about my home directory:

Code:
du -h /home/joe/
995 M

Code:
du -hc /home/joe/*
902 M

Code:
du -hc home/joe/.*
2.1G

Doesn't * mean all files and .* hidden files?

When I run:
Code:
bash-3.1$ df -h /home/joe
Quote:
Filesystem Size Used Avail Use% Mounted on
/dev/hda3 51G 1.2G 47G 3% /home

I get 1.2G used
When I use kinfo I get 3797M used on my home partition
I have /home/joe partitioned at 55 GB
Why do I have some many different outcomes?

Thanks.

Last edited by JosephS; 08-25-2007 at 09:49 PM.
 
Old 08-25-2007, 09:15 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
The "*" wildcard doesn't expand to include hidden files and directories. You could use "du -hc /home/joe/{*,.*}".

There are other things that can give you different results. If a file has holes, it might have a larger value for the file size then it takes up on the file system. On example is a sparse file. Another thing, is if you have a short config file, for example. There are a lot of them in the hidden directories. They may only be 100 bytes long, but they will take up the whole block. Plus HD space for the directory entry and the inode. If you have 1024 blocksized then 924 is unused. Another thing that can take up space is the reserved area for the root user. For the ext3 filesystem you can use tune2fs to change the percentage of space reserved for the root user. By this I don't mean space for the root users /root home directory. I'm referring to an amount of disk space that only root can use. It is a parachute of sorts in case the system runs out of disk space.
 
Old 08-25-2007, 09:15 PM   #3
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197

Rep: Reputation: 105Reputation: 105
There are a number of reasons that can happen.

Here is the section from the Sunmanagers FAQ which is probably pretty relevant here too.

ftp://ftp.cs.toronto.edu/pub/jdd/sunmanagers/faq


Quote:
5.10) Where is my disk space? The "du" and "df" commands disagree.

If a process is holding open a file, and that file is removed, the
space belonging to the file is not freed until the process either
exits or closes the file. This space is counted by "df" but not by
"du". This often happens in /var/log or /var/adm when a long-running
process (e.g. syslog) is holding open a file. In the case of syslog,
send it a HUP (e.g. kill -HUP <syslog's process ID>).

You can use LSOF
(ftp://ftp.cerias.purdue.edu/pub/tool.../sysutils/lsof) to find
which processes are holding open a particular file. Thanks to Stefan
Voss <s dot voss at terradata.de> and Michael R. Zika <zika at oconto
dot tamu dot edu>

Under Solaris 2.6 and later, files which have been unlinked can still
be accessed through the /proc interface. If a process is holding open
such a file for writing, but it's inconvenient or impractical to kill
the process or get it to close the file, you can free up the disk
space by truncating (not removing) the file from under /proc; e.g.,

# cd /proc/1234/fd
# ls -l
c--------- 1 root 24, 12 Jan 1 11:33 0
c--------- 1 root 24, 12 Jan 1 11:33 1
c--------- 1 root 24, 12 Jan 1 11:33 2
--w------- 1 root 314159265 Jan 1 11:37 3
# : > 3
# ls -l
c--------- 1 root 24, 12 Jan 1 11:33 0
c--------- 1 root 24, 12 Jan 1 11:33 1
c--------- 1 root 24, 12 Jan 1 11:33 2
--w------- 1 root 0 Jan 1 11:38 3

Thanks to Dan Astoorian <djast at cs dot toronto dot edu>

Brian Poole <raj at cerias dot purdue dot edu> writes:
Another possible cause of df & du disagreeing is if the files are
being 'hidden' under a mount. I ran into this recently where I
had a large number of files in /tmp (from adding patches in single
user mode) that were on the root partition. Thus when I was
looking for them in multiuser mode, I couldn't find them because
of the tmpfs overlay. I exported the root partition via NFS and
upon mounting it found the hidden files and deleted them.
 
Old 08-25-2007, 10:23 PM   #4
JosephS
Member
 
Registered: Jun 2007
Distribution: Debian Jessie, Bunsenlabs
Posts: 586

Original Poster
Rep: Reputation: 38
When using du what do the wildcards * and .*, and *.* represent?

Why is there such a big difference between what kinfo (3,797M) and du -h /home/joe (995M)
 
Old 08-26-2007, 07:21 PM   #5
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197

Rep: Reputation: 105Reputation: 105
So, you want specific answers to your system? You could hand out your login and we could all go look. ;-)

Sorry. It just seems you've been given a fair bit of guidance, and now the specific answers depend on the particulars within your own system.

Use ls as well as du and dk to explore what's up. `ls -la`, `ls -ld *`, `ls -ld .*`, etc. will show you what is coming up. The wildcard expansion will be the same as it would be for du. The d option prevents it from expanding all the directories just to keep the output manageable.

But, remember all those other possible things mentioned in the general answers posted earlier.

On Solaris I can even create a snapshot of a filesystem that is disconnected from the directory tree. That's going to eat space without even showing up on any kind of `ls -la`. I would have to use the fssnap command to see what's up with it. I believe it won't show up on `du -k`, but it would show up on `df -k`. I don't recall seeing your distribution, so I don't know what other options you might have.
 
Old 08-30-2007, 07:24 AM   #6
JosephS
Member
 
Registered: Jun 2007
Distribution: Debian Jessie, Bunsenlabs
Posts: 586

Original Poster
Rep: Reputation: 38
Thanks for your help.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Disk usage info in C/C++ Ephracis Programming 7 03-14-2006 03:30 AM
IP Blocks for home usage tuxfriend2 Linux - Networking 3 06-02-2005 09:40 AM
getting realtime info on memory usage-cpu and harddrive usage steering Linux - Newbie 5 03-03-2005 08:43 PM
Pango : Need info abt the compilation & it's usage Pawan_shirbhate Red Hat 0 04-20-2004 04:17 AM
101% disk usage on an empty disk tsiuser Linux - Software 3 01-28-2004 06:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration