1

On all the SOLARIS servers I have access to du -s for some reason returns around twice of what it should.

Example:

root@someserver:/tmp/testdir# uname -a
SunOS someserver 5.11 11.1 sun4u sparc SUNW,SPARC-Enterprise
root@someserver:/tmp/testdir# which du
/usr/bin/du
root@someserver:/tmp/testdir# ls -la
total 51824
drwxr-xr-x   2 root     root         183 Nov 14 13:08 .
drwxrwxrwt  20 root     sys         3191 Nov 14 13:05 ..
-rw-r-----   1 root     root     26513019 Nov 14 12:59 test.file
root@someserver:/tmp/testdir# du -s .
51808   .
root@someserver:/tmp/testdir# du -sh .
  25M   .

The file is around 25MB, the du -sh also correctly reports it as such. But du -s reports 50ish MB??

What is up with that??

4

Originally du was written to report the number of 512-byte sectors, and that is still the default on many Unix systems.

So your two results are the same.

  • Wonderfully intuitive, who the hell thought of that. :P – fgysin Nov 14 '14 at 13:12
  • It goes back to the days when discs had that sector size. I was around then, which is why I knew the answer! – AFH Nov 14 '14 at 13:45
  • Use du -k on Solaris to have it report in kilobytes instead of sectors. – alanc Nov 16 '14 at 16:39
  • @alanc - I didn't mention that, because the questioner already knew about du -h. Also, there are environment variables that can be set to make -k the default (I don't know if they are the same on every Unix, but they are mentioned on the manual page man du). – AFH Nov 16 '14 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.