On 05/17/2012 12:47 AM, sf...@users.sourceforge.net wrote:
>> Ben Greear:
>>> What is the proper way to clean this all up on reboot
>>> so that /cow is properly flushed and un-mounted (and
>>> thus clean for mount on startup w/out having to fsck it)?
>>>
>>> I tried hacking the 'umountroot' script that is supposed
>>> to make / mounted (ro), by adding
>>>
>>> mount -o remount,del:/cow / after it was (ro),
>>> but that doesn't seem to work.
>>
>> I am afraid you might be still misunderstanding.
>> As well as you cannot unmount the root dir, you cannot remove last
>> branch from aufs.
>> Setting RO is the substitution of unmounting. If you set the aufs branch
>> as RO, you don't have to unmount it anymore.
>
> I should be more precise.
> "Setting RO" means both of these.
> - for aufs, "remount,mod:/brabra=ro"
> - for native fs, "remount,ro"

I tried to set it ro in both ways, and it appears neither work.
Here is the code I am using.  When I do that last 'cat /proc/mounts',
/cow is still mounted (rw), and if you fsck the backing store
for /cow on the next bootup, it is dirty.

I can upload an image that you can dd to a usb drive to
test this yourself if you wish.

        MOUNT_FORCE_OPT=
        [ "$(uname -s)" = "GNU/kFreeBSD" ] && MOUNT_FORCE_OPT=-f
        # This:
        #     mount -n -o remount,ro /
        # will act on a bind mount of / if there is one.
        # See #339023 and the comment in checkroot.sh
        sync
        set -x
        auplink / flush
        mount    $MOUNT_FORCE_OPT -n -o remount,ro -t dummytype dummydev / 
2>/dev/null \
        || mount $MOUNT_FORCE_OPT -n -o remount,ro              dummydev / 
2>/dev/null \
        || mount $MOUNT_FORCE_OPT -n -o remount,ro                       /
        ES=$?
        sync
        [ "$VERBOSE" = no ] || log_action_end_msg $ES

        if [ -d /cow ]
        then
                # Remove from aufs
                # This doesn't actually seem to work.
                MOUNT_FORCE_OPT=-f
                mount $MOUNT_FORCE_OPT -n -o remount,mod:/cow=ro /
                mount $MOUNT_FORCE_OPT -n -o remount,del:/cow /
                mount $MOUNT_FORCE_OPT -n -o remount,ro /cow
                umount $MOUNT_FORCE_OPT -n /cow
        fi
        cat /proc/mounts

        # Give usb persistent storage a chance to calm down??
        sleep 10


Thanks,
Ben

-- 
Ben Greear <gree...@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

Reply via email to