Sponsored Content
Top Forums Shell Programming and Scripting bash script to get all mounted devices Post 302342097 by m0z4rt on Friday 7th of August 2009 11:23:06 AM
Old 08-07-2009
Quote:
Originally Posted by peterro
A bit different then..

Code:
#!/bin/bash
count=0
for device in `gksudo 'fdisk -l' | sed -n '/^[/]/p' | awk '{print $1}'`
do
  count=$((count+1))
  dev[$count]=$device
done

echo ${dev[7]}
echo $count

The last two echo's are just to show output.
Thanks, that is good point of start for me.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

disableing my USB devices using a script

hi guys I would like to disable my USB devices using a shell script(Linux machine) i.e(hoteplug,kernelpcmciacs,pcmciacs) Kindly suggest me at the earliest Thnks in advance regards ash (0 Replies)
Discussion started by: whizkidash
0 Replies

2. UNIX for Dummies Questions & Answers

passthrough devices vs. named devices

I am having trouble understanding the difference between a passthrough device and a named device and when you would use one or the other to access equipment. As an example, we have a tape library and giving the command "camcontrol devlist" gives the following output: akx# camcontrol... (1 Reply)
Discussion started by: thumper
1 Replies

3. Shell Programming and Scripting

How to display partition name on mounted on using this script

Hi All Guys.... root> df -k|grep /u0 /dev/vx/dsk/oradg/u02vol 12582912 8717924 3744252 70% /u02 /dev/vx/dsk/oradg/u01vol 8796160 5563610 3131556 64% /u01 /dev/vx/dsk/oradg/u04vol 10035200 1247888 8519534 13% /u04 /dev/vx/dsk/oradg/u03vol 12582912 2524060 9744542 21% ... (3 Replies)
Discussion started by: adzuanamir
3 Replies

4. Shell Programming and Scripting

bash script to check if mounted, and mount if not

I'd like to make a wrapper bash script that will make sure that an nfs mount is mounted before launching a program that depends on the mount being active. Basically: 1) Check to see if the mount is active 2) If it's not active, try to mount it 3) If it won't mount because the nfs server is... (3 Replies)
Discussion started by: graysky
3 Replies

5. Shell Programming and Scripting

1 usb stick -> 2 mounted devices

Hello, i am using a solaris thinclient that tries to connecting to a terminalserver. (RDP) Everything works fine, but the usb redirection. If i put in a usb stick i always get 2 usb-drives mounted. If i look in /tmp/SUNWut/mnt/<name of the host> i see 2 devices. One with the name of the... (2 Replies)
Discussion started by: anarcy
2 Replies

6. Shell Programming and Scripting

How to check if a partition is mounted or not with bash?

How to check if a partition is mounted or not with bash? And when is $? variable one? Please give example. (10 Replies)
Discussion started by: cola
10 Replies

7. Shell Programming and Scripting

sample code to display mounted devices

Hi all I need to write shell script to list out the mounted devices for a particular user. As i am new to shell script please help me. Here the problem is sometime unmounted devices also will be displayed in fstab. How to rectify that? Can anybody help me? Regards Ilamathi (0 Replies)
Discussion started by: ilamathi
0 Replies

8. How to Post in the The UNIX and Linux Forums

NFS mounted and unmounted shell script

Hi, I making a script to check nfs mount and unmount options. After various findings, i didn't get any solution for that. Can you please help me in making the script. 1) I have used, if grep -qs '/var/JETSHARE' /proc/mounts; then echo "It's mounted." else echo "It's not mounted. ... (2 Replies)
Discussion started by: Santosh101
2 Replies

9. Shell Programming and Scripting

Script to check if file systems are mounted

Hi I have the following piece of code, running on a solaris 10 O.S., that is not working for NFS file systems: for vol in `grep -E 'vxfs|ufs|nfs' /etc/vfstab | egrep -v '^#' | awk '{ print $3 }'` do if df -k $vol | grep $vol > /dev/null then outputOK "Filesystem: $vol mounted" else... (1 Reply)
Discussion started by: fretagi
1 Replies
volrootmir(8)						      System Manager's Manual						     volrootmir(8)

NAME
volrootmir - Mirror areas necessary for booting to a new disk SYNOPSIS
/usr/sbin/volrootmir [-a] [nconfig=count] target_disk [swap=target_partition] OPTIONS
Specifies that all volumes on the system disk be mirrored, not just the root and swap volumes, rootvol and swapvol. DESCRIPTION
The volrootmir script causes a mirror copy of areas of the root disk involved in booting to be made on the specified target disk. When used without the -a option, volrootmir adds mirrors of the root and swap volumes and allocates them on the new disk. In addition, all disk regions required for booting are set up and partitions for the new volume mirrors are created. When used with the -a option, volrootmir mirrors all in-use partitions on the system disk. To mirror a swap volume that is on a separate disk from the root volume, the swap attribute must be used to specify a separate target for the swap mirror. The target disk(s) must be at least as large as the sum of the sizes of rootvol and swapvol. Also, the physical disk should not have any disk partition in use. This script can be called from the voldiskadm menus by choosing the Mirror volumes on a disk operation. ATTRIBUTES
Specifies the number of log copies and copies of the configuration database, for example, nconfig=2. Specifies that the swap volume, swapvol, be mirrored on a separate disk, as specified by target_partition. EXAMPLES
The following command mirrors the rootvol and swapvol volumes onto the target disk, dsk3. This command will fail if swapvol is on a differ- ent disk from rootvol. # volrootmir dsk3 The following command mirrors rootvol, swapvol, and any other volumes on the root disk onto the target disk, dsk3. This command will fail if swapvol is on a different disk from rootvol. # volrootmir -a dsk3 The following command mirrors rootvol on disk dsk3, swapvol onto partition dsk7d, and any other volumes on the root disk onto disk dsk3. This command will fail if swapvol is on the same disk as rootvol. # volrootmir -a dsk3 swap=dsk7d The following command mirrors rootvol onto disk dsk3 and swapvol onto partition dsk7d. This command will fail if swapvol is on the same disk as rootvol. # volrootmir dsk3 swap=dsk7d SEE ALSO
volintro(8), voldiskadm(8) volrootmir(8)
All times are GMT -4. The time now is 04:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy