Subject: Re: Additional swap/dump magic
To: None <>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-userlevel
Date: 08/23/2006 18:59:32
> What I did is:
>  o A simple change to /etc/rc.d/swap1 using above enhancements so
>    that
>    - if any explicit swap or dump is configured in /etc/fstab
>      everything behaves exactly as it does now (i.e. keep status quo)
>    - if no swap or dump is configured in /etc/fstab, use the new
>      autodetect magic to activate all swap partitions and set a dump
>      device

> What do you think?

I think this is a great way to destroy someone's data partition that
happens to end up as a swap partition thanks to compatability code like
the code that understands Sun disklabels. :-)

Suggestion: if no_swap=YES, don't do the "-t auto" run, even if there's
no swap in fstab.  This doesn't cure the problem, of course (its
severest manifestations will be with "foreign" disks for which rc.conf
likely doesn't match the disk), but it should help with upgrades.

There would still be risk for some systems; in particular, someone with
a system depending on swap autoconfiguration and running fine connects
a legacy disk (eg, with a Sun disklabel and no BSD disklabel) to futz
with it and thereby manages to destroy one of its partitions by
swapping on it.  (Of course, this is a risk only when the swap
partition contains something precious, which is probably a relatively
rare case because that would normally be a swap partition on the legacy
OS as well.  But the risk, even if small, is definitely nonzero.)

Further suggestion: never autoconfigure swap on disks that are
hardwarily read-only.  (I'm not sure how to detect this; if we can't
detect it, this isn't a very good suggestion.  Perhaps, before enabling
swapping anywhere, try writing to the first block?  I suppose that
suggestion belongs on tech-kern, not here.)

Is the risk worth the benefit?  Personally, I think it is not, but that
doesn't mean much.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B