tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: swap-on-raidframe vs raidctl -P

On Tue, 22 Jan 2008, der Mouse wrote:
> Swap is on raid0b, and, when raidframeparity ran, it complained that
> raid0 parity was dirty and started a parity rewrite.

As others have mentioned, this happens because the kernel doesn't
unconfigure swap when in halts, so raid0b was still flagged as dirty
when the machine halted, which means that it needs to be rewritten on
the next boot.

A proper fix would involve making the kernel unconfigure more stuff
at halt time.  This would have to deal with arbitrary layering of

I have two workarounds:

  1) Don't ever just "halt" or "reboot"; always use shutdown(8).
     Leave do_rcshutdown=YES and swapoff=YES, as is the default in
     /etc/defaults/rc.conf.  Ensure that rc.d scripts associated
     with daemons that might end up using swap space all have
     "KEYWORD: shutdown", so that they get killed before rc.d/swap1
     tries to unconfigure swap.  If you swap to files, add "KEYWORD:
     shutdown" to /etc/rc.d/swap2.  There was a time when I had a custom
     rc.d/swap0 script that ran as late as possible on shutdown and
     looped trying to unconfigure all swap and kill things that seemed
     to be using swap, but I no longer do that.

  2) Put swap and filesystems on separate raid devices (not just in
     separate partitions of the same device).  Parity may still be dirty
     in the raid device used for swap, but at least the raid device used
     for file systems won't suffer.

> I see two possible fixes.
> One would be a way to configure raidframe for uses (like swap) that
> don't care about data preservation when the partition is not in use;
> [...]
> The other would be to run raidframeparity earlier, before swap is
> started.

I have also wanted both these.  I might once have implemented the
latter, but I don't remember.

--apb (Alan Barrett)

Home | Main Index | Thread Index | Old Index