linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Cutting power without breaking RAID
@ 2006-06-28 21:43 Niccolo Rigacci
  2006-06-29  1:03 ` Tim
  2006-06-29  4:00 ` Neil Brown
  0 siblings, 2 replies; 9+ messages in thread
From: Niccolo Rigacci @ 2006-06-28 21:43 UTC (permalink / raw)
  To: linux-raid maillist

Hello,

I'm facing this problem:

when my Linux box detects a POWER FAIL event from the UPS, it 
starts a normal shutdown. Just before the normal kernel poweroff, 
it sends to the UPS a signal on the serial line which says 
"cut-off the power to the server and switch-off the UPS".

This is required to reboot the server as soon as the power is 
restored.

The problem is that the root partition is on top of a RAID-1 
filesystem which is still mounted when the program that kills the 
power is run, so the system goes down with a non clean RAID 
volume.

What can be the proper action to do before killing the power to 
ensure that RAID will remain clean? It seems that remounting 
the partition read-only is not sufficient.

-- 
Niccolo Rigacci
Firenze - Italy

Iraq, missione di pace: 38475 morti - www.iraqbodycount.net

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Cutting power without breaking RAID
  2006-06-28 21:43 Cutting power without breaking RAID Niccolo Rigacci
@ 2006-06-29  1:03 ` Tim
  2006-06-29  9:45   ` Niccolo Rigacci
  2006-07-05 21:25   ` Molle Bestefich
  2006-06-29  4:00 ` Neil Brown
  1 sibling, 2 replies; 9+ messages in thread
From: Tim @ 2006-06-29  1:03 UTC (permalink / raw)
  To: Niccolo Rigacci; +Cc: linux-raid maillist

Your UPS won't accept a timer value to wait before actually cutting
power? That would probably be ideal, issue the power off command with
something like a 30 second timeout, which would give the system time to
power off cleanly first.

-Tim

Niccolo Rigacci wrote:
> Hello,
>
> I'm facing this problem:
>
> when my Linux box detects a POWER FAIL event from the UPS, it 
> starts a normal shutdown. Just before the normal kernel poweroff, 
> it sends to the UPS a signal on the serial line which says 
> "cut-off the power to the server and switch-off the UPS".
>
> This is required to reboot the server as soon as the power is 
> restored.
>
> The problem is that the root partition is on top of a RAID-1 
> filesystem which is still mounted when the program that kills the 
> power is run, so the system goes down with a non clean RAID 
> volume.
>
> What can be the proper action to do before killing the power to 
> ensure that RAID will remain clean? It seems that remounting 
> the partition read-only is not sufficient.
>
>   


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Cutting power without breaking RAID
  2006-06-28 21:43 Cutting power without breaking RAID Niccolo Rigacci
  2006-06-29  1:03 ` Tim
@ 2006-06-29  4:00 ` Neil Brown
  2006-06-29  9:48   ` Niccolo Rigacci
  1 sibling, 1 reply; 9+ messages in thread
From: Neil Brown @ 2006-06-29  4:00 UTC (permalink / raw)
  To: Niccolo Rigacci; +Cc: linux-raid maillist

On Wednesday June 28, niccolo@rigacci.org wrote:
> Hello,
> 
> I'm facing this problem:
> 
> when my Linux box detects a POWER FAIL event from the UPS, it 
> starts a normal shutdown. Just before the normal kernel poweroff, 
> it sends to the UPS a signal on the serial line which says 
> "cut-off the power to the server and switch-off the UPS".
> 
> This is required to reboot the server as soon as the power is 
> restored.
> 
> The problem is that the root partition is on top of a RAID-1 
> filesystem which is still mounted when the program that kills the 
> power is run, so the system goes down with a non clean RAID 
> volume.
> 
> What can be the proper action to do before killing the power to 
> ensure that RAID will remain clean? It seems that remounting 
> the partition read-only is not sufficient.

Are you running a 2.4 kernel or a 2.6 kernel?

With 2.4, you cannot do what you want to do.

With 2.6, 
   killall -9 md0_raid1

should do the trick (assuming root is on /dev/md0.  If it is elsewhere,
choose a different process name).
After you "kill -9" the raid thread, the array will be marked clean
immediately all writes complete, and marked dirty again before
allowing another write.

NeilBrown

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Cutting power without breaking RAID
  2006-06-29  1:03 ` Tim
@ 2006-06-29  9:45   ` Niccolo Rigacci
  2006-06-30  0:50     ` alexwang.com (sent by Nabble.com)
  2006-07-05 21:25   ` Molle Bestefich
  1 sibling, 1 reply; 9+ messages in thread
From: Niccolo Rigacci @ 2006-06-29  9:45 UTC (permalink / raw)
  To: Tim; +Cc: linux-raid maillist

On Wed, Jun 28, 2006 at 06:03:01PM -0700, Tim wrote:
> Your UPS won't accept a timer value to wait before actually cutting
> power?

Unfortunately my UPS des not!

-- 
Niccolo Rigacci
Firenze - Italy

Iraq, missione di pace: 38725 morti - www.iraqbodycount.net

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Cutting power without breaking RAID
  2006-06-29  4:00 ` Neil Brown
@ 2006-06-29  9:48   ` Niccolo Rigacci
  2006-06-29 18:50     ` Bill Davidsen
  0 siblings, 1 reply; 9+ messages in thread
From: Niccolo Rigacci @ 2006-06-29  9:48 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-raid maillist

On Thu, Jun 29, 2006 at 02:00:09PM +1000, Neil Brown wrote:
> With 2.6, 
>    killall -9 md0_raid1
> 
> should do the trick (assuming root is on /dev/md0.  If it is elsewhere,
> choose a different process name).

Thanks, this is what I was looking for!

I will try remounting read-only and killing the md0_raid1.
I will keep you informed.

-- 
Niccolo Rigacci
Firenze - Italy

Iraq, missione di pace: 38725 morti - www.iraqbodycount.net

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Cutting power without breaking RAID
  2006-06-29  9:48   ` Niccolo Rigacci
@ 2006-06-29 18:50     ` Bill Davidsen
  2006-06-30  1:53       ` Neil Brown
  0 siblings, 1 reply; 9+ messages in thread
From: Bill Davidsen @ 2006-06-29 18:50 UTC (permalink / raw)
  To: Niccolo Rigacci; +Cc: Neil Brown, linux-raid maillist

Niccolo Rigacci wrote:

>On Thu, Jun 29, 2006 at 02:00:09PM +1000, Neil Brown wrote:
>  
>
>>With 2.6, 
>>   killall -9 md0_raid1
>>
>>should do the trick (assuming root is on /dev/md0.  If it is elsewhere,
>>choose a different process name).
>>    
>>
>
>Thanks, this is what I was looking for!
>
>I will try remounting read-only and killing the md0_raid1.
>I will keep you informed.
>
>  
>
Why should this trickery be needed? When an array is mounted r/o it 
should be clean. How can it be dirty. I assume readonly implies noatime, 
I mount physically readonly devices without explicitly saying noatime 
and nothing whines.

-- 
bill davidsen <davidsen@tmr.com>
  CTO TMR Associates, Inc
  Doing interesting things with small computers since 1979


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Cutting power without breaking RAID
  2006-06-29  9:45   ` Niccolo Rigacci
@ 2006-06-30  0:50     ` alexwang.com (sent by Nabble.com)
  0 siblings, 0 replies; 9+ messages in thread
From: alexwang.com (sent by Nabble.com) @ 2006-06-30  0:50 UTC (permalink / raw)
  To: linux-raid


Looks impossible UPS design to me. May I ask what UPS do you use?

My APC smart UPS does has a timer, so PC can send command "shut the UPS down
after 30 seconds" and then shutdown itself.
-- 
View this message in context: http://www.nabble.com/Cutting-power-without-breaking-RAID-tf1864273.html#a5113118
Sent from the linux-raid forum at Nabble.com.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Cutting power without breaking RAID
  2006-06-29 18:50     ` Bill Davidsen
@ 2006-06-30  1:53       ` Neil Brown
  0 siblings, 0 replies; 9+ messages in thread
From: Neil Brown @ 2006-06-30  1:53 UTC (permalink / raw)
  To: Bill Davidsen; +Cc: Niccolo Rigacci, linux-raid maillist

On Thursday June 29, davidsen@tmr.com wrote:
> Why should this trickery be needed? When an array is mounted r/o it 
> should be clean. How can it be dirty. I assume readonly implies noatime, 
> I mount physically readonly devices without explicitly saying noatime 
> and nothing whines.

The 'filesystem' is mounted r/o.  The 'array' is not read-only, and
you cannot set an array to read-only while a filesystem is mounted
(because the array cannot tell that the mount is read-only).

A little while after the last write, an array will mark itself as
clean.  The effect of the 'kill -9', is to reduce this 'little while'
to 0.

So 
  remount readonly
  wait a little while
  kill machine 

would work too.

NeilBrown

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Cutting power without breaking RAID
  2006-06-29  1:03 ` Tim
  2006-06-29  9:45   ` Niccolo Rigacci
@ 2006-07-05 21:25   ` Molle Bestefich
  1 sibling, 0 replies; 9+ messages in thread
From: Molle Bestefich @ 2006-07-05 21:25 UTC (permalink / raw)
  To: Tim; +Cc: Niccolo Rigacci, linux-raid maillist

Tim wrote:
> That would probably be ideal, issue the power off command with
> something like a 30 second timeout, which would give the system time to
> power off cleanly first.

I don't think that's ideal.
Many systems restore power to the last known state, thus powering off
cleanly would result in the machine not coming back up after the power
cycle.

Some machines can be changed to always power on in the BIOS.
If the server administrator remembers to do so, that is.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-07-05 21:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-28 21:43 Cutting power without breaking RAID Niccolo Rigacci
2006-06-29  1:03 ` Tim
2006-06-29  9:45   ` Niccolo Rigacci
2006-06-30  0:50     ` alexwang.com (sent by Nabble.com)
2006-07-05 21:25   ` Molle Bestefich
2006-06-29  4:00 ` Neil Brown
2006-06-29  9:48   ` Niccolo Rigacci
2006-06-29 18:50     ` Bill Davidsen
2006-06-30  1:53       ` Neil Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).