Thermodynamic equilibrium criterion I have a question about a characterization of thermodynamic equilibrium as given on German wiki article: https://de.wikipedia.org/wiki/Thermodynamisches_Gleichgewicht#Abgeschlossenes_System
What does it state? Let $S=S(U, V, N)$ the entropy and the expression $S=S(U, V, N)$ make sense as well a state with macroscopical parameters $U,V,N$ is in thermodynamical equilibrium. The claim is

"Ein abgeschlossenes System befindet sich im thermodynamischen Gleichgewicht, wenn seine Entropie $S$ maximal ist. Entsprechend gilt, für das Differential
$$dS=0$$

Translated that means

A closed system is in thermodynamic equilibrium when its entropy $S$ is at a maximum. For the differential this means $dS=0$.

And the last condition I not understand. By definition writing $S= S(U,V,N)$ (or for any other arbitrary thermodynamic potential e.g. internal energy $U(S,V,N)$ or free Helmholtz $F(T,V,N)$)
makes only sense if the given state parametrized by macro parameters $U,V,N$ is already in thermodynamic equilibrium. Otherwise, $S= S(U,V,N)$ don't make any sense as a thermodynamical system that is not in a thermodynamic equilibrium is too complex to be described by only three independent macro parameters $U, V,N$ and futhermore the concept of associating a thermodynamical potential to a state only works if one consider a state beeing already in equilibrium.
Therefore what is $dS=0$ (or more precisely how to interpret it in this context?) and why does it make sense to use it as characterization of equilibrium?
The only way I'm familar how the differential $dS$ is used in thermodynamics is explaned in following setting. We start with a state parametrized by $(U_1,V_1,N_1)$ that is already in thermodynamic equilibrium and then we start a certain thermodynamical process (reversible or irreversible) that finally brings the system in another state $(U_2,V_2,N_2)$ that is also in a new thermodynamical equilibrium after a long time.
The point is that how we pass from $(U_1,V_1,N_1)$ to $(U_2,V_2,N_2)$ we don't know precisely as in nature we pass during the process non equilibrium states that we can't describe with our formalism. One possible ansatz is to consider it a sequence of  quastatical processes such that each intermediate state is assumed to be also in thermodynamical equilibrium. This is of course a strong idealisation.
With this idealization passing from $(U_1,V_1,N_1)$ to $(U_2,V_2,N_2)$ can be indeed visualized as a curve in Phase space as long as we consider it as a quasistatic process.
then indeed also the expression $dS= S(U_2,V_2,N_2)-S(U_1,V_1,N_1) $ make sense.
But in this case it makes no sense to use $dS=0$ as characterization of a state beeing in themodynamic equilibrium as by $dS$ we consider allways diferences of enropies of states that are already in equilibriums.
Does anybody have an idea how the "characterization thermodynamic of quilibrium" $dS=0$ should here be understood and what is the error in my reasonings above?
 A: Let us imagine a box of gas in equilibrium with volume $V$ and energy $U$. And let there be a heat conducting piston that divides the volume into two parts, $V_1 = αV$ and $V_2 = (1 − α)V$. They are at some common temperature $T_1 = T_2 = T$, but not necessarily at a common pressure. The system is forced into equilibrium despite this due to a constraint, holding the piston in place. Since entropy is additive, the entropy of the combined system is just the sum:
$$S=S_1\left(V_1\right)+S_2\left(V_2\right)=S(αV)+S\left((1 − α)V\right)$$
Now we let the piston move. It may no longer stay in place and α could change. But where will it settle down? Here is where the maximum entropy comes in. We are told it will settle down at the value that maximizes S:
$$0=dS =dS_1+dS_2\\
\frac{\partial S_1}{\partial V_1}dV_1+ \frac{\partial S_2}{\partial V_2}dV_2\\
=\left(\frac{P_1}{T_1}-\frac{P_2}{T_2}\right) Vd\alpha\\
0=\left(\frac{P_1-P_2}{T}\right)d\alpha
$$
which is the correct physical answer: in equilibrium, when S is maximized, the pressures will be equal. So the principle of maximum entropy means that when a system held in equilibrium by a constraint becomes free to explore new equilibrium states due to the removal of the constraint, it will pick the one which maximizes S. In this example, where its options are parametrized by α, it will pick$$\frac{\partial S}{\partial\alpha}=0$$
A: The criterion $dS=0$ characterizes equilibrium, as by assumption equilibrium is the maximum entropy state, thus any fluctuation from the state will result in decrease in entropy. Thus, from Fermat's theorem (stationary points) you get that the derivative of $S$ at this state is zero.
This rule is used differently for static cases (to find equilibrium) and dynamic cases (move from one to another). For static cases you assume perfect knowledge of your single macro state $(U,V,N)$ and calculate the entropy consistent with this macroscopic configuration. Notice the assumption of closed system in the wiki definition, it means setting specific $(U,V,N)$ and finding appropriate equilibrium. For dynamic cases you change your macro state $(U,V,N)$. Notice that $S(U,V,N)$ is single valued function, that is - single value for any $(U,V,N)$, but it doesn't mean that many different states $(U,V,N)$ cannot have the same value. By proper adjustment of the macroscopic parameters you can pass through equilibrium states. That means that if you stop the process at any time - the system remains there (as opposed to perturbing the system out of equilibrium, which starts the time dependent process of equilibration) 
Modern definition of equilibrium is by property of detailed balance, that is, the phase space being static, without probability currents*. Proper modern treatment of the topic comes from perspective of non-equilibrium statistical mechanics, with tools such as Fokker-Planck equation and stochastic processes.
*Notice that non-vanishing probability currents can still result in static distribution. In this case the state is not called "equilibrium" but a "non-equilibrium steady state".
