2

I have an Ubuntu box with 30GB of disk space that is almost filled up:

df -h

Filesystem      Size  Used Avail Use% Mounted on 
/dev/vda1        30G  28G     0  100% /

But when I check the size of all the root folders with

sudo du -sh /foldername

I only get a total of 17.2GB

lib/        6.7G
usr/        4.8G
home/       2.0G
var/        1.3G
boot/       1.1G
swapfile    1.1G
root/       125M
sbin/       12M
bin/        11M
etc/        8M
run/        420K
lost+found/ 16K
media/      8.8K
dev/        4K
lib64/      4K
mnt/        4K
srv/        4K
opt/        4K
tmp/        4K
sys/        0
proc/       0

Does anything here look suspicious? About 11 gigabytes are unaccounted for. Where could the missing 11G be?

4
  • 1
    There is a whole line of similar questions on this topic on SF, i suggest to try reading up there at first. Update question with links to what you've tried - that is if you don't find the solution. serverfault.com/q/275206/355160
    – Marek Rost
    Jan 3, 2018 at 7:51
  • Also du not accounting for space shown by df and chains of duplicates pointed out in comments there. What is the type of the filesystem. Jan 3, 2018 at 8:52
  • @Marek thanks for your helpful pointer. In the past I have been chased here by the SF community for similar type of questions so I didn't expect this sort of answer there.
    – JannieT
    Jan 3, 2018 at 12:30
  • 2
    Did you check for inode exhaustion yet? Use df -i. Also, use du -hxd 1 / when checking where the space went.
    – Daniel B
    Jan 3, 2018 at 13:33

2 Answers 2

5

Following advice from the Server Fault community, I checked my Block Size:

stat --printf='%s' -f .

which was "normal" at 4096

Then I checked how many deleted files were still held open by processes:

lsof | grep -c DEL

which reported 143 files which might account for all the lost space, but I think it is unlikely

Then I rebooted my box and voila! All my disk space was back:

df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            487M  4.0K  487M   1% /dev
tmpfs           100M  388K  100M   1% /run
/dev/vda1        30G   17G   12G  61% /

Reflection

The fact that I regained so much of my disk space after rebooting means that the volume's block size was not the main culprit. So, still not 100% sure what caused the discrepancy, but happy to have my space back!

3
  • "143 files which might account for some of the lost space, but not all of it" -- How do you know? Why not all of it? Jan 4, 2018 at 9:13
  • @Kamil you are right. Thank you. I have updated my post accordingly.
    – JannieT
    Jan 4, 2018 at 11:10
  • I once had a logfile that bloated over 20 GiB or so. Since rebooting freed the space for you, I think deleted file(s) being the cause was not so unlikely. Jan 4, 2018 at 11:22
-1

I think you might have some big hidden files, which will show up only if you use the -a flag:

du -ha /foldername | sort -hr

The above command will output the the size for all files (including hidden files) and the sort will order them by size so you may identify them.

5
  • 2
    Hidden files (filename starting with a dot) are of course included when using du --summarize on a folder. --all just changes what du prints.
    – Daniel B
    Jan 3, 2018 at 13:38
  • Very useful command.
    – JannieT
    Jan 3, 2018 at 13:38
  • @DanielB: Precisely what I said "which will show up only if you use the -a flag:". JannieT posted that when counting the size of the files listed by the du command output he/she could not see where the missing space was. As such, I suggested he/she use "-a" Jan 3, 2018 at 13:51
  • The point is: You will see it. It’s in the sum of the folder containing the files and all parent folders. It just won’t list the files separately. --all does not change the sums in any way.
    – Daniel B
    Jan 3, 2018 at 15:31
  • Nor did I state it would change the sums, only show all files responsible for taking up space. Nevertheless, I have edited my initial answer for clarity. Thank you for your observation. Jan 3, 2018 at 15:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .