script to mount from vfstab file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers script to mount from vfstab file
# 1  
Old 10-11-2011
script to mount from vfstab file

I am setting up a test system and grabbed the /etc/vfstab file from the prod system. I don't want to overlay the /etc/vfstab file from the prod box on the test box so I just copied the prod /etc/vfstab file over to the test server and put the file in the /tmp/ directory.

I want to mount the file systems now and want to use a loop script to mount up these file systems.

this is what I have so far
Code:
for LINE in `cat /tmp/prod_vfstab |awk '{print $1 " "$3}' ` ; do mount -F vxfs $LINE ; done

$1 = would equal the device
$3 = would equal the directory mount point

my line would equal something like this
mount -F vxfs <device> <path>

what should my loop script line look like?

Solaris 10 system
korn shell

Last edited by vbe; 10-18-2011 at 09:34 AM.. Reason: next time do not forget the code tags thanks
# 2  
Old 10-18-2011
Not a great approach. Try this instead:
Code:
awk '{print $1,$3}' /tmp/prod_vfstab |
while read device mntpt; do
 mount -F vxfs $device $mntpt
done

I separated LINE into the two variables so you can see how that approach might be used.
These 2 Users Gave Thanks to otheus For This Post:
# 3  
Old 10-25-2011
Yes, this is what I wanted. I had forgotten about using 2 variables and then calling on them like you did. This works.

Thank You
David
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to mount nas-share using generated credentials (mount EC 13,32)

Heyas At home i have 1 nas with 3 shares, of which i used to mount 2 of them using a script with hardcoded password and username in it. EDIT: Turns out, its not the script, but 'how i access' the nas share.. (-o user=XY,password=... VS. -o credentials=...). Figured about credential files,... (0 Replies)
Discussion started by: sea
0 Replies

2. Emergency UNIX and Linux Support

Script to fill the file system mount with empty files to desired size

We are regularly using for our testing, where we are manually filling up the mount with desired size with following command dd if=/dev/zero of=file_2GB bs=2048000 count=2000 We are planning to automate the task where taking input for % of size as one input and the name of the file system... (8 Replies)
Discussion started by: chandu123
8 Replies

3. UNIX for Dummies Questions & Answers

Setting up a vfstab

Hi Guys i need your help quite urgently I am setting up a vfstab but need some help, here is the file systems 0. c0t0d0 <SUN36G cyl 24620 alt 2 hd 27 sec 107> drmlc-00 Part Tag Flag Cylinders Size Blocks Mounted/used by 0 root wm 0 - ... (1 Reply)
Discussion started by: brian112
1 Replies

4. Solaris

etc/vfstab

Hi Everyone, How to find the wrong entry in etc/vfstab or wrong mount point in etc/vfstab ? Thanks & Regards Padmaja. (4 Replies)
Discussion started by: padmaja
4 Replies

5. UNIX for Advanced & Expert Users

vfstab overlay mount

How can I specify and the -O (overlay option) in the vfstab ? Also can you specify the overlay option to the mount options for a Vertias cluster NFS service group ? (0 Replies)
Discussion started by: wjones
0 Replies

6. Shell Programming and Scripting

question about vfstab

Hi all, I have been trying to figure out a way to mount swap on /tmp at a stage early than the default script that does it... If anyone knows how it can be done pls pls help me!!!!! I have been struggling a lot for it Secondly, continuing with the same issue... I wanted to know if the... (4 Replies)
Discussion started by: wrapster
4 Replies

7. Solaris

mount in vfstab

In the end of /etc/vfstab file : /dev/md/dsk/d30 /dev/md/dsk/d30 /odb0 ufs no no - /dev/md/dsk/d40 /dev/md/dsk/d40 /odb1 ufs no no - After boot filesystems /odb0 and /odb1 don't mount. Also they don't mount after comand mount -a But if i'm enter... (1 Reply)
Discussion started by: jess_t03
1 Replies

8. Solaris

mounting file system /etc/vfstab

Hello. When I use format command - It shows: /dev/dsk/c0d0s4 is normally mounted on /u02 according to /etc/vfstab. Please remove this entry to use this device. What does it mean? (4 Replies)
Discussion started by: panchpan
4 Replies

9. UNIX for Dummies Questions & Answers

Vfstab on spare disk - HOW ? Mount ?

Hi, guys ! Could someone clarify one thing for me: I start machine from disk0, and want to check the /etc/vfstab on disk1. How do i do it ? Tried to write: cd / mount /dev/dsk/c0t1d0s0 /mnt But if I do cd /mnt, it is empty. I expected to see disk1 there ? Or am I wrong ? How do I... (3 Replies)
Discussion started by: DGoubine
3 Replies

10. UNIX for Dummies Questions & Answers

/etc/vfstab

If i wish to make a mount permanent, is it /etc/vfstab that i have to the entry add to? If so does anybody know the syntax, ie. is it tab or space delimited ? etc etc any help would be greatly appreciated (3 Replies)
Discussion started by: hcclnoodles
3 Replies
Login or Register to Ask a Question