filesystem gents, this one’s for you:

There’s something that bugs me about ext4 that I miss from ntfs, knowing the size of a directory

in ext4 every dir is a kB or so, while in ntfs it’s the sum of all descendants.

Is there a way to have that with ext4 or another fs in Linux?

I understand there could be extra writes to have that.

  • 4
    du -sh /home

    in unix/linux everything is a file. A directory - too. And so it happens that the directory file size in ext is no less than a single filesystem's block [4kb by default in ext].

    Not sure about other filesystems.. I think I've seen the same thing in FATs too. So it could be not a filesystem but rather a *nux thing

    edit: directories containing large numbers of files in their first level have bigger size, because they need more space to keep all the files' records. That size will still be a "n X <block_size>"
  • 1
    If you want to know the size of the contents of a folder, simply changed the `du -sh /path/to/folder` which @netikras proposed to `du -sh /path/to/folder/*`
  • 1
    Yeah, I was hoping to not need to scan 50% of my drive to find out the weight of my home dir
  • 5
    @jesustricks that's what happens on windows too, no?
  • 1
    du -xhs

    The -x flag will keep du from counting data in other filesystems.
  • 0
    du -d 1 -h
  • 0
    @electrineer huh, yeah, you're right... I don't know why I assumed otherwise... sorry for this post people!
Add Comment