Mounting a drive - not using fstab or root

Paul Gear paul at libertysys.com.au
Wed May 28 21:45:30 BST 2008


banewman at supernerd.com.au wrote:
> ...
>> Hi,
>> HARDY
>> I have a drive which at various times in the day and week, I want to
>> mount/umount, via cron and a script, in ?/media or another
>> folder /media/this-drive-folder/. Because I want to use different
>> folders at different mount times (for valid business reasons) the drive
>> can not be in fstab, as I understand it, because then I would not have
>> the choice of which folder to mount it in.
>>
>> But - mount wants root only to mount. I think users can mount fstab
>> drives if noauto, user (or suid using sudoers?) are used but that does
>> not overcome my mount location needs.
>>
>> So, the crux of all this is, is it possible to mount an ntfs drive that
>> is not in fstab, as a user in a script, without needing sudo?
>>   ...
> Hi David,
>                 The only way I know to do what you're trying to do is to 
> ...

That's like a red flag to a bull.  There's *always* more than one way to
do it.  :-)

Here are two more suggestions:

1.  Use autofs with two mount points defined, each addressing the same
device.  e.g., put this in /etc/auto.master:

/mymedia	/etc/auto.mymedia --timeout=10  # seconds

and this in /etc/auto.mymedia:

cd              -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
hd1		-fstype=auto			:/dev/sda
hd2		-fstype=ext3			:/dev/sda

Then when you want to use the drive, just cd to /mymedia/hd1 and it will
be ready to go.

2.  Use manual mounting:

/dev/sda  /mymedia/hd1  ext3  user,noauto  0  0
/dev/sda  /mymedia/hd2  ext3  user,noauto  0  0

Then you can just 'mount /mymedia/hd1' as a normal user, and neither
point will mount automatically when the system boots.

Note that if this is a USB or similar device (firewire, eSATA), you'll
probably need to disable automatic mounting of devices with the GNOME
tools.  (I can't remember how to do this.)

Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4633 bytes
Desc: S/MIME Cryptographic Signature
Url : https://lists.ubuntu.com/archives/ubuntu-au/attachments/20080529/a3c711f0/attachment.bin 


More information about the ubuntu-au mailing list