[arch-releng] [DRAFT] [archiso] Add archiso_shutdown hook.

Gerardo Exequiel Pozzi vmlinuz386 at yahoo.com.ar
Wed Aug 24 11:57:29 EDT 2011


On 08/24/2011 03:18 AM, Gerardo Exequiel Pozzi wrote:
> STATUS: unfinished archiso_shutdown script, this only execute a shell to play on it.
>          (I sucessfully unmounted manually all filesystems for configs/baseline)
>

I resolved the maze!, lazy unmount! does the trick!

In the most simple case (only one dm-snapshot device [configs/baseline]) 
this is what we have on "deinitramfs" stage:

/ # dmsetup table
arch_root-image: 0 1787904 snapshot 7:101 7:102 P 8

/ # losetup -a <-- losetup from util-linux
/dev/loop100: [0b00]:278 (/run/archiso/bootmnt/arch/i686/root-image.fs.sfs)
/dev/loop101: [0764]:2 (/run/archiso/sfs/root-image/root-image.fs)
/dev/loop102: [0801]:13 
(/run/archiso/cowspace/persistent_ARCH_201108/root-image.cow)

/ # grep oldroot
/dev/disk/by-label/ARCH_201108 /oldroot/run/archiso/bootmnt udf 
ro,relatime,utf8 0 0
/dev/disk/by-label/jenna /oldroot/run/archiso/cowspace ext4 
rw,relatime,user_xattr,acl,barrier=1,data=ordered 0 0
/dev/loop100 /oldroot/run/archiso/sfs/root-image squashfs ro,relatime 0 0
/dev/mapper/arch_root-image /oldroot ext4 
ro,relatime,user_xattr,acl,barrier=1 0 0

So before I can do something I need to mount --move /oldroot/run/ 
/goodbye/ (in this way I can unmount dm-snapshot device), then 
deregister dm-mapper device, detach loop device, all things in right order!

But I find a much more easy way! LAZY unmount!

/ # lsmod  | grep -e ^ext4 -e ^loop -e ^squashfs -e ^dm_snapshot
dm_snapshot            26692  2
squashfs               25187  1
ext4                  337724  2
loop                   13931  6
/ # umount -l /oldroot
/ # dmsetup remove_all
/ # losetup -d /dev/loop102
/ # losetup -d /dev/loop101
/ # losetup -d /dev/loop100
/ # lsmod  | grep -e ^ext4 -e ^loop -e ^squashfs -e ^dm_snapshot
dm_snapshot            26692  0
squashfs               25187  0
ext4                  337724  0
loop                   13931  0

All devices freed

I am going to work now, when I back I will implemente this, and test 
with more complex setup that is configs/releng (core-dual have 3 
dm-snapshots + 11 loopbacks + 10 mounts).


-- 
Gerardo Exequiel Pozzi
\cos^2\alpha + \sin^2\alpha = 1



More information about the arch-releng mailing list