Kanrisuru

umount

Unmount a filesystem in ruby
linux manual

Basic Usage

require 'kanrisuru'
host = Kanrisuru::Remote::Host.new(host: '127.0.1.1', username: 'ubuntu', keys: ['~/.ssh/id_rsa'])

host.su('root')
result = host.umount(device: '/dev/vda2', directory: '/mnt/backup', force: true)
result.success?
true

Parameters

Field Type Description
fake string
Causes everything to be done except for the actual system call; if it’s not obvious, this "fakes" mounting the filesystem.
force boolean
Force an unmount (in case of an unreachable NFS system). Note that this option does not guarantee that umount command does not hang.
no_mtab string
Mount without writing in /etc/mtab. This is necessary for example when /etc is on a read-only filesystem.
no_canonicalize boolean
Don’t canonicalize paths. The mount command canonicalizes all paths (from the command line or fstab) by default. It is strongly recommended to not use this command-line option for normal mount operations.
fail_remount_readonly boolean
When an unmount fails, try to remount the filesystem read-only.
free_loopback boolean
When the unmounted device was a loop device, also free this loop device.
type string
The filysystem type. See Fs Mount Opts for a list of all file system types.
test_opts hash
A set of options that should be used to test if entries in /etc/fstab should be unmounted.
all boolean
Unmount all filesystems (of the given types) mentioned in fstab (except for those whose line contains the noauto keyword).
recursive boolean
Recursively unmount each specified directory. Recursion for each directory will stop if any unmount operation in the chain fails for any reason.
all_targets boolean
Unmount all mountpoints in the current mount namespace for the specified filesystem.

Result

No explicit data struct returned, only option is success?, failure?, and status to see if the program exited properly.

Exit Status

Code Description
0 Success
1 Failure

Tested On

  • Ubuntu, Debian, Centos, Fedora, Redhat, OpenSuse, SLES