Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Writing a script to mount and umount a drive in Linux Post 2400 by PxT on Thursday 10th of May 2001 06:04:36 PM
Old 05-10-2001
Have the script do something like this:

su -c "mount -t vfat /dev/sda4 /mnt/jazz"


You will be prompted for the root password.



Also, recent version of mount allow you to add the "user" option to the corresponding /etc/fstab entry which will allow any user to mount the filesystem. So, you could put something like:

/dev/sda4 /mnt/jazz vfat user 1 1


in your /etc/fstab to allow a normal user to mount the filesystem.

Its also important to note that the "user" option implies "noexec,nodev,nosuid" unless subsequently overridden. See the man pages for fstab and mount.

HTH

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to mount a hotswap scsi drive on a solaris 2.6 netra box using the mount command?

Hi... question is this: How do I mount an LVD hotswap scsi drive in bay #2 on a netra using the mount command? volmgt doesn't seem to mount it and/or I don't know how to view the drives data if it's formatted which it may not be. This drive is not new out of the box so I'm not sure. ... (4 Replies)
Discussion started by: soulshaker
4 Replies

2. UNIX for Dummies Questions & Answers

solaris 8 admin I text ambiguities on mount and umount

i'm prepping for my midterm, which i will bomb. i am scurrying to finish reading the final chapter before i get down into the review. however, i came across something in chapter 8 - "mounting file systems" that has me really confused. the text says the following: then it goes on to... (2 Replies)
Discussion started by: xyyz
2 Replies

3. Filesystems, Disks and Memory

writing to a cdr drive.

ive looked around for software to do this in linux, but am still not sure how to. i want to be able to mount a cdr and write to it and be able to take the disk out and finish writing whatever i want to it at a later time. can we do this in linux? (4 Replies)
Discussion started by: norsk hedensk
4 Replies

4. Linux

How to mount/umount disk from a non-root account

Is it possible to mount a disk from a non-root account? I'm developing a Java application which executes commands in the shell using the java.lang.Runtime.exec api, which runs fine for commands ls, df, etc., but for commands mount and umount, i have problems as I need to be root to eecute these.... (8 Replies)
Discussion started by: brendan76
8 Replies

5. Shell Programming and Scripting

Linux: Writing a tricky script to check connectivity

So, first and foremost, I'm having issues with my internet connection. Periodically, the connection drops across the network. The fix is simple enough: restart the modem. However, this gets old when the connection dies out every hour. I can hit my surfboard on 192.168.100.1, and navigate to a... (5 Replies)
Discussion started by: kungfujoe
5 Replies

6. Solaris

mount & umount in sigle-user mode

In Solaris 8, when I boot to single user mode, mount a device and then reboot or init 0, the system unmount it automatically. However, in Solaris 10 it does not seem to do the same. Here is what I did: {0} ok boot -s # format Searching for disks...done AVAILABLE DISK SELECTIONS: 0.... (11 Replies)
Discussion started by: StarSol
11 Replies

7. Cybersecurity

Remove need for sudo for mount/umount

Hello, I'm trying to remove the need to use sudo to mount (in particular, binding). Modifying /etc/sudoers using visudo, I have tried: %admin ALL=NOPASSWD: /usr/bin/mount %admin ALL=NOPASSWD: /usr/bin/umountand %admin ALL=(ALL) NOPASSWD: /usr/bin/mount %admin ALL=(ALL) NOPASSWD:... (5 Replies)
Discussion started by: Narnie
5 Replies

8. UNIX for Dummies Questions & Answers

Simple way to umount NFS mount in linux

Hello... I've mounted a share using standard nomenclature for the NFS mount command with the following command line: mount -t nfs -o rw {IP address1}:/ /mnt_for_70 / {IP address2}(rw) mnt_for_70 is a mount point I created on {IP address2} I'm confuse and want to be sure I use the... (1 Reply)
Discussion started by: blaine.miller
1 Replies

9. Fedora

What is the right way to mount and umount a usb driver?

I have some questions: 1, I successfully mounted my usb drive with "sudo mount /dev/sdb1 /mnt", but I can't wirte, It says "read-only file system". But I can write it in windows. 2, After I umounted the usb drive the led of it still on, but not blinking. Is it safe to unplug it? How to let it's... (17 Replies)
Discussion started by: vistastar
17 Replies

10. HP-UX

Test cases for file system mount/umount performance in HP

Hi Folks, Could anyone please assist me with the what could be the scenarios to test the file system mount/umount performance check in HPUX. Thanks in advance, Vaishey (5 Replies)
Discussion started by: Vaishey
5 Replies
FSTAB(5)							   File Formats 							  FSTAB(5)

NAME
fstab - static information about the filesystems SYNOPSIS
/etc/fstab DESCRIPTION
The file fstab contains descriptive information about the various file systems. fstab is only read by programs, and not written; it is the duty of the system administrator to properly create and maintain this file. Each filesystem is described on a separate line; fields on each line are separated by tabs or spaces. Lines starting with '#' are comments, blank lines are ignored. The order of records in fstab is important because fsck(8), mount(8), and umount(8) sequentially iterate through fstab doing their thing. The first field (fs_spec). This field describes the block special device or remote filesystem to be mounted. For ordinary mounts it will hold (a link to) a block special device node (as created by mknod(8)) for the device to be mounted, like `/dev/cdrom' or `/dev/sdb7'. For NFS mounts one will have <host>:<dir>, e.g., `knuth.aeb.nl:/'. For procfs, use `proc'. Instead of giving the device explicitly, one may indicate the (ext2 or xfs) filesystem that is to be mounted by its UUID or volume label (cf. e2label(8) or xfs_admin(8)), writing LABEL=<label> or UUID=<uuid>, e.g., `LABEL=Boot' or `UUID=3e6be9de-8139-11d1-9106- -a43f08d823a6'. This will make the system more robust: adding or removing a SCSI disk changes the disk device name but not the filesystem volume label. Note that mount(8) uses UUIDs as strings. The string representation of the UUID should be based on lower case characters. The second field (fs_file). This field describes the mount point for the filesystem. For swap partitions, this field should be specified as `none'. If the name of the mount point contains spaces these can be escaped as `40'. The third field (fs_vfstype). This field describes the type of the filesystem. Linux supports lots of filesystem types, such as adfs, affs, autofs, coda, coher- ent, cramfs, devpts, efs, ext2, ext3, hfs, hpfs, iso9660, jfs, minix, msdos, ncpfs, nfs, ntfs, proc, qnx4, reiserfs, romfs, smbfs, sysv, tmpfs, udf, ufs, umsdos, vfat, xenix, xfs, and possibly others. For more details, see mount(8). For the filesystems currently supported by the running kernel, see /proc/filesystems. An entry swap denotes a file or partition to be used for swapping, cf. swapon(8). An entry ignore causes the line to be ignored. This is useful to show disk partitions which are currently unused. An entry none is useful for bind or move mounts. mount(8) and umount(8) support filesystem subtypes. The subtype is defined by '.subtype' suffix. For example 'fuse.sshfs'. It's recommended to use subtype notation rather than add any prefix to the first fstab field (for example 'sshfs#example.com' is deprea- cated). The fourth field (fs_mntops). This field describes the mount options associated with the filesystem. It is formatted as a comma separated list of options. It contains at least the type of mount plus any additional options appropri- ate to the filesystem type. For documentation on the available mount options, see mount(8). For documentation on the available swap options, see swapon(8). Basic file system independent options are: defaults use default options: rw, suid, dev, exec, auto, nouser, and async. noauto do not mount when "mount -a" is given (e.g., at boot time) user allow a user to mount owner allow device owner to mount comment for use by fstab-maintaining programs nofail do not report errors for this device if it does not exist. The fifth field (fs_freq). This field is used for these filesystems by the dump(8) command to determine which filesystems need to be dumped. If the fifth field is not present, a value of zero is returned and dump will assume that the filesystem does not need to be dumped. The sixth field (fs_passno). This field is used by the fsck(8) program to determine the order in which filesystem checks are done at reboot time. The root filesystem should be specified with a fs_passno of 1, and other filesystems should have a fs_passno of 2. Filesystems within a drive will be checked sequentially, but filesystems on different drives will be checked at the same time to utilize parallelism available in the hardware. If the sixth field is not present or zero, a value of zero is returned and fsck will assume that the filesystem does not need to be checked. The proper way to read records from fstab is to use the routines getmntent(3) or libmount. FILES
/etc/fstab, <fstab.h> SEE ALSO
mount(8), swapon(8), fs(5), nfs(5), xfs(5), proc(5), getmntent(3) HISTORY
The ancestor of this fstab file format appeared in 4.0BSD. AVAILABILITY
This man page is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/. util-linux August 2010 FSTAB(5)
All times are GMT -4. The time now is 06:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy