Module: LinuxAdmin::Mountable
- Included in:
- LogicalVolume, Partition
- Defined in:
- lib/linux_admin/mountable.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#fs_type ⇒ Object
Returns the value of attribute fs_type.
-
#mount_point ⇒ Object
Returns the value of attribute mount_point.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#fs_type ⇒ Object
Returns the value of attribute fs_type.
8 9 10 |
# File 'lib/linux_admin/mountable.rb', line 8 def fs_type @fs_type end |
#mount_point ⇒ Object
Returns the value of attribute mount_point.
9 10 11 |
# File 'lib/linux_admin/mountable.rb', line 9 def mount_point @mount_point end |
Class Method Details
.included(base) ⇒ Object
22 23 24 |
# File 'lib/linux_admin/mountable.rb', line 22 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#format_to(filesystem) ⇒ Object
26 27 28 29 30 |
# File 'lib/linux_admin/mountable.rb', line 26 def format_to(filesystem) run!(cmd(:mke2fs), :params => { '-t' => filesystem, nil => self.path}) @fs_type = filesystem end |
#mount(mount_point) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/linux_admin/mountable.rb', line 32 def mount(mount_point) FileUtils.mkdir(mount_point) unless File.directory?(mount_point) if self.class.mount_point_exists?(mount_point) raise ArgumentError, "disk already mounted at #{mount_point}" end run!(cmd(:mount), :params => { nil => [self.path, mount_point] }) @mount_point = mount_point end |
#umount ⇒ Object
43 44 45 |
# File 'lib/linux_admin/mountable.rb', line 43 def umount run!(cmd(:umount), :params => { nil => [@mount_point] }) end |