Operating System - HP-UX
1753808 Members
8377 Online
108805 Solutions
New Discussion юеВ

Re: mounting file systems

 
SOLVED
Go to solution
Vishu
Trusted Contributor

mounting file systems

Hi,

i am doing a DR activity. and i have built 80 lvols in it. Now, i have to mount all of them using

mount -F vxfs

Please help me in writing a script doing this for all 80 lvols.

lvols have their specific names like /dev/vg01/dbdata, /dev/vg01/dbhome, /dev/vg02/oracle etc.

and mount points also has the names like /home1, /home2, /data1, /tempdbdev, etc. Just writing these as you won't consider the lv names as standard like lvol1,2,3, and so on.

i have noted down all the LVs in a file and tried making for loop, but no luck.

Please suggest.
5 REPLIES 5
Vijaya Kumar_3
Respected Contributor
Solution

Re: mounting file systems

Create a file like this /tmp/mountdata

# cat mountdata
/dev/vg01/dbdata:/home1
/dev/vg01/dbhome:/data1
/dev/vg02/oracle:/temp
# for i in `cat mountdata`
> do
> lvol=$(echo $i|cut -d":" -f1)
> mpoint=$(echo $i|cut -d":" -f2)
> echo mount -F vxfs $lvol $mpoint
> done
mount -F vxfs /dev/vg01/dbdata /home1
mount -F vxfs /dev/vg01/dbhome /data1
mount -F vxfs /dev/vg02/oracle /temp
#


Please remove the echo command once you review the output.

Regards
Vijay Chinnasamy
Known is a drop, unknown is ocean - visit me at http://vijay.theunixplace.com
Vijaya Kumar_3
Respected Contributor

Re: mounting file systems

..... remove only the word "echo" to run the mount commands.

Known is a drop, unknown is ocean - visit me at http://vijay.theunixplace.com
James R. Ferguson
Acclaimed Contributor

Re: mounting file systems

Hi:

You have two choices. The first is to add your required mounts to '/etc/fstab' and to simply issue:

# mount -a

This is the simplest way and means that any time you reboot, everything will be automatically mounted again.

The second choice is to create a text file with the logical volume name followed by whitespace followed by the mountpoint, like:

# cat ./mountpts
/dev/vg01/dbdata /data1
/dev/vg01/dbhome /home1
/dev/vg02/oracle /home2

The script to use is simply:

# cat ./mymounts
#!/usr/bin/sh
while read MNTPT DIR X
do
mount ${MNTPT} ${DIR}
done < ./mymounts

...

Add any mount options you need to the 'mount' command.

Regards!

...JRF...
Vishu
Trusted Contributor

Re: mounting file systems

Thanks !!!

I got the solution from your replies. Closing the thread.

Dennis Handly
Acclaimed Contributor

Re: mounting file systems

You can also use the output from "mount -v" or copy your /etc/fstab entries.