Re: How to mark filesystem as unclean to force fsck on boot up?

2009-06-28 Thread Otto Moerbeek
On Sun, Jun 28, 2009 at 09:21:16AM +1000, Aaron Mason wrote:

 Hi,
 
 I made a slight change to the /etc/rc file that looks for the file
 /etc/force-fsck and if found, forces a check.  The patch follows:

Can you explain why you want this?

-Otto

 
 --- /etc/rc.old   Sat Jun 27 13:33:51 2009
 +++ /etc/rc   Sat Jun 27 14:19:06 2009
 @@ -202,7 +202,11 @@
   echo Fast boot: skipping disk checks.
  elif [ X$1 = Xautoboot ]; then
   echo Automatic boot in progress: starting file system checks.
 - fsck -p
 + if [ -f /etc/force-fsck ]; then
 + fsck -pf
 + else
 + fsck -p
 + fi
   case $? in
   0)
   ;;
 @@ -240,6 +244,7 @@
  mount -a -t nonfs,vnd
  mount -uw /  # root on nfs requires this, others aren't hurt
  rm -f /fastboot  # XXX (root now writeable)
 +rm -f /etc/force-fsck   # same as above
 
  random_seed
 
 
 
 On Sun, Jun 28, 2009 at 8:11 AM, Joachim
 Schipperjoac...@joachimschipper.nl wrote:
  On Sat, Jun 27, 2009 at 08:37:44PM +0100, Mikolaj Kucharski wrote:
  Is it possible?
 
  There is no /forcefsck mechanism for OpenBSD as there is for Linux, but
  fsck does take a -f option to force fsck, even if the filesystem is
  thought to be clean.
 
  You can boot to single user mode (boot -s) to do this. There are some
  complications if this is not possible (e.g. a server in a dedicated
  datacenter); are you in that situation? In other words, what are you
  *really* trying to do?
 
 Joachim
 
 
 
 
 
 --
 Aaron Mason - Programmer, open source addict
 - Oh, why does everything I whip leave me?



Re: How to mark filesystem as unclean to force fsck on boot up?

2009-06-28 Thread Joachim Schipper
On Sun, Jun 28, 2009 at 12:22:31AM +0100, Mikolaj Kucharski wrote:
 On Sun, Jun 28, 2009 at 12:11:31AM +0200, Joachim Schipper wrote:
  On Sat, Jun 27, 2009 at 08:37:44PM +0100, Mikolaj Kucharski wrote:
   Is it possible?
  
  There is no /forcefsck mechanism for OpenBSD as there is for Linux, but
  fsck does take a -f option to force fsck (...).
  
  You can boot to single user mode (boot -s) to do this. There are some
  complications if this is not possible (e.g. a server in a dedicated
  datacenter); are you in that situation? In other words, what are you
  *really* trying to do?
 
 I'm looking for /forcefsck equivalent. I just wanted to be sure that
 after reading all manuals there is really no such option to mark fs as
 unclean.

That is not really an answer; what *are* you really truing to do? There
might be a good way to do it on OpenBSD, but we can't really help you.

Of course, you may just have been curious; that'd be fine, too.

Joachim



Re: How to mark filesystem as unclean to force fsck on boot up?

2009-06-28 Thread Scott Barnett
Not sure why you would ever want to force a check. If there are problems on
boot i've never seen OBSD not fix them. I've had servers hit power cuts 3-5
times a day for a week and OBSD hasn't had a problem with it. Some of they
are still running now. I'd be suprised if forcing a check found anything a
miss.

2009/6/28 Joachim Schipper joac...@joachimschipper.nl

 On Sun, Jun 28, 2009 at 12:22:31AM +0100, Mikolaj Kucharski wrote:
  On Sun, Jun 28, 2009 at 12:11:31AM +0200, Joachim Schipper wrote:
   On Sat, Jun 27, 2009 at 08:37:44PM +0100, Mikolaj Kucharski wrote:
Is it possible?
  
   There is no /forcefsck mechanism for OpenBSD as there is for Linux, but
   fsck does take a -f option to force fsck (...).
  
   You can boot to single user mode (boot -s) to do this. There are some
   complications if this is not possible (e.g. a server in a dedicated
   datacenter); are you in that situation? In other words, what are you
   *really* trying to do?
 
  I'm looking for /forcefsck equivalent. I just wanted to be sure that
  after reading all manuals there is really no such option to mark fs as
  unclean.

 That is not really an answer; what *are* you really truing to do? There
 might be a good way to do it on OpenBSD, but we can't really help you.

 Of course, you may just have been curious; that'd be fine, too.

Joachim



Re: How to mark filesystem as unclean to force fsck on boot up?

2009-06-28 Thread Mikolaj Kucharski
On Sun, Jun 28, 2009 at 10:08:47AM +0200, Joachim Schipper wrote:
  I'm looking for /forcefsck equivalent. I just wanted to be sure that
  after reading all manuals there is really no such option to mark fs as
  unclean.
 
 That is not really an answer; what *are* you really truing to do? There
 might be a good way to do it on OpenBSD, but we can't really help you.

I want to force fsck on reboot without console access. Now I'm thinking
it would be not a good idea to have that option. For ppl which don't
have console access they will try force fsck and end up with interactive
prompt if something would go wrong. You really need to have console when
you want to fsck a filesystem. For me it's EOT. Sorry for the noise.

 Of course, you may just have been curious; that'd be fine, too.

Yes, I am.

-- 
best regards
q#



Re: How to mark filesystem as unclean to force fsck on boot up?

2009-06-28 Thread Joachim Schipper
On Sun, Jun 28, 2009 at 02:15:43PM +0100, Mikolaj Kucharski wrote:
 On Sun, Jun 28, 2009 at 10:08:47AM +0200, Joachim Schipper wrote:
   I'm looking for /forcefsck equivalent. I just wanted to be sure that
   after reading all manuals there is really no such option to mark fs as
   unclean.
  
  That is not really an answer; what *are* you really truing to do? There
  might be a good way to do it on OpenBSD, but we can't really help you.
 
 I want to force fsck on reboot without console access. Now I'm thinking
 it would be not a good idea to have that option. For ppl which don't
 have console access they will try force fsck and end up with interactive
 prompt if something would go wrong. You really need to have console when
 you want to fsck a filesystem. For me it's EOT. Sorry for the noise.

You can try fsck -fn. It even works on mounted filesystems. It won't fix
any issues, but it might tell you if there are any.

Just kill all processes save sshd, wait a bit, call sync(8) a couple of
times, and run it.

Joachim 



Re: How to mark filesystem as unclean to force fsck on boot up?

2009-06-28 Thread Mikolaj Kucharski
On Sun, Jun 28, 2009 at 04:01:00PM +0200, Joachim Schipper wrote:
 You can try fsck -fn. It even works on mounted filesystems. It won't fix
 any issues, but it might tell you if there are any.
 
 Just kill all processes save sshd, wait a bit, call sync(8) a couple of
 times, and run it.

I don't think I will go that way. `boot -s' is okay for me, I have
console access. I would suggest to run fsck on read-only mounted
filesystem if someone wants to check live partition.

Anyway thanks for help.

-- 
best regards
q#



How to mark filesystem as unclean to force fsck on boot up?

2009-06-27 Thread Mikolaj Kucharski
Is it possible?

-- 
best regards
q#



Re: How to mark filesystem as unclean to force fsck on boot up?

2009-06-27 Thread Joachim Schipper
On Sat, Jun 27, 2009 at 08:37:44PM +0100, Mikolaj Kucharski wrote:
 Is it possible?

There is no /forcefsck mechanism for OpenBSD as there is for Linux, but
fsck does take a -f option to force fsck, even if the filesystem is
thought to be clean.

You can boot to single user mode (boot -s) to do this. There are some
complications if this is not possible (e.g. a server in a dedicated
datacenter); are you in that situation? In other words, what are you
*really* trying to do?

Joachim



Re: How to mark filesystem as unclean to force fsck on boot up?

2009-06-27 Thread Mikolaj Kucharski
On Sun, Jun 28, 2009 at 12:11:31AM +0200, Joachim Schipper wrote:
 On Sat, Jun 27, 2009 at 08:37:44PM +0100, Mikolaj Kucharski wrote:
  Is it possible?
 
 There is no /forcefsck mechanism for OpenBSD as there is for Linux, but
 fsck does take a -f option to force fsck, even if the filesystem is
 thought to be clean.
 
 You can boot to single user mode (boot -s) to do this. There are some
 complications if this is not possible (e.g. a server in a dedicated
 datacenter); are you in that situation? In other words, what are you
 *really* trying to do?

I'm looking for /forcefsck equivalent. I just wanted to be sure that
after reading all manuals there is really no such option to mark fs as
unclean.

-- 
best regards
q#



Re: How to mark filesystem as unclean to force fsck on boot up?

2009-06-27 Thread Aaron Mason
Hi,

I made a slight change to the /etc/rc file that looks for the file
/etc/force-fsck and if found, forces a check.  The patch follows:

--- /etc/rc.old Sat Jun 27 13:33:51 2009
+++ /etc/rc Sat Jun 27 14:19:06 2009
@@ -202,7 +202,11 @@
echo Fast boot: skipping disk checks.
 elif [ X$1 = Xautoboot ]; then
echo Automatic boot in progress: starting file system checks.
-   fsck -p
+   if [ -f /etc/force-fsck ]; then
+   fsck -pf
+   else
+   fsck -p
+   fi
case $? in
0)
;;
@@ -240,6 +244,7 @@
 mount -a -t nonfs,vnd
 mount -uw /# root on nfs requires this, others aren't hurt
 rm -f /fastboot# XXX (root now writeable)
+rm -f /etc/force-fsck   # same as above

 random_seed



On Sun, Jun 28, 2009 at 8:11 AM, Joachim
Schipperjoac...@joachimschipper.nl wrote:
 On Sat, Jun 27, 2009 at 08:37:44PM +0100, Mikolaj Kucharski wrote:
 Is it possible?

 There is no /forcefsck mechanism for OpenBSD as there is for Linux, but
 fsck does take a -f option to force fsck, even if the filesystem is
 thought to be clean.

 You can boot to single user mode (boot -s) to do this. There are some
 complications if this is not possible (e.g. a server in a dedicated
 datacenter); are you in that situation? In other words, what are you
 *really* trying to do?

Joachim





--
Aaron Mason - Programmer, open source addict
- Oh, why does everything I whip leave me?



Re: How to mark filesystem as unclean to force fsck on boot up?

2009-06-27 Thread Aaron Mason
Ok, that patch won't work... get the patch at
http://jolt.thats-too-much.info/openbsd-rc-force-fsck.patch

On Sun, Jun 28, 2009 at 9:21 AM, Aaron Masonsimplersolut...@gmail.com
wrote:
 Hi,

 I made a slight change to the /etc/rc file that looks for the file
 /etc/force-fsck and if found, forces a check.  The patch follows:

 --- /etc/rc.old Sat Jun 27 13:33:51 2009
 +++ /etc/rc Sat Jun 27 14:19:06 2009
 @@ -202,7 +202,11 @@
echo Fast boot: skipping disk checks.
  elif [ X$1 = Xautoboot ]; then
echo Automatic boot in progress: starting file system checks.
 -   fsck -p
 +   if [ -f /etc/force-fsck ]; then
 +   fsck -pf
 +   else
 +   fsck -p
 +   fi
case $? in
0)
;;
 @@ -240,6 +244,7 @@
  mount -a -t nonfs,vnd
  mount -uw /# root on nfs requires this, others aren't hurt
  rm -f /fastboot# XXX (root now writeable)
 +rm -f /etc/force-fsck   # same as above

  random_seed



 On Sun, Jun 28, 2009 at 8:11 AM, Joachim
 Schipperjoac...@joachimschipper.nl wrote:
 On Sat, Jun 27, 2009 at 08:37:44PM +0100, Mikolaj Kucharski wrote:
 Is it possible?

 There is no /forcefsck mechanism for OpenBSD as there is for Linux, but
 fsck does take a -f option to force fsck, even if the filesystem is
 thought to be clean.

 You can boot to single user mode (boot -s) to do this. There are some
 complications if this is not possible (e.g. a server in a dedicated
 datacenter); are you in that situation? In other words, what are you
 *really* trying to do?

Joachim





 --
 Aaron Mason - Programmer, open source addict
 - Oh, why does everything I whip leave me?




--
Aaron Mason - Programmer, open source addict
- Oh, why does everything I whip leave me?