Method: LinuxStat::Filesystem.free

Defined in:
lib/linux_stat/filesystem.rb

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

free(fs = ‘.’)

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

It returns the total free space in a disk in bytes.

It is to be noted that free is not same as available.

Free returns the size of free blocks.

If the stat can’t be acquired, this method will return an empty Hash.



60
61
62
63
64
65
# File 'lib/linux_stat/filesystem.rb', line 60

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