Your original du command will miss hidden files/folders off the root
directory. du will also miss files that are being written to but have
been removed. For example:
# create a folder with a single large file
mkdir tmp
cd tmp
dd if=/dev/zero of=zeros bs=1M count=300
sync
# grow another file but remove it part way through the process
du -hs .
df -h .
for i in {1..3} ; do
cat zeros
sync
1>&2 du -hs .
1>&2 df -h .
\rm seq >& /dev/null
done > seq
du -hs .
df -h .
Here's a transcript of what the output looked like on my system:
301M .
Filesystem Size Used Avail Use% Mounted on
/dev/sdb6 39G 8.4G 31G 22% /
601M .
Filesystem Size Used Avail Use% Mounted on
/dev/sdb6 39G 8.7G 30G 23% /
301M .
Filesystem Size Used Avail Use% Mounted on
/dev/sdb6 39G 9.0G 30G 24% /
301M .
Filesystem Size Used Avail Use% Mounted on
/dev/sdb6 39G 9.3G 30G 25% /
301M .
Filesystem Size Used Avail Use% Mounted on
/dev/sdb6 39G 8.4G 31G 22% /
Notice how du was initiallly 301M and df Used was 8.4G. Both then
increased to 601M and 8.7G, respectively. Once the file seq was
removed, du went back to 301M while df Used continued to increase to
9.0G then to 9.3G, before falling back to 8.4G once the process
finished.
You can find these deleted yet open files by examining /proc:
$ sudo bash -c 'ls -lad /proc/[1-9]*/fd/*' | grep -i dele
Regards,
- Robert
On Wed, Nov 19, 2008 at 2:50 PM, James <[EMAIL PROTECTED]> wrote:
>
> Sorry, perhaps I'm missing something in your reply..
>
> I'm already running du at intervals to diff the output and look for
> growing files/directory. The problem is, despite df reporting that
> I've lost 100s of MB of space , du doesn't show any appreciable
> difference.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Linux Users Group.
To post a message, send email to [email protected]
To unsubscribe, send email to [EMAIL PROTECTED]
For more options, visit our group at
http://groups.google.com/group/linuxusersgroup
-~----------~----~----~----~------~----~------~--~---