The libmount provides way how to deal with parsing errors in fstab --
on error callback function is executed and according to the return
libmount manipulate with the malformed line, possible are three
states:
1/ fatal error; all file ignored (callback rc < 0)
2/ recoverable error; malformed line ignored (callback rc > 0)
3/ ignore the error (callback rc == 0)
The 2/ is the default if no callback specified.
Unfortunately our utils uses 3/. The correct way is to use 2/.
Signed-off-by: Karel Zak <kzak@redhat.com>
This adds a concise description of a tool to its usage text.
A first form of this patch was proposed by Steven Honeyman
(see http://www.spinics.net/lists/util-linux-ng/msg09994.html).
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
POSIX exit code is only 8-bit, and since umount sums up error
codes, it can sometimes report success (exit code 0) even though
a number of operations failed.
For example, running, in an empty directory:
umount `seq 1 7`
returns 224 (7*32), since none of the 7 mount point exists but
umount `seq 1 8`
returns 0 (8*32=256)
This patch clips the return value to 255.
Signed-off-by: Nicolas Boichat <nicolas@boichat.ch>
$ umount LABEL=foo
currently does not work for non-root users as umount uses the
LABEL= as a path in sanitize_path().
Signed-off-by: Karel Zak <kzak@redhat.com>
non-root user on device that is not mounted:
$ umount /mnt/flash
umount: /mnt/flash: umount failed: Operation not permitted
this is true, because we cannot evaluate permissions as there is no
entry in mtab, but users expect something more helpful -- for example
umount: /mnt/flash: not mounted
References: https://bugs.archlinux.org/task/31647
Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/canonicalize.c: don't interpret empty strings as relative paths
* libmount: more robust libmnt_table find function and debug messages
References: https://bugzilla.novell.com/show_bug.cgi?id=825150
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
# mount -t tmpfs tmp /mnt/A
# mount --bind /mnt/A /mnt/B
# mount -t tmpfs tmp /mnt/C
the command:
umount --all-targets /mnt/A
has to umount only A and B, but not C. The C is a another filesystem.
Signed-off-by: Karel Zak <kzak@redhat.com>
The same source (whole filesystem or filesystems subvolume) could be
mounted on more targets (mountpoints). For example bind mounts or
btrfs sub-volumes.
If you want to detach the source device from the system then you need
to unmount all the mountpoints.
umount --all-targets <device|mountpoint>
provides this functionality. This option could be used together with
--recursive. Then all nested mountpoints within the filesystem are
unmounted too. For example:
umount --recursive --all-targets /dev/sdb1
should be a way how to make the device unmounted at all.
Signed-off-by: Karel Zak <kzak@redhat.com>
Without this table libmount will not resolve paths, meaning that
umounting by relative path will fail.
[kzak@redhat.com: - use mnt_context_get_cache() to make it sensitive
to --no-canonicalize cmdline option]
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
In the umount --recursive we follow entries from mountinfo, but the
entries maybe already obsolete. Especially if the hierarchy of the
mountpoints contains shared subtrees and umount(2) for one entry may
generate umount for some other entry too.
Signed-off-by: Karel Zak <kzak@redhat.com>
- mark some options combinations mutually exclusive
- reset libmount context before next umount (this is important!)
Signed-off-by: Karel Zak <kzak@redhat.com>
This allows unmounting of an entire tree of filesystems, which might be
of particular interest for a shutdown initramfs.
[kzak@redhat.com: - always return MOUNT_EX_* codes
- cosmetic changes on coding style]
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
Note that old umount(8) uses 0 and 1 exit codes, and some
exceptions like 4 or 32.
The new umount(8) cleanups this mess and uses the same exit codes as
mount(8) (see mount(8) man page).
Signed-off-by: Karel Zak <kzak@redhat.com>
Now we have three versions of the mount(8) utility
* old mount(8)
--enable-mount [default]
* old mount(8) linked with libmount
This is this is necessary for systems without mtab file.
--enable-libmount-mount
- new mount(8)
This is completely new pure-libmount based mount(8).
--enable-new-mount
Signed-off-by: Karel Zak <kzak@redhat.com>