diff options
author | Karel Zak | 2011-06-29 09:02:50 +0200 |
---|---|---|
committer | Karel Zak | 2011-06-29 09:02:50 +0200 |
commit | 067e9b4934372f72b89b2c0442a3d28290834537 (patch) | |
tree | e912560ca947cfe48213591e8c670d47fae36510 /mount | |
parent | Merge branch 'wknd23' of git://github.com/kerolasa/lelux-utiliteetit (diff) | |
download | kernel-qcow2-util-linux-067e9b4934372f72b89b2c0442a3d28290834537.tar.gz kernel-qcow2-util-linux-067e9b4934372f72b89b2c0442a3d28290834537.tar.xz kernel-qcow2-util-linux-067e9b4934372f72b89b2c0442a3d28290834537.zip |
mount: first look for mountpoint
# mount <device|dir>
The current code looks for a device and then for a mountpoint in
/etc/fstab. This is not user friendly solution. People usually use
# mount /dir
to mount any filesystem. It makes more sense to check for mountpoint
and if not found then for device.
This is also important for bind mounts, for example if you have in
your fstab:
/dev/sda1 /mnt/foo auto defaults
/mnt/foo /mnt/bar none bind
then
# mount /mnt/foo
should be interpreted as the first entry and /dev/sda1 should be
mounted.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=716483
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'mount')
-rw-r--r-- | mount/mount.8 | 11 | ||||
-rw-r--r-- | mount/mount.c | 4 |
2 files changed, 13 insertions, 2 deletions
diff --git a/mount/mount.8 b/mount/mount.8 index 898253769..e9a52dd55 100644 --- a/mount/mount.8 +++ b/mount/mount.8 @@ -101,6 +101,17 @@ the pathname refers to the root of the filesystem on .IR device . +If only directory or device is given, for example: +.RS + +.br +.BI "mount /dir" +.br + +.RE +then mount looks for a mountpoint and if not found then for a device in the +/etc/fstab file. + .B The listing and help. .RS Three forms of invocation do not actually mount anything: diff --git a/mount/mount.c b/mount/mount.c index 3ba705f3e..00637f52b 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -2347,10 +2347,10 @@ getfs(const char *spec, const char *uuid, const char *label) else if (label) mc = getfs_by_label(label); else { - mc = getfs_by_spec(spec); + mc = getfs_by_dir(spec); if (!mc) - mc = getfs_by_dir(spec); + mc = getfs_by_spec(spec); } if (mc) return mc; |