header pictures for dedicated hosting services header image of world
Guests Visit the FreeBSD Forums  •  Login to the FreeBSD Forums  •  Register for FREE

var not writeable

 
Thread Tools Display Modes
  #16  
05-26-2006, 07:22 AM
floid vbmenu_register("postmenu_218266", true);
BSD n00b
 
Join Date: Feb 2006
Posts: 18
Quote:
I would recommend that you shut down all processes accessing /var


How can I do that? Should I guess, or is there any command that can do that?
Reply With Quote
  #17  
05-26-2006, 07:25 AM
 
tonyex vbmenu_register("postmenu_218267", true);
Port Monkey
 
Join Date: Feb 2003
Location: Sthlm, Sweden
Posts: 428
I would recommend that enter in single user mode before fixing problems with file systems, specially with an important one as /var.
Do a restart , then when bootloader with boot netbsd/freebsd press TAB and then write a -s after your kernel.

Another sexy way to do that is
modify : rc_configured=NO in rc.conf

do the work that has to be done and change

rc_configured=YES i rc.conf

By the way , u have to kill all the process that access /var to umount it.

try lsof to find with processes use it:

tonyex@antBSD #>lsof | grep /var

syslogd 635 root 3u unix 0xc0bab0d8 0t0 /var/run/log
syslogd 635 root 7w VREG 2910,833424 0 /var/log/messages
syslogd 635 root 8w VREG 2910,833424 0 /var/log/messages
syslogd 635 root 9w VREG 2910,833424 0 /var/log/messages
syslogd 635 root 10w VREG 1970,832936 0 /var/log/authlog
syslogd 635 root 11w VREG 2215,834120 0 /var/cron/log
syslogd 635 root 12w VREG 1973,832840 0 /var/log/xferlog
syslogd 635 root 13w VREG 794,789200 1 /var/log/lpd-errs
syslogd 635 root 14w VREG 2907,833520 0 /var/log/maillog
syslogd 635 root 15w VREG 2910,833424 0 /var/log/messages
xdm 981 root 2w VREG 226,833048 0 /var/log/xdm.log
cron 982 root cwd VDIR 3662,789136 10 /var/cron
xdm 988 root 2w VREG 226,833048 0 /var/log/xdm.log
xconsole 989 root 1w VREG 226,833048 0 /var/log/xdm.log
xconsole 989 root 2w VREG 226,833048 0 /var/log/xdm.log
XFree86 1016 root 2w VREG 226,833048 0 /var/log/xdm.log
mgt-pty-h 1054 s74673 5w VREG 1588,833708 0 /var/log/lastlog
mgt-pty-h 1054 s74673 8w VREG 1588,833708 0 /var/log/lastlog
dhclient 1439 root 4w VREG 40,832680 0 /var/db/dhclient.leases

the process id is the second column in the output.

and then kill them all. It can be hard but is possible, that why single user mode is much more safer.

Reg /T
__________________
...Ignorance can kill, ...Intelligence can save.

Last edited by tonyex : 05-26-2006 at 07:31 AM.
Reply With Quote
  #18  
05-26-2006, 07:35 AM
floid vbmenu_register("postmenu_218270", true);
BSD n00b
 
Join Date: Feb 2006
Posts: 18
thanx, but the problem is that I don't have direct access to the box, it is located in a data centre. Remote hands will cost me a lot of money...
Reply With Quote
  #19  
05-26-2006, 07:38 AM
floid vbmenu_register("postmenu_218271", true);
BSD n00b
 
Join Date: Feb 2006
Posts: 18
Is there maybe any way to force fsck to be ran also on partitions markes as clean on startup (like the -f option)? As i said, it seems that fsck is skipping for /var now.
Reply With Quote
  #20  
05-26-2006, 07:43 AM
floid vbmenu_register("postmenu_218273", true);
BSD n00b
 
Join Date: Feb 2006
Posts: 18
alright, I installed lsof, killed all processes that are displayed to access /var, but I'm still getting the device busy message...
Reply With Quote
  #21  
05-26-2006, 08:19 AM
 
halber_mensch vbmenu_register("postmenu_218276", true);
Port Monkey
 
Join Date: Feb 2004
Location: Stillwater, OK
Posts: 431
Send a message via AIM to halber_mensch
Unmount /dev/md0 before attempting to unmount /dev/ad0s1d; Since /dev/ad0s1d was mounted to /var prior to /dev/md0 being mounted to /var, I think you're being prevented from pulling the rug out from under /dev/md0's feet.
__________________
)-(alber(V)ensch
Reply With Quote
  #22  
05-26-2006, 08:28 AM
floid vbmenu_register("postmenu_218278", true);
BSD n00b
 
Join Date: Feb 2006
Posts: 18
Quote:
Originally Posted by halber_mensch
Unmount /dev/md0 before attempting to unmount /dev/ad0s1d; Since /dev/ad0s1d was mounted to /var prior to /dev/md0 being mounted to /var, I think you're being prevented from pulling the rug out from under /dev/md0's feet.


still the same (device busy)
Reply With Quote
  #23  
05-26-2006, 10:13 AM
floid vbmenu_register("postmenu_218291", true);
BSD n00b
 
Join Date: Feb 2006
Posts: 18
I have risked to umount the broken partition now with the -f flag, and ran fsck. Here's the output:


Quote:
fsck -f /dev/ad0s1d
** /dev/ad0s1d
** Last Mounted on /var
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
UNREF FILE I=104300 OWNER=root MODE=100644
SIZE=18 MTIME=May 26 17:30 2006
RECONNECT? [yn] y

NO lost+found DIRECTORY
CREATE? [yn] y

fsck_ufs: bad inode number 0 to ginode


What does that mean? Anything I can do about this?
Reply With Quote
  #24  
05-26-2006, 11:32 AM
floid vbmenu_register("postmenu_218296", true);
BSD n00b
 
Join Date: Feb 2006
Posts: 18
Seems like I'm just talking to myself anyway, but again an update: I managed to run fsck now on the broken partition, and it actually fixed the file system. The new output of fsck is now:

Quote:
fsck /dev/ad0s1d
** /dev/ad0s1d (NO WRITE)
** Last Mounted on /var
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
259070 files, 680738 used, 295813 free (42093 frags, 31715 blocks, 4.3% fragmentation)


As you see, no errors anymore, but still read-only! Also, no more unusal errors in dmesg. I going crazy here, is there anything left that I can do?
Reply With Quote
  #25  
05-26-2006, 11:50 AM
 
tonyex vbmenu_register("postmenu_218298", true);
Port Monkey
 
Join Date: Feb 2003
Location: Sthlm, Sweden
Posts: 428
I dont know what it means try google for instance.
I think that it has to do with some data failure or in the worst case drive failure.

In the last case u have to log on physically to the box ,I'm afraid.

Why do not try a restart, i think in netbsd tthere is an option in rc.conf that can fsck the partitions at boot.

Like this: fsck_flags=-y in /etc/rc.conf

and reboot
----
fsck_flags A string. A file system is checked with fsck(8) during
boot before mounting it. This option may be used to
override the default command-line options passed to the
fsck(8) program.

When set to -y, fsck(8) assumes yes as the answer to all
operator questions during file system checks. This might
be important with hosts where the administrator does not
have access to the console and an unsuccessful shutdown
must not make the host unbootable even if the file system
checks would fail in preen mode.
----

http://netbsd.gw.com/cgi-bin/man-cgi?rc.conf++NetBSD-current

This option exists in free as well, but perhaps in a different way.

Reg /T
__________________
...Ignorance can kill, ...Intelligence can save.

Last edited by tonyex : 05-26-2006 at 12:04 PM.
Reply With Quote
  #26  
05-26-2006, 12:08 PM
floid vbmenu_register("postmenu_218302", true);
BSD n00b
 
Join Date: Feb 2006
Posts: 18
actually i already tried what you suggested, tonyex. No success
Reply With Quote
  #27  
05-26-2006, 12:43 PM
floid vbmenu_register("postmenu_218307", true);
BSD n00b
 
Join Date: Feb 2006
Posts: 18
What about adding the -f mount option to fstab like this:

Quote:
# Device Mountpoint FStype Options Dump Pass#
/dev/ad0s1b none swap sw 0 0
/dev/ad0s1a / ufs rw 1 1
/dev/ad0s1e /tmp ufs rw 2 2
/dev/ad0s1f /usr ufs rw 2 2
/dev/ad0s1d /var ufs rw,f 2 2
/dev/acd0 /cdrom cd9660 ro,noauto 0 0


Could that work?
Reply With Quote
  #28  
05-28-2006, 11:52 PM
 
tonyex vbmenu_register("postmenu_218542", true);
Port Monkey
 
Join Date: Feb 2003
Location: Sthlm, Sweden
Posts: 428
If my sugestion didnt work,
the rc.configured one works on most cases,
then you have to physically login and restart in singel user mode.

Reg / T
__________________
...Ignorance can kill, ...Intelligence can save.

 

 

Looking for our FreeBSD Forums? We have moved them off our main page,just follow the link to our FreeBSD Forums page.


Copyright © 2009, WEBSERVER CONSUMER GUIDE

Privacy Policy

Please note:
(1) FreeBSD is a registered trademark of The FreeBSD Foundation.
(2) WEBSERVER CONSUMER GUIDE is in no way affiliated with The FreeBSD Foundation