util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Suggestion for new multi-mount option
@ 2018-08-18 20:21 João Miguel
  2020-02-18 12:46 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: João Miguel @ 2018-08-18 20:21 UTC (permalink / raw)
  To: util-linux

Hi there,

First, some background: recently I've setup a few (too many) hard-drive
backups and new systems with LVM, lots of partitions and weird options
I'd put in the respective /etc/fstab. I don't want to write all that
shit every time I want to mount a system in /mnt/something, I wanted
«mount» to read my fstab, but although it has the «--fstab» option, it
doesn't allow me to mount anywhere but in /.

So I'm not sure if this is welcome here, but I don't really know C to
make the suggestion a patch, although it seems simple enough. Here's a
script, let's call it mount-relative:

#!/bin/bash
_dev="$1"
_mnt="$2"
_tmp="$(mktemp /tmp/fstab-XXXXX)"
mount -v "$1" "$2"
grep -Ev '(^#|swap|^$)' "$_mnt/etc/fstab" \
   | sed -E -e 's#\s+([^\s]+)# '"$_mnt"'\1#' \
            -e 's/(noauto,|,noauto|noauto)//g' \
   | cat >"$_tmp"
mount -av --fstab "$_tmp"
rm -vi "$_tmp"

(Note: I'm filtering «noauto» in a dumb way because I'm lazy and it's a
simple script)

As I've been using:

   mount-relative /dev/something /mnt/somewhere

I think it would be useful for it to be doable with «mount» as:

   mount --relative-root /dev/something /mnt/somewhere

Or at least:

   mount /dev/something /mnt/somewhere
   mount -a --fstab /mnt/somewhere/etc/fstab --relative /mnt/somewhere


Maybe also a «--ignore-noauto», as using «-o auto» in the script doesn't
seem to work (probably because «-o» is not made for usage with «--fstab»
and «-a»).

In case you don't consider this a good option for mount, well, have the
script, it has been very useful to me.

Best regards,
João Miguel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-18 12:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-18 20:21 Suggestion for new multi-mount option João Miguel
2020-02-18 12:46 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).