[arch-projects] [mkinitcpio][PATCH 2/2] shutdown: disassemble devices on shutdown

Dave Reisner d at falconindy.com
Sun Mar 25 12:36:06 EDT 2012

On Sat, Mar 24, 2012 at 10:20:05PM -0400, Dave Reisner wrote:
> sysfs contains enough information about block devices to be able to
> determine the order of stacked devices such as lvm, raid, or crypto. By
> looking at the device symlinks from the holders/ attributes of a block
> device, we can walk down each device chain until we reach the most
> descendant device.
> For each of these devices at the end of a chain, detect its type and
> perform the appropriate action to disassemble it. Then, walk back up the
> device chain, disassembling each parent device.
> To save ourselves some pain and make sure we're fairly accurate, lsblk
> is brought in for detection of device types.
> Signed-off-by: Dave Reisner <dreisner at archlinux.org>
> ---
> This was fun... so far, I've tested this with the following root
> configurations:


and despite being fun, it turns out it's way more complicated than it
needs to be, thanks to tom pointing out that we can safely use recursion
to disassemble. working on a v2...

More information about the arch-projects mailing list