Operating System - HP-UX
1832891 Members
2596 Online
110048 Solutions
New Discussion

Re: mounting a file system

 
SOLVED
Go to solution
Shivkumar
Super Advisor

mounting a file system

can we unmount a file system without going into single user mode ?
22 REPLIES 22
Jeff_Traigle
Honored Contributor
Solution

Re: mounting a file system

Of course... as long as no process has a file open on the file system.
--
Jeff Traigle
DCE
Honored Contributor

Re: mounting a file system

Yes you can, as long as there are no open files in the mount point. If it will not unmount (file system busy error message) you can use fuser or lsof to determine which processes have the open files, and either stop or kill them.

James R. Ferguson
Acclaimed Contributor

Re: mounting a file system

Hi Shiv:

Yes. Make sure that you have not 'cd'-ed into the directory (mountpoint) that you are trying to unmount. If you have, you will be denied the action for "device busy".

You can use 'fuser' to see and optionally kill processes with open files in the directory hosting the mount.

Of course, you should *gracefully* stop all processes whenever possible! Running normal shutdown scripts is appropriate. For instanace:

# fuser -ku /dev/dsk/cXtYdZ
# fuser -ku /mountpoint

...sends a 'kill -9' to every process running with inuse files in the directory. This is *not* a nice thing to do. A 'kill -9' doesn't allow any cleanup of temporary files and/or shared memory segments to be made by the killed process.

Regards!

...JRF...
Pete Randall
Outstanding Contributor

Re: mounting a file system

Some file systems are simply *always* in use. That's when you need to go into single user mode to work on them. The rest, as long as no one is accessing them (either has a file open or is cd'd into them) can be unmounted without problem.


Pete

Pete
Geoff Wild
Honored Contributor

Re: mounting a file system

fuser -cu /mountpoint

to see what processes are using it.

Then you can decide what they are before you attempt to kill them.

Example - you won't be able to unmount / and /tmp and /var and /usr

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Raj D.
Honored Contributor

Re: mounting a file system

Sure , if there is no file open we can unmount it.

1. Check if any file open for that FS.
# fuser -cu /FS_NAME

2. If nothing is there you can simply unmount it with umount command.

Else use # fuser -ku /FS_NAME to kill the processes if required.

And then use umount.


You cannot unmount /(root) , /stand , /usr , /opt , /var , as this are using system files/libraries, on multiuser mode.


Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Indrajit_1
Valued Contributor

Re: mounting a file system

Hi;
Yes u can do it until and unless it is not a root file system
Do the following steps

#bdf |grep -i
#fuser -cu

for example.. (fuser -cu /export/home)
if any body has logged in, cann't unmount the filesystem.. so

#fuser -ku
(i.e fuser -ku /export/home)
#umount /export/home

Hope it will help u to resolve ur issue..

cheers
indrajit
Never Ever Give Up
Hoang Chi Cong_1
Honored Contributor

Re: mounting a file system

Yes! You can do it if there isn't any open file in that filesystem or any process access in!
To check for this, use "fuser -cu /filesystem" and you can see all of processes.
To kill them, use "fuser -kcu /filesystem"
Then you can umount it!

Remember: some filesystems call "sensitive" that if you try to unmout it, your system or application may get trouble because there are some system's process are runing on like /var, /opt, /usr....

Goodluck
Hoang Chi Cong
Looking for a special chance.......
Shameer.V.A
Respected Contributor

Re: mounting a file system

Hi Shiv,

Yes you can unmount a filesystem, if it i snot being used by any application.

You should not be within the filesystem, otherwise it will give device busy error.

You can check for any open file through fuser command

You can't unmount system filesystem like /, opt, /usr.

Regards,

Shameer
.... See invisible, feel intangible and achieve impossible as everything is possible ....
Arunvijai_4
Honored Contributor

Re: mounting a file system

Hi Shiv,

Two things to ensure before unmounting any FS.

1) Don't be in that FS any more. "cd" to any other directories.

2) Shutdown or kill all the processes using that particular FS.

Useful commands,
# fuser -u will list the processes using

# fuser -ku will clean up

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Yogeeraj_1
Honored Contributor

Re: mounting a file system

hi,

also if you are unmounting it for good, don't forget to update your fstab file.


kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Sivakumar TS
Honored Contributor

Re: mounting a file system

Hi,

It is quite OK to unmount a filesystem as long as it is not in USE. NO NEED to enter in to single user mode.

If you want to kill all the process which uses the particular filesystem,

#fuser -ku

With REgards,

Siva.
Nothing is Impossible !
Devender Khatana
Honored Contributor

Re: mounting a file system

Hi Shiv,

Was not it about a OS filesystem like /var , /usr etc?

If yes, then ofcourse you will have to boot to single user mode where by default these file systems will notbe mounted and you can perform some offline activities like extending etc.

For a normal file system like some non OS file system in vg00 or any file system in some other vg, unless the file systems is inuse by any process, you can very well unmount it.

HTH,
Devender
Impossible itself mentions "I m possible"
Arunvijai_4
Honored Contributor

Re: mounting a file system

Hi Shiv,

Ofcourse, you can unmount /var, /usr, /opt when you logged in multi user mode.

http://docs.hp.com/en/B2355-90672/ch04s07.html

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Raj D.
Honored Contributor

Re: mounting a file system

Arun,
Just wondering if anyone has unmounted /usr filesytem in a running system.

If yes , what is the procedure , however there no much details in the document.

hth,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Jeff_Traigle
Honored Contributor

Re: mounting a file system

You can't umount /usr in multi-user mode. (Well, technically, I guess you could if you stopped all of the daemons that get started that have /usr as their home file system... but, if you go to that trouble, you might as well go to single-user in the first place. :)
--
Jeff Traigle
Steven E. Protter
Exalted Contributor

Re: mounting a file system

Shalom,

if you have done this:

mount /cdrom

cd /cdrom

# launched a process like the Oracle installer.

There is NO way to umount the cdrom until that process has been killed.

fuser -cuk /cdrom

That will kill the processes, perhaps the system(though the later is very unlikely) and then you should be able to umount the cdrom

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Raj D.
Honored Contributor

Re: mounting a file system

Unmounting system specific filesystems like /usr and /opt , seems cannot be done on multiuser mode. Even if we use fuser -ku or anyother trick.

hth,
Raj.

" If u think u can , If u think u cannot , - You are always Right . "
Devender Khatana
Honored Contributor

Re: mounting a file system

Hi,

One can not unmount /opt, /tmp, /var etc. file systems in multiuser mode inspite of closing all the applications. Reason being that the various processes started during bootup are still running and have files open in these file systems.

The link mentioned above nowhere states that you can unmount these file systems.

HTH,
Devender
Impossible itself mentions "I m possible"
Arunvijai_4
Honored Contributor

Re: mounting a file system

Hi All,

My bad, It should be "can't". Just a bad typo there.

With apologies,
Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Cem Tugrul
Esteemed Contributor

Re: mounting a file system

Hi Shiv,

As you seen it depends on "which filesystem"!!!
/opt /tmp /usr /var can not umounted in multiusermode

if you try the probably you can see such a kind of message on youy system;

baan02:/#umount /tmp
umount: cannot unmount /tmp : Device busy
umount: return error 1.

good Luck,
Our greatest duty in this life is to help others. And please, if you can't
Cem Tugrul
Esteemed Contributor

Re: mounting a file system

Hi Shiv,

As you seen it depends on "which filesystem"!!!
/opt /tmp /usr /var can not umounted in multiusermode

if you try then probably you can see such a kind of message on your system;

baan02:/#umount /tmp
umount: cannot unmount /tmp : Device busy
umount: return error 1.

good Luck,
Our greatest duty in this life is to help others. And please, if you can't