LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 12: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, 12:31 AM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
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, 12: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, 02:15 AM   #4
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
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, 06: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, 09: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: 234Reputation: 234Reputation: 234
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, 12: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, 04:25 AM   #8
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
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, 04: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, 04:36 AM   #10
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
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, 05: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, 06:26 AM   #12
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
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 06:28 AM.
 
Old 06-19-2007, 06: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, 08: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, 08:44 AM   #15
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
"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



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 04:03 AM
kubuntu problem with /var filesystem ...help wearydrone Ubuntu 4 01-19-2006 07:04 AM
umount /var device is busy (unclean shutdown) feetyouwell Linux - Software 3 09-13-2004 06:18 PM
umount /var device busy winchester169 Linux - Networking 1 06-25-2004 07:53 PM
Repair damaged /var filesystem davep911 Linux - Newbie 1 06-04-2004 08:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 02:01 AM.

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
Open Source Consulting | Domain Registration