Results 1 to 3 of 3

Thread: Three different kinds of persistent store with Knoppix:Implementation example

Threaded View

  1. #1
    Senior Member registered user
    Join Date
    Sep 2006
    Posts
    802

    Three different kinds of persistent store with Knoppix:Implementation example

    The default way to run Knoppix on a daily basis is to use the "built-in" persistent store, which is unionfs-mounted together with the compressed KNOPPIX image. To fit on vfat-formatted devices (and standard DVDs), the max size of persistent store has traditionally been 4GB, but there has, actually, been possible to use as big store as the file system allows.
    Now, there is also built-in support for larger persistent storage, but I have found the use of such to be a double-edged sword: Not only will the efficiency for my daily use tend to be lower with larger persistent stores, but the upgrade process between Knoppix releases often is much more convoluted when theres is a lot of stuff on the persistent store to take care of.

    The efficient solution for me has been
    1. Mount a suitable storage partition on the PC for a larger amount of persistent storage, persistent between Knoppix instances.
    2. Use virtual machines on the storage partition for "normal" PC use (larger OS-release specific partitions etc).
    3. Keep updated copies of the storage partition on external media (NAS, external HDD) for backup and copying.
    4. Use a 4GB persistent store, remaster as necessary. (Maybe several times per Knoppix release.)

    With the increase in use of Java or similar languages, the remastering process has become less efficient, as Java-based systems to a large extent consists of jar/war packages, which are already compressed. Also, such packages are generally quite platform agnostic, and in contrast with ordinary Debian packages, they don't, generally, need to be updated between Linux OS releases.

    Therefore to have a third, movable kind of persistent store, I have returned to a practice from before I started to do remastering routinely: Mounting (not unionfs, just ordinary) extra volumes of persistent store, stored in (loop-mounted) .img files together with knoppix-data.img.
    This way, I can avoid most of space problems with ordinary persistent store, while still keeping everything at manageable sizes. Those files are easily copied and moved around together with the basic Knoppix system, and they can be made persistent between releases. I use 32 GB USB3 sticks for backup and copying.

    I keep one volume for programs (including program development) and one for data. They are mounted on directories /usr/local/opt and /usr/local/data.

    Code:
    Type of storage                          File                Mounted on     Movable  Release-persistent        Size (ca)  
    KNOPPIX compressed                       KNOPPIX             /KNOPPIX            Yes              No                4GB
    Standard persistent store                knoppix-data.img    /KNOPPIX-DATA       Yes              No                4GB
    PC store  volume                         ..............      /store              No               Yes             450GB
    Extra persistent store for programs      knoppix-data2.img   /usr/local/opt      Yes            Possibly            4GB
    Extra persistent store for data          knoppix-data3.img   /usr/local/data     Yes              Yes               4GB
    The extra volumes are not involved in Knoppix init, they are mounted by /etc/rc.local

    Here is an excerpt from df output on a PC with 250GB SSD disk, (8 GB RAM, using 64-bits standard kernel.)
    Code:
    Filesystem     1K-blocks      Used Available Use% Mounted on
    /dev/sda1       46057488  31581072  14476416  69% /mnt-system
    tmpfs            6463488         0   6463488   0% /ramdisk
    /dev/cloop       9646060   9646060         0 100% /KNOPPIX
    /dev/loop0       4031680   3402740    424140  89% /KNOPPIX-DATA
    unionfs          4031680   3402740    424140  89% /UNIONFS
    /dev/loop1       4031680     73596   3753284   2% /usr/local/opt
    /dev/loop2       4031680     73596   3753284   2% /usr/local/data
    /dev/sda5      141110136 102054728  31887408  77% /store
    The necessary modification of /etc/rc.local is straightforward:

    Code:
    function to_exist() {
       [ -d "$1" ] || mkdir -p $1 ;
    }
    
    #Knoppix directory names vary with release and remastering version
    KNOPPIX_RUN_DIR=KNOPPIX705_2
    #Create mount point for PC store -no mounting, actual partitions may vary
    mkdir /store
    # Mount extra volumes, make sure mount points exist
    to_exist /usr/local/opt ;
    to_exist /usr/local/data ;
    mount -o loop /mnt-system/${KNOPPIX_RUN_DIR}/knoppix-data2.img /usr/local/opt ;
    mount -o loop /mnt-system/${KNOPPIX_RUN_DIR}/knoppix-data3.img /usr/local/data ;
    I have made a small, simple script for creating the extra volumes. Excerpt:


    Code:
    # Try to avoid stealing loops.. make some outside the ordinary range..
     [ -b /dev/loop15 ]    || sudo mknod -m 755 /dev/loop15 b 7 15
     [ -b /dev/loop14 ]    || sudo mknod -m 755 /dev/loop14 b 7 14
     [ -b /dev/loop13 ]    || sudo mknod -m 755 /dev/loop13 b 7 13
    
    function to_exist() {
       [ -d "$1" ] || sudo mkdir -p $1 ;
    }
    
    function purge_or_create() {
        [ -d "$1" ] && sudo rm -rf $1 
        sudo mkdir -p $1 ;
    }
    
    
    function setup_loopfile() {
      loopdev=$1 ; workdir=$2 ; loopfile=$3 ; psize=$4  ;
      to_exist /tmp/knx-mkloopfiles ;
      purge_or_create /tmp/knx-mkloopfiles/setup_mnt ;
    
      sudo dd if=/dev/zero of=${workdir}/${loopfile} bs=1M count=$psize
      sudo losetup /dev/loop${loopdev} ${workdir}/${loopfile}
      sudo mkfs.ext3 /dev/loop${loopdev} 2>create_workspace.log ; 
      sudo losetup /dev/loop${loopdev}
    
    }
    
    # Pick parameters from command line ;
    running_knoppixdir=$1 ; psz=$2 ;
    
    setup_loopfile 15 ${running_knoppixdir} knoppix-data2.img $psz ;
    setup_loopfile 14 ${running_knoppixdir} knoppix-data3.img $psz ;
    This Knoppix variant is also very well suited for running in virtual machines, for example for program development, testing out services etc.
    Last edited by Capricorny; 03-01-2014 at 10:23 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


🔀 Juniper Networks EX2300-C-12P 12× Gigabit PoE+ • 2× 10G SFP+ Compact Switch ⚡ picture

🔀 Juniper Networks EX2300-C-12P 12× Gigabit PoE+ • 2× 10G SFP+ Compact Switch ⚡

$109.99



Juniper EX2300 12-Port Gigabit PoE+ Managed Network Switch P/N: EX2300-C-12P picture

Juniper EX2300 12-Port Gigabit PoE+ Managed Network Switch P/N: EX2300-C-12P

$149.99



Juniper Networks EX3400-24T 24-Port Ethernet Switch w/Power Cord picture

Juniper Networks EX3400-24T 24-Port Ethernet Switch w/Power Cord

$174.99



Juniper EX3400-24P 24-Port PoE+ GbE + 4-Port 1/10Gb SFP Switch picture

Juniper EX3400-24P 24-Port PoE+ GbE + 4-Port 1/10Gb SFP Switch

$245.00



Juniper Networks EX4400-EM-4Y EX Series 4-Port SFP Expansion Module 25Gbps picture

Juniper Networks EX4400-EM-4Y EX Series 4-Port SFP Expansion Module 25Gbps

$800.00



Juniper Networks AP33-US Indoor Wifi6 (US Version) 5GHz: 4x4:4; 2.99 picture

Juniper Networks AP33-US Indoor Wifi6 (US Version) 5GHz: 4x4:4; 2.99

$24.99



Juniper MX204 +JUNOS and Dual Power Supply picture

Juniper MX204 +JUNOS and Dual Power Supply

$7299.99



Juniper EX2300-C 12 Port Compact Gigabit Switch EX2300-C-12p Discounted Cosmetic picture

Juniper EX2300-C 12 Port Compact Gigabit Switch EX2300-C-12p Discounted Cosmetic

$79.86



Juniper Networks Mist Wireless Access Points, Model AP45 picture

Juniper Networks Mist Wireless Access Points, Model AP45

$59.99



Juniper Networks EX2300-48P 48-Port Gigabit PoE Managed Ethernet Switch picture

Juniper Networks EX2300-48P 48-Port Gigabit PoE Managed Ethernet Switch

$79.99