Method: LinuxStat::Filesystem.total

Defined in:
lib/linux_stat/filesystem.rb

.total(fs = ?..freeze) ⇒ Object

total(fs = ‘.’)

Where fs is the directory of the file system (like / or /tmp/ or /run/media/thumbdrive).

It returns the total size of a given disk in bytes.

If the stat can’t be acquired, this method will return nil.



41
42
43
44
45
46
# File 'lib/linux_stat/filesystem.rb', line 41

def total(fs = ?..freeze)
  s = stat_raw(fs)
  return nil if s.empty?
  s.default = 0
  s[:block_size] * s[:blocks]
end