class Sys::Filesystem::Stat
Stat objects are returned by the Sys::Filesystem.stat method.
Constants
- NOSUID
Filesystem does not support suid or sgid semantics.
- NOTRUNC
Filesystem does not truncate file names longer than
name_max
.- RDONLY
Read-only filesystem
Attributes
The filesystem type, e.g. UFS.
The preferred system block size.
The total number of fragment_size
blocks in the filesystem.
The number of free blocks available to unprivileged processes.
The total number of free blocks in the filesystem.
The total number of files/inodes that can be created.
The number of free files/inodes available to unprivileged processes.
The total number of files/inodes on the filesystem.
The filesystem identifier.
A bit mask of flags.
The fragment size, i.e. fundamental filesystem block size.
The total number of files/inodes that can be created.
The number of free files/inodes available to unprivileged processes.
The total number of files/inodes on the filesystem.
The maximum length of a file name permitted on the filesystem.
The path of the filesystem.
Public Class Methods
Creates a new Sys::Filesystem::Stat object. This is meant for internal use only. Do not instantiate directly.
# File lib/sys/unix/sys/filesystem.rb, line 111 def initialize @path = nil @block_size = nil @fragment_size = nil @blocks = nil @blocks_free = nil @blocks_available = nil @files = nil @files_free = nil @files_available = nil @filesystem_id = nil @flags = nil @name_max = nil @base_type = nil end
Public Instance Methods
Returns the total amount of free space on the partition.
# File lib/sys/unix/sys/filesystem.rb, line 133 def bytes_free blocks_available * block_size end
Returns the total space on the partition.
# File lib/sys/unix/sys/filesystem.rb, line 128 def bytes_total blocks * block_size end
Returns the total amount of used space on the partition.
# File lib/sys/unix/sys/filesystem.rb, line 138 def bytes_used bytes_total - bytes_free end
Returns the percentage of the partition that has been used.
# File lib/sys/unix/sys/filesystem.rb, line 143 def percent_used 100 - (100.0 * bytes_free.to_f / bytes_total.to_f) end