Bug #2398
Mount ensure => absent does not unmount file systems not listed in /etc/fstab
| Status: | Accepted | Start date: | 07/08/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% | |
| Category: | mount | |||
| Target version: | - | |||
| Affected Puppet version: | 0.24.8 | Branch: | ||
| Keywords: | ||||
Description
I’m working on using Puppet to change from standard mounts to automounts for some remote file systems. To make this as seamless as possible, I want to replace the original mount points with symlinks to the new ones. Naturally, changing a mount point to a symlink must be done only after the filesystem is unmounted, lest havoc and destruction ensue.
Puppet appeared to provide everything I needed for the job. As long as the mount is listed in /etc/fstab, these resource specifications seem to do the trick:
mount { “/example”: ensure => “absent” }
file { “/example”:
ensure => "/net/host/example",
links => "manage",
force => true,
require => Mount["/example"],
}
If a file system is mounted on the specified mount point but not listed in /etc/fstab, however, then Puppet does not (with those specifications) unmount that file system before attempting to replace its mount point with a symlink. As a result, Puppet ends up attempting to recursively delete the remote FS’s entire contents. The outcome depends largely on export and mount options, but it can be catastrophic.
The type reference says of mount: “Manages mounted filesystems, including putting mount information into the mount table.” At best, that’s a misleading description of the observed behavior. The implementation seems more geared to managing the mount table as a primary task, with management of actual mounting and unmounting being subordinate.
Ideally, this will be resolved by updating the mount type to take account of the actual active mounts, as available from “mount -l”, “df”, or “/proc/mounts”, so as to better ensure that all file systems that should be unmounted really are unmounted. It could possibly be extended to also support mounting file systems without recording them in the mount table. If the current behavior is retained, however, then the documentation should be updated to make that behavior clearer.
History
#1
Updated by James Turnbull almost 4 years ago
- Status changed from Unreviewed to Needs More Information
- Assignee set to Luke Kanies
Any comment Luke?
#2
Updated by James Turnbull almost 4 years ago
- Status changed from Needs More Information to Accepted
- 3 changed from Unknown to Easy
#3
Updated by James Turnbull almost 4 years ago
- Assignee deleted (
Luke Kanies)
#4
Updated by Stefan Schulte about 2 years ago
This should be fixed along with #4914. A mount that is currently mounted (= shows up when running mount) and does not appear in /etc/(v)fstab has an ensure state of ghost. If the should-value is absent puppet now unmounts the device without modifying the filesystem table.