System Administration
Showing results for 
Search instead for 
Do you mean 

find if under one filesystem other filesystems are mounted

SOLVED
Go to Solution
Valued Contributor

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,                    

                                                              

11 REPLIES
Acclaimed Contributor Acclaimed Contributor

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 Honored Contributor

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
Highlighted
Valued Contributor

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 Acclaimed Contributor

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 Acclaimed Contributor

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 Honored Contributor

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
HPE Pro

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

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

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 Acclaimed Contributor

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

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