[Fedora-livecd-list] Recommendations for non-persistent file overlay for embedded LiveCd application?

Ed Sutton ESutton at fescorp.com
Wed Nov 6 22:27:25 UTC 2013


I am seeking advice on choosing a non-persistent file overlay suited for an embedded LiveCd application where the system is always on?  The current approach we are using is based of a RHEL 5.2 LiveCd and uses snapshot device mapper overlay.

It appears /dev/mapper/live-rw overlay resources are not 100% released after file add and file delete operations.  For example, as logrotate does with system log files.   When dmsetup status reports 70% or more storage consumption the system will become non-responsive and must be restarted.  I can reproduce this with about 30 minutes of writing 12, 000 cycles of open a file named test.log, overwrite if exists,  write 16MB data,  close, repeat.


# overlay setup helper function
do_live_overlay() {

...

    # set up the snapshot
    echo 0 `blockdev --getsize $BASE_LOOPDEV` snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV p 8 | dmsetup create live-rw
}

This article states that " dmsetup status live-rw consumption reports will only show increases even though allocated overlay sectors are available for reuse if an added file has been deleted".

http://fedoraproject.org/wiki/LiveOS_image

Is UnionFs, tmpfs,  unionfs-fuse ( user space) or other options better choices for non-persistent overlay?

Thanks in advance for any tips or suggestions,

-Ed

Using: livecd-tools-014-8
Target and Build machine: CentOs5.2


# overlay setup helper function
do_live_overlay() {
    # create a sparse file for the overlay
    # overlay: if non-ram overlay searching is desired, do it,
    #              otherwise, create traditional overlay in ram
    OVERLAY_LOOPDEV=$( losetup -f )

    l=$(/lib/udev/vol_id -l /dev/root) || l=""
    u=$(/lib/udev/vol_id -u /dev/root) || u=""

    if ( echo $overlay | grep -q ":" ); then
        # pathspec specified, extract
        pathspec=$( echo $overlay | sed -e 's/^.*://' )
    elif [ "x${overlay}" != "xoff" ]; then
        pathspec="/LiveOS/overlay-$l-$u"
    fi

    if [ -z "$pathspec" -o "$pathspec" == "auto" ]; then
        pathspec="/LiveOS/overlay-$l-$u"
    fi
    devspec=$( echo $overlay | sed -e 's/:.*$//' )

    # need to know where to look for the overlay
    setup=""
    if [ -n "$devspec" -a -n "$pathspec" -a "${overlay}" != "off" ]; then
        mkdir /overlayfs
        mount -n -t auto $devspec /overlayfs || :
        if [ -f /overlayfs$pathspec -a -w /overlayfs$pathspec ]; then
            losetup $OVERLAY_LOOPDEV /overlayfs$pathspec
            if [ -n "$reset_overlay" ]; then
               dd if=/dev/zero of=$OVERLAY_LOOPDEV bs=64k count=1 2>/dev/null
            fi
            setup="yes"
        fi
        umount -l /overlayfs || :
    fi

    if [ -z "$setup" ]; then
        if [ -n "$devspec" -a -n "$pathspec" ]; then
           echo "Unable to find persistent overlay; using temporary"
           sleep 5
        fi

        dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((512*1024)) 2> /dev/null
        losetup $OVERLAY_LOOPDEV /overlay
    fi

    # set up the snapshot
    echo 0 `blockdev --getsize $BASE_LOOPDEV` snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV p 8 | dmsetup create live-rw
}



More information about the livecd mailing list