salt.modules.mount

Salt module to manage Unix mounts and the fstab file

salt.modules.mount.active(extended=False)

List the active mounts.

CLI 范例:

salt '*' mount.active
salt.modules.mount.automaster(config='/etc/auto_salt')

List the contents of the auto master

CLI 范例:

salt '*' mount.automaster
salt.modules.mount.fstab(config='/etc/fstab')

List the contents of the fstab

CLI 范例:

salt '*' mount.fstab
salt.modules.mount.is_fuse_exec(cmd)

Returns true if the command passed is a fuse mountable application.

CLI 范例:

salt '*' mount.is_fuse_exec sshfs
salt.modules.mount.is_mounted(name)

2014.7.0 新版功能.

Provide information if the path is mounted

CLI 范例:

salt '*' mount.is_mounted /mnt/share
salt.modules.mount.mount(name, device, mkmnt=False, fstype='', opts='defaults', user=None, util='mount')

Mount a device

CLI 范例:

salt '*' mount.mount /mnt/foo /dev/sdz1 True
salt.modules.mount.remount(name, device, mkmnt=False, fstype='', opts='defaults', user=None)

Attempt to remount a device, if the device is not already mounted, mount is called

CLI 范例:

salt '*' mount.remount /mnt/foo /dev/sdz1 True
salt.modules.mount.rm_automaster(name, device, config='/etc/auto_salt')

Remove the mount point from the auto_master

CLI 范例:

salt '*' mount.rm_automaster /mnt/foo /dev/sdg
salt.modules.mount.rm_fstab(name, device, config='/etc/fstab')

Remove the mount point from the fstab

CLI 范例:

salt '*' mount.rm_fstab /mnt/foo /dev/sdg
salt.modules.mount.set_automaster(name, device, fstype, opts='', config='/etc/auto_salt', test=False, **kwargs)

Verify that this mount is represented in the auto_salt, change the mount to match the data passed, or add the mount if it is not present.

CLI 范例:

salt '*' mount.set_automaster /mnt/foo /dev/sdz1 ext4
salt.modules.mount.set_fstab(name, device, fstype, opts='defaults', dump=0, pass_num=0, config='/etc/fstab', test=False, match_on='auto', **kwargs)

Verify that this mount is represented in the fstab, change the mount to match the data passed, or add the mount if it is not present.

CLI 范例:

salt '*' mount.set_fstab /mnt/foo /dev/sdz1 ext4
salt.modules.mount.swapoff(name)

Deactivate a named swap mount

CLI 范例:

salt '*' mount.swapoff /root/swapfile
salt.modules.mount.swapon(name, priority=None)

Activate a swap disk

CLI 范例:

salt '*' mount.swapon /root/swapfile
salt.modules.mount.swaps()

Return a dict containing information on active swap

CLI 范例:

salt '*' mount.swaps
salt.modules.mount.umount(name, device=None, user=None, util='mount')

Attempt to unmount a device by specifying the directory it is mounted on

CLI 范例:

salt '*' mount.umount /mnt/foo

2015.5.0 新版功能.

salt '*' mount.umount /mnt/foo /dev/xvdc1