On 08/24/2011 08:23 PM, Gerardo Exequiel Pozzi wrote:
STATUS: Works for standard boot and with cow_device :) TODO: Testing needed for archiso_loop_mnt and archiso_pxe_nbd Also for copytoram=y, and mix of options/hooks. NEEDS: This commit [#2] in initscripts to work (no release at this time). Also this other [#3] for mkinitcpio (fix /run that is mounted as noexec)
This hook is based on work from Tom Gundersen[#1], but adapted for archiso things.
Motivation for this is for unmount property all filesystem, mostly for dm-snapshot persistent.
[#1] http://mailman.archlinux.org/pipermail/arch-projects/2011-July/001549.html [#2] http://projects.archlinux.org/initscripts.git/commit/?id=1fa7b4b453e96533ae1... [#3] http://mailman.archlinux.org/pipermail/arch-projects/2011-August/001749.html
+ +# Lazy unmount /oldroot and all things inside. +umount -l /oldroot + +# Remove all dm-snapshot devices. +dmsetup remove_all + +# Detach each loop device in reverse order (archiso start from 100 to N). +for _lup in $(ls -r /dev/loop???); do + losetup -d ${_lup} +done +
@Thomas: If you do not want lazy unmount, then these are the commands needed. # /oldroot depends on things inside /oldroot/run/archiso... mkdir /oldrun mount --move /oldroot/run /oldrun # Unmount all mounts now. umount $(mount | awk '$3 ~/^\/oldroot/ {print $3}' | sort -r) # Remove all dm-snapshot devices. dmsetup remove_all # Remove all loopback devices made for dm-snapshots devs, other misc loops like pure squashfs images and unmount/detach *.fs.sfs images. for _lup in $(ls -r /dev/loop???); do if ! losetup -d ${_lup} 2> /dev/null; then umount -d ${_lup} fi done # Finally unmount the "cowspace" device and boot device. umount /oldrun/archiso/cowspace umount /oldrun/archiso/bootmnt All things freed and cleaned :) -- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1