Re: find if under one filesystem other filesystems are mounted (538 Views)
Reply
Valued Contributor
support_billa
Posts: 192
Registered: ‎06-27-2011
Message 1 of 12 (575 Views)
Accepted Solution

find if under one filesystem other filesystems are mounted

hello,

i have following situation:

mounted filesystems:

/filesystem
/filesystem/fs1
/filesystem/fs2

how can i find out , if under one filesystem other filesystems are mounted ? (filesystem where mounted with server startup (/etc/fstab) or with service guard package start)
when i want to umount /filesystem? , i got following message :
umount: cannot unmount /dev/vg/lvol_fs : Device busy  
umount: return error 1. 

                                                                                                                                                                                                         
can i use following infomartion from thread "hard link (find file , which it points to )
i learned :  inode number 2  is a mounted filesystem , right ?
with command "/sbin/vxupgrade ?" i can see the filesystem version and with version greater 6 , i can use
/usr/sbin/vxlsino <inode>  <file_system>          ?

regards,                    

                                                              

Acclaimed Contributor
Dennis Handly
Posts: 25,063
Registered: ‎03-06-2006
Message 2 of 12 (559 Views)

Re: find if under one filesystem other filesystems are mounted

>if under one filesystem other filesystems are mounted?

 

You can look first in /etc/fstab, then in /etc/mnttab.

Honored Contributor
Doug O'Leary
Posts: 812
Registered: ‎05-25-2005
Message 3 of 12 (550 Views)

Re: find if under one filesystem other filesystems are mounted

Hey;

 

mount | grep filesystem | awk '{print $1}'

 

I typically write an inline script to umount all the filesystems for vgoracle, for instance:

 

mount | grep vgoracle |awk '{print $1}' | sort -r | while read mp

do

   echo ${mp}

   umount ${mp}

done

 

HTH;

 

Doug O'Leary


------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
Valued Contributor
Naj
Posts: 169
Registered: ‎06-16-2011
Message 4 of 12 (538 Views)

Re: find if under one filesystem other filesystems are mounted

Hi,

I agree with Dennis, you may look into both file

____________________________________________
:: Really appreciate if you could assign some points.
:: Don't know how to assign point? Click the KUDOS! star!
Acclaimed Contributor
James R. Ferguson
Posts: 21,184
Registered: ‎07-06-2000
Message 5 of 12 (533 Views)

Re: find if under one filesystem other filesystems are mounted


support_billa wrote:


i learned :  inode number 2  is a mounted filesystem , right ?


This is correct.

 

Regards!

 

...JRF...

Acclaimed Contributor
Dennis Handly
Posts: 25,063
Registered: ‎03-06-2006
Message 6 of 12 (526 Views)

Re: find if under one filesystem other filesystems are mounted

>I learned: inode number 2  is a mounted filesystem, right?

 

I'm not sure how useful this will be for you.  While you could do "ll -i /" to find all of the mounted filesystems under /, looking deeper will be a waste of time.

Honored Contributor
Johnson Punniyalingam
Posts: 2,246
Registered: ‎09-22-2008
Message 7 of 12 (521 Views)

Re: find if under one filesystem other filesystems are mounted

You can check  /etc/fstab . more over if the /etc/fstab has been updated promptly by (Sysadmin) if some have mounted it manually. you refer to /etc/mnttab

 

Best Regards,

Johnson

Problems are common to all, but attitude makes the difference
HP Pro
Hiren N Dave
Posts: 98
Registered: ‎04-10-2006
Message 8 of 12 (514 Views)

Re: find if under one filesystem other filesystems are mounted

>> when i want to umount /filesystem? , i got following message : >> umount: cannot unmount /dev/vg/lvol_fs : Device busy

 

You can check current processes which are using this mount point using this command

 

# fuser -cu /mount_point

 

Regards,

HD

I am an HP Employee

Was this post useful? - You may click the KUDOS! star to say thank you.
Valued Contributor
support_billa
Posts: 192
Registered: ‎06-27-2011
Message 9 of 12 (499 Views)

Re: find if under one filesystem other filesystems are mounted

hello,

 

/etc/mnttab is a very good idea, here can i find all mounted filesystems (like mount -p )

when i want to "grep" with a reg expr. then i can see also if under a filesystem other filesystems are mounted ?

 

like : grep "/testfs" /etc/mnttab | wc -l ?

 

with a script  umount all other filesystems  is a good solution, but not for my case usable.

 

regards



Valued Contributor
support_billa
Posts: 192
Registered: ‎06-27-2011
Message 10 of 12 (489 Views)

Re: find if under one filesystem other filesystems are mounted

here my idea to search for filesystem(s) in /etc/mnttab with help from replace a string with "/" in a variable

 

awk -v FSYS="/filesystem" 'BEGIN {found=0} $2 ~ ("^"FSYS) { found=found+1 } END {print found}' /etc/mnttab


this show show following  filesystem(s) 

/filesystem
/filesystem/fs1
/filesystem/fs2

 

regards

Acclaimed Contributor
Dennis Handly
Posts: 25,063
Registered: ‎03-06-2006
Message 11 of 12 (476 Views)

Re: find if under one filesystem other filesystems are mounted

You may want to do a better job matching

awk -v FSYS="/filesystem" '
BEGIN {found=0}
$2 == FSYS || $2 ~ ("^" FSYS "/") {
   found += 1
   print $0
}
END { print found }' /etc/mnttab

 

Valued Contributor
support_billa
Posts: 192
Registered: ‎06-27-2011
Message 12 of 12 (470 Views)

Re: find if under one filesystem other filesystems are mounted

great , you improve my awk so perfect that i have following idea :

 

when i have  following  filesystem(s) 

/filesystem
/filesystem/fs1
/filesystem/fs2

 

and i want to umount /filesystem , so i have to search for :

/filesystem/fs1
/filesystem/fs2

 

with

 

awk -v FSYS="/filesystem" '
BEGIN {found=0}
$2 ~ ("^" FSYS "/") {
   found += 1
   print $0
}
END { print found }' /etc/mnttab


 

Spoiler
 

 

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.