dracut.asc: document shutdown procedure
authorHarald Hoyer <harald@redhat.com>
Fri, 18 Jan 2013 09:13:14 +0000 (10:13 +0100)
committerHarald Hoyer <harald@redhat.com>
Fri, 18 Jan 2013 09:13:14 +0000 (10:13 +0100)
dracut.asc

index 09962fe..d11e95c 100644 (file)
@@ -79,7 +79,7 @@ udev pulls in modules matching the computer's detected hardware.
 initialized and a user-space helper started to paint animations onto the display
 in lockstep with the boot process.
 
-* If the root file system is on NFS, dracut does  then:
+* If the root file system is on NFS, dracut does then:
 ** Bring up the primary network interface.
 ** Invoke a DHCP client, with which it can obtain a DHCP lease.
 ** Extract the name of the NFS share and the address of the NFS server from the
@@ -120,6 +120,26 @@ final cleanup tasks. On an initramfs, the initial root file system cannot be
 rotated away. Instead, it is simply emptied and the final root file system
 mounted over the top.
 
+== Dracut on shutdown
+
+On a systemd driven system, the dracut initramfs is also used for the shutdown procedure.
+
+The following steps are executed during a shutdown:
+
+* systemd switches to the shutdown.target
+* systemd starts /lib/systemd/system/shutdown.target.wants/dracut-shutdown.service
+* dracut-shutdown.service executes /usr/lib/dracut/dracut-initramfs-restore
+  which unpacks the initramfs to /run/initramfs
+* systemd finishes shutdown.target
+* systemd kills all processes
+* systemd tries to unmount everything and mounts the remaining read-only
+* systemd checks, if there is a /run/initramfs/shutdown executable
+* if yes, it does a pivot_root to /run/initramfs and executes ./shutdown.
+  The old root is then mounted on /oldroot. /usr/lib/dracut/modules.d/99shutdown/shutdown.sh is the shutdown executable.
+* shutdown will try to umount every /oldroot mount and calls the various shutdown hooks from the dracut modules
+
+This ensures, that all devices are disassembled and unmounted cleanly.
+
 = User Manual
 
 == Creating an initramfs Image