1

I have two devices /dev/sdc1 and /dev/sdc3.

/dev/sdc1 is mounted on / and /dev/sdc3 is mounted on /home.

The problem is that the device sdc1 is full whereas sdc3 has a lot of spare space. I want to determine where all that space on sdc1 gone (I suspect installed packages. a lot of them).

I tried to use du (and ncdu which makes this info more visual) but it calculates size of the whole tree (/home is nested on /) and I want to know only what's filling one of my devices. Is there a way to do that?

To clarify: I need some way to calculate usage of a device, not just exclude some subdirectories (which may be applicable in my situation, but I believe it can be more complex than that)

5
  • Assuming Linux utilities: du -hs * | sort -rh. You can drill it down from there. Jun 2, 2017 at 11:46
  • Use also df(1) in addition of du Jun 2, 2017 at 12:12
  • @SatoKatsura You can't use | sort with du -h. The -h allows the unit to vary, so you can end up with a 10tb file/directory in the middle of couple a kb ones.
    – phemmer
    Jun 2, 2017 at 12:30
  • @Patrick: Newer versions of sort has a -h (which @SatoKatsura used) option to sort human readable numbers, exactly for this. Jun 2, 2017 at 12:53
  • @Patrick Hence "assuming Linux utilities". With POSIX utilities it would be something like du -ks * | sort -rn, but the output is less readable. Jun 2, 2017 at 13:13

1 Answer 1

3

To limit to a single device you need the -x parameter of du

-x, --one-file-system
          skip directories on different file systems

A useful graphic front-end to du is xdiskusage.

0

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