Sponsored Content
Top Forums Shell Programming and Scripting if (disk is mounted) unmount if (disk is unmounted) mount Post 302503810 by apmcd47 on Friday 11th of March 2011 06:35:40 PM
Old 03-11-2011
This works on Ubuntu Linux
Code:
mountPart=/path/to/part
rootId=$(stat -c%d /)
mountId=$(stat -c%d "${mountPart}")
if (( rootId == mountId ))
then
   # code for not mounted
else
   # code for mounted
fi

Your milage may vary.

Andrew
 

10 More Discussions You Might Find Interesting

1. HP-UX

Unmount and remove all Logical vol.Volume group and physical disk

Hi, Someone please help me with how i can unmount and remove all the files systems from a cluster. This is being shared by two servers that are active_standby. (3 Replies)
Discussion started by: joeli
3 Replies

2. HP-UX

/usr out of disk space need to unmount/ expand volume /mount

Greetings, I am running HP-UX 10.2 and /usr is out of disk space already. I installed IE 5.0 for UNIX on my machine under /usr and browsed the Internet for a while and presto no more disk space. I have plenty of hard disk space on my computer so would like to expand the size of the volume. The... (5 Replies)
Discussion started by: Dirk_
5 Replies

3. SuSE

External USB disk cannot be mounted

Hi, I am running Suse on a fujitsu server. The problem is that it will no fully load the usb external disk. When plugged in, dmesg shows that indeed a usb disk has been plugged in ,but gives no devpath e.g sda,sdb. lsusb shows the disk vendor (western digital) but nothing else.Whats goin on... (2 Replies)
Discussion started by: ulemsee
2 Replies

4. OS X (Apple)

Can't Mount Disk / Image after bad unmount

I have had a little issue with one of my disks, the usb cacble was pulled out and one of the external drives on it would no longer mount. I used First Aid and it verified and repaired both OK / nothing to do). After lots of messing around and not being able to mount I used Drive Genius 2 and that... (1 Reply)
Discussion started by: Cranie
1 Replies

5. OS X (Apple)

When a disk won't 'Unmount"

hdiutil detach -Force disk&number (ex:hdiutil detach -Force disk1) (3 Replies)
Discussion started by: unimachead
3 Replies

6. Shell Programming and Scripting

Kill shell script when host program not running/disk unmounted

I have my Mac OS X program executing a shell script (a script that copies files to a drive). I want to make it so that the shell script automatically kills itself if it finds that the host .app is not running OR kill itself if the drive that it is copying files to has been unmounted. Right now what... (2 Replies)
Discussion started by: pcwiz
2 Replies

7. Shell Programming and Scripting

Unmount USB disk

Hi, How can I unmount an usb disk using the command umount? (3 Replies)
Discussion started by: Guccio
3 Replies

8. UNIX for Dummies Questions & Answers

How to unmount a folder and do check disk only in that path

I need to check if a folder has some kind of logic disk problems. I have a FreeBSD machine where the (root)\tmp\TEST folder has some file created by a script that i cannot delete. If i rename the tmp\TEST folder then i can delete them (apparently) but if i recreate a folder in tmp directory... (2 Replies)
Discussion started by: mirrorx
2 Replies

9. Solaris

How to modify a disk with mounted partitions?

Hi Guys, I was wondering; can a disk with mounted partitions be modified? If yes, how can this be done? Thanks lots (1 Reply)
Discussion started by: cjashu
1 Replies

10. AIX

Mounted and unmounted

Hi Guys I'm new here, and I need urgent help. This my first steps to be Aix admin and I have this task -instal Oracle database on Aix machine and create mounting point /u02 of size 100GB for Oracle Standalone database installation. -download and install the following OS patches - IV42025... (5 Replies)
Discussion started by: khaled_ly84
5 Replies
mount_pcfs(1M)						  System Administration Commands					    mount_pcfs(1M)

NAME
mount_pcfs - mount pcfs file systems SYNOPSIS
mount -F pcfs [generic_options] [-o FSType-specific_options] special | mount_point mount -F pcfs [generic_options] [-o FSType-specific_options] special mount_point DESCRIPTION
mount attaches an MS-DOS file system (pcfs) to the file system hierarchy at the mount_point, which is the pathname of a directory. If mount_point has any contents prior to the mount operation, these are hidden until the file system is unmounted. If mount is invoked with special or mount_point as the only arguments, mount will search /etc/vfstab to fill in the missing arguments, including the FSType-specific_options; see mount(1M) for more details. The special argument can be one of two special device file types: o A floppy disk, such as /dev/diskette0 or /dev/diskette1. o A DOS logical drive on a hard disk expressed as device-name:logical-drive , where device-name specifies the special block device-file for the whole disk and logical-drive is either a drive letter (c through z) or a drive number (1 through 24). Examples are /dev/dsk/c0t0d0p0:c and /dev/dsk/c0t0d0p0:1. The special device file type must have a formatted MS-DOS file system with either a 12-bit, 16-bit, or 32-bit File Allocation Table. OPTIONS
generic_options See mount(1M) for the list of supported options. -o Specify pcfs file system specific options. The following options are supported: foldcase|nofoldcase Force uppercase characters in filenames to lowercase when reading them from the filesystem. This is for compatibility with the pre- vious behavior of pcfs. The default is nofoldcase. FILES
/etc/mnttab table of mounted file systems /etc/vfstab list of default parameters for each file system ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWesu | +-----------------------------+-----------------------------+ SEE ALSO
mount(1M), mountall(1M), mount(2), mnttab(4), vfstab(4), attributes(5), pcfs(7FS) NOTES
If the directory on which a file system is to be mounted is a symbolic link, the file system is mounted on the directory to which the sym- bolic link refers, rather than on top of the symbolic link itself. SunOS 5.10 24 Nov 2003 mount_pcfs(1M)
All times are GMT -4. The time now is 04:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy