summaryrefslogtreecommitdiff
path: root/doc/s6-linux-init-umountall.html
blob: eff06c5a763a51a738395302ef9c666c3bdecb76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="Content-Language" content="en" />
    <title>s6-linux-init: the s6-linux-init-umountall program</title>
    <meta name="Description" content="s6-linux-init: the s6-linux-init-umountall program" />
    <meta name="Keywords" content="s6 linux administration root linux utilities umount unmount filesystem" />
    <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
  </head>
<body>

<p>
<a href="index.html">s6-linux-init</a><br />
<a href="//skarnet.org/software/">Software</a><br />
<a href="//skarnet.org/">skarnet.org</a>
</p>

<h1> The <tt>s6-linux-init-umountall</tt> program </h1>

<p>
 <tt>s6-linux-init-umountall</tt> unmounts all filesystems.
</p>

<h2> Interface </h2>

<pre>
     s6-linux-init-umountall
</pre>

<ul>
 <li> <tt>s6-linux-init-umountall</tt> unmounts all filesystems according to <tt>/proc/mounts</tt>.
It processes <tt>/proc/mounts</tt> in the reverse order, starting with the most recently mounted
partition and ending with the root filesystem ("unmounting" the root filesystem means remounting
it read-only). </li>
 <li> It makes an exception for the first instances of <em>devtmpfs</em>, <em>proc</em>
and <em>sysfs</em> filesystem types, but not for later instances. In other words: it
does not attempt to unmount <tt>/dev</tt>, <tt>/proc</tt> and <tt>/sys</tt>, but it
will attempt to unmount duplicates of those pseudo-filesystems. </li>
 <li> <tt>s6-linux-init-umountall</tt> does not touch <tt>/etc/mtab</tt>. </li>
 <li> If a filesystem fails to unmount, a warning is printed to stderr, but
<tt>s6-linux-init-umountall</tt> still attempts to unmount all the other ones. </li>
</ul>

<h2> Exit codes </h2>

<p>
 <tt>s6-linux-init-umountall</tt> returns the number of errors it encountered
when attempting to unmount the filesystems listed in <tt>/proc/mounts</tt>.
</p>

<h2> Notes </h2>

<ul>
 <li> <tt>s6-linux-init-umountall</tt> is automatically called at the very end of the shutdown procedure,
in "stage 4", i.e. after a SIGKILL has been sent to all the processes on the system, and
right before the system reboots (or halts, or is powered off). By that point, there is
no possible process that could prevent real file systems from being unmounted. </li>
 <li> It is likely that some filesystems will still fail to unmount, typically
cgroups or tmpfses. That's okay: those are pseudo-filesystems, and
will not cause data loss or a fsck if the system shuts down while they are still mounted. </li>
 <li> Distributions usually provide a <tt>umount</tt> command with a <tt>-a</tt> option
to unmount all filesystems. That command is usually bloated with historical artifacts
and relies on unsafe interfaces, so it was decided not to use it. </li>
</ul>

</body>
</html>