LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices



Reply
 
Search this Thread
Old 06-18-2007, 01:02 AM   #1
raklo
Member
 
Registered: Apr 2006
Posts: 143

Rep: Reputation: 15
can i umount var filesystem??


hello,
i wanna umount the /var directory.ideally when i do that i will
show " device busy "
now if i kill all the processes that are working on the directory,
i should not get device busy error.
but how do i find ,which all processes are working on var directory???
so that i can kill them.

or is ther any other approach to it??

regards
rakesh
 
Old 06-18-2007, 01:31 AM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

Rep: Reputation: 162Reputation: 162
lsof can retrieve info on open files for a device - have you looked at man lsof yet to see if it does it in a way that you can use?
 
Old 06-18-2007, 01:53 AM   #3
raklo
Member
 
Registered: Apr 2006
Posts: 143

Original Poster
Rep: Reputation: 15
lsof gives me list of open files n sockets.
wot i want is list of processes that are working on /var directory,
i.e processes that are responsible for writing in /var/log/messages file
and all such other files.
so that if possible,i can kill them one by one to get out of device busy problem.

thanx for reply
regards
 
Old 06-18-2007, 03:15 AM   #4
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu
Posts: 1,457

Rep: Reputation: 104Reputation: 104
i dont know whehter it is a good idea to umount /var completely but maybe you can simply
umount -l /var
 
Old 06-18-2007, 07:30 AM   #5
FMC
Member
 
Registered: May 2007
Location: São Paulo
Distribution: Gentoo & Debian
Posts: 97

Rep: Reputation: 15
Tha magic command is fuser:
Code:
catunda@fabio ~ $ fuser -vm /
                     USER        PID ACCESS COMMAND
                     root          1 ....m init
                     root        949 ....m udevd
                     root       3371 ....m dhcpcd
                     root       4193 ....m sshd
                     nx         4199 ....m sshd
                     ...
[]´s, FMC!
 
Old 06-18-2007, 10:49 AM   #6
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 231Reputation: 231Reputation: 231
This would work on my MEPIS 3.3.2 system, if I let it.

The 1 tweak you might have to make is to adjust the field ("$9") that awk prints to your ver. of lsof.
Code:
dir='/var'
kill $(fuser `lsof $dir |awk '{print $9}'` 2>/dev/null)
If necessary, you make that kill -9.
 
Old 06-19-2007, 01:02 AM   #7
raklo
Member
 
Registered: Apr 2006
Posts: 143

Original Poster
Rep: Reputation: 15
many many thnx to all who replied.
but will the shell script that u've sent do that safely.
bcoz when i tried to kill processes that work on /var,
certain critical processes were killed and this led to an immediate logout.

though i m trying with ur alternative,if results come out ,will let u know.
 
Old 06-19-2007, 05:25 AM   #8
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 53
Why do you want to umount /var while running the system?
It's an essential directory..

You could go to runlevel 1 and unmount it, do your stuff, remount it and go back to your current runlevel.
 
Old 06-19-2007, 05:32 AM   #9
raklo
Member
 
Registered: Apr 2006
Posts: 143

Original Poster
Rep: Reputation: 15
i hv an embedded box that internally uses linux,
i m working on memory related issues,wherein i need
to think of alternatives to get up some more memory
if system goes out of memory,
so i m thinking of options that i can try,one of which is
getting space from /var.
i dont know whether this approach is correct or not,
nd ur feedback would be appreciated.
 
Old 06-19-2007, 05:36 AM   #10
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,805

Rep: Reputation: 324Reputation: 324Reputation: 324Reputation: 324
Quote:
so that if possible,i can kill them one by one to get out of device busy problem.
It might be more helpful to you if you told us more about the 'device busy' problem.
 
Old 06-19-2007, 06:01 AM   #11
raklo
Member
 
Registered: Apr 2006
Posts: 143

Original Poster
Rep: Reputation: 15
just type command
#umount /proc

or

#umount /var

n u will get a message
device is busy

this is wot device busy problem is all about.
 
Old 06-19-2007, 07:26 AM   #12
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 53
Unmounting /var will not change anything to disk space (you are mixing memory:RAM and disk space)
Unmounting will remove the hard disk partition /var from the filesystem hierarchy. The space will not be freed.

It all depends on what embend device you are working on.

You could completely remove /var. Because

-> The system is stable and you don't need any log anymore to analyze problems. /var keeps the logfile so it's interesting in case of crash
-> The system is not security-sensitive. /var also contains all connection access made to the board.
-> Most important: it is on flash. flash has limited Read/Write number. Every time somebody would connect to the webserver on the board for example, linux will happily write one line in /var/something. This is unacceptable for flash memory.

As said, remove /var completly. rm it and remove it from fstab. Then you have a new partition.
Or you have a running process that deletes some big uneeded files every xx hours/days.

Last edited by nx5000; 06-19-2007 at 07:28 AM.
 
Old 06-19-2007, 07:36 AM   #13
FMC
Member
 
Registered: May 2007
Location: São Paulo
Distribution: Gentoo & Debian
Posts: 97

Rep: Reputation: 15
Thats true, if you unmount /var the space will still be used!

And if you have flash memory you should mount your /var on RAM memory space, this way you can access log files while the machine is up, or you can manage syslog to log on a remote machine, anyway, do not freak your flash memory with logs! lol

[]´s, FMC!
 
Old 06-19-2007, 09:11 AM   #14
raklo
Member
 
Registered: Apr 2006
Posts: 143

Original Poster
Rep: Reputation: 15
yes wot u said is rite,if i directly umount /var it wont help me at all as far as memory is concerned,
but wot if i systematically kill all the processes that
r working on /var, and that do not have dependencies on other processes
and then umount it????

wont that case help me to some extent???
 
Old 06-19-2007, 09:44 AM   #15
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 53
"Mounting" is a logical operation, not physical.

In general, you first physically create the partition by allocating space and then you need to mount it to "insert" it to your /

1) You can only clear (or format if you prefer) an unmounted partition.
2) You can only unmount a partition if no files are opened on it.

So unmount will help you for 1) but nothing else.

Putting it in RAM is another solution.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
reg: fuser & umount filesystem problem hinetvenkat Linux - Software 3 05-03-2007 05:03 AM
kubuntu problem with /var filesystem ...help wearydrone Ubuntu 4 01-19-2006 08:04 AM
umount /var device is busy (unclean shutdown) feetyouwell Linux - Software 3 09-13-2004 07:18 PM
umount /var device busy winchester169 Linux - Networking 1 06-25-2004 08:53 PM
Repair damaged /var filesystem davep911 Linux - Newbie 1 06-04-2004 09:09 AM


All times are GMT -5. The time now is 12:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration