Big discrepancy between `du` and `df` used space on USB drive

Robert Heller heller at deepsoft.com
Mon Jan 2 16:51:03 UTC 2023


At Mon, 02 Jan 2023 16:09:57 +0000 "Adam Funk" <ubuntu-users at lists.ubuntu.com> wrote:

> 
> Hi,
> 
> I'm trying to figure out why the card on a bike camera is fuller than
> the files on it. Can anyone explain this?
> 
> /media/adam$ df -h HANDLEBAR/
> Filesystem      Size  Used Avail Use% Mounted on
> /dev/sda1        29G   12G   18G  39% /media/adam/HANDLEBAR
> 
> /media/adam$ du -sh HANDLEBAR/
> 3.3G	HANDLEBAR/
> 
> The second one matches the result of adding up the files and `du`s of
> subdirectories in that directory (including one hidden file of
> 117K). The camera has a micro SD card with a vfat filesystem.

There are "unnamed" or "hidden" files on the micro SD card.  Or files were 
deleted, but the space that they used was not returned to the free list.  I'm 
guessing that this might happen if the file system was not cleanly unmounted, 
eg you pulled it out of the camera while the camera was on.

Or you deleted a file that was open and in use by some running process and 
that running process is still running.  Use lsof to find that process and stop 
it.

> 
> Thanks
> Adam
> 
> 

-- 
Robert Heller             -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software        -- Custom Software Services
http://www.deepsoft.com/  -- Linux Administration Services
heller at deepsoft.com       -- Webhosting Services



More information about the ubuntu-users mailing list