Results 1 to 10 of 19

Thread: resizing knoppix-data.img

Hybrid View

  1. #1
    Senior Member registered user
    Join Date
    Dec 2009
    Posts
    423
    Quote Originally Posted by klaus2008 View Post
    But if the persistent image is encrypted I think the only way to get a larger persistent image is to create a new persistent image and copy the data from the old filesystem to the new one.
    This is a very old thread, I thought I just want to post a follow up to this :-

    To increase the size of an encrypted image, the following can be done :-

    # dd if=/dev/zero bs=1M count=100 >> knoppix-data.aes
    ( same as the non-encrypted one )
    # echo 'password' | losetup -e aes -p 0 /dev/loop6 knoppix-data.aes
    ( Now you can use /dev/loop6 for your resizing purposes )
    # e2fsck -fy /dev/loop6
    # resize2fs /dev/loop6
    Once you are done, destroy the loop device association of knoppix-data.aes :-
    # losetup -d /dev/loop6

    Cheers
    Last edited by kl522; 05-24-2010 at 07:22 AM.

  2. #2
    Junior Member registered user
    Join Date
    Aug 2007
    Posts
    16

    A script to do this (tested by me but you must uncomment some lines at bottom!)

    Code:
    #!/bin/bash
    #
    # Description
    #   Add specified MBs to the size of your knoppix-data.img partition.
    #   Haven't tested the LIBEXT=aes version. You are liable if you uncomment
    #   the operational lines below. It worked for me.
    # Usage
    #    sudo ./resizeImg      # add default 100 MB to your current img
    #    sudo ./resizeImg 1000 # add 1000 MB (1GB) to your current img
    # Author
    #    koolb@hotmail.com
    #
    MYDATA=/mnt/sda2                   # make this an area on any HD
    
    set -e                             # exit on any errors..and do some checking
    [ $(id -u) -eq 0 ] || exec echo "You prolly need to be root. You are $(id -nu)"
    du | fgrep $(basename $MYDATA) || exec echo "You need to have a $MYDATA mounted"
    
    # review these to see if they need to change for your dist or prefs
    ADDMB=${1:-100}                    # append specified/default 100 Megabytes...
    PWD=aes-password                   # only set this if LIVEXT=aes
    #This should be the same for recent knoppix releases
    LIVEXT=img # img or aes            # Active img extension
    BUIMG=$MYDATA/knoppix-data.$LIVEXT # BackUp IMaGe
    LIVEDIR=/mnt-system/KNOPPIX        # Active img location
    LIVEIMG=$LIVEDIR/knoppix-data.$LIVEXT
    
    TMPIMG="$LIVEDIR/$(basename $LIVEIMG .$LIVEXT).bak"
    LOOP=$(losetup -f)                 # get an available loop device
    
    echo "Syncing buffers..."
    time sync                          # optional flush all data/buffers to disk
    echo "Copying live to backup..."
    time cp -p $LIVEIMG $MYDATA        # backup/copy
    echo "Adding..."
    time dd if=/dev/zero bs=1M count=$ADDMB >> $BUIMG
    FS=$BUIMG
    [ $LIVEXT = aes ] && echo $PWD | losetup -e $LIVEXT -p 0 -s $LOOP $FS && FS=$LOOP
    set +e                             # bound to have some fixups from live
    echo "Cleaning fs..."
    time e2fsck -fy $FS                # clean the backup
    set -e                             # resize will force exit on error(s)
    echo "Resizing..."
    time resize2fs $FS
    echo "Checking FS again..."
    time e2fsck -y $FS                # clean after resize
    [ $LIVEXT = aes ] && losetup -d $LOOP
    # ideally do this in a transaction with rollback upon error
    
    echo "Moving into place..."
    #mv $LIVEIMG $TMPIMG                # I was able to do this on a live system
    #time mv $BUIMG $LIVEIMG            # which is one reason why i love Linux!

Posting Permissions

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


Cisco Catalyst C9300-24UX-A 24 Port 10G/mGig UPOE Network Switch, no module picture

Cisco Catalyst C9300-24UX-A 24 Port 10G/mGig UPOE Network Switch, no module

$379.97



ARUBA J9772A 2530-48G PoE+ 48 PORT ETHERNET SWITCH W/ RACK EARS J9772-60301 picture

ARUBA J9772A 2530-48G PoE+ 48 PORT ETHERNET SWITCH W/ RACK EARS J9772-60301

$125.69



Fortinet FortiSwitch FS-124D-POE 24 Port Gigabit Ethernet Switch UNREGISTERED picture

Fortinet FortiSwitch FS-124D-POE 24 Port Gigabit Ethernet Switch UNREGISTERED

$99.97



Dell X1018 X-Series Smart Managed Switches 16-Port Gigabit 2-Port SFP Switch picture

Dell X1018 X-Series Smart Managed Switches 16-Port Gigabit 2-Port SFP Switch

$65.00



New Linksys SE3005 5-port Gigabit Ethernet Switch picture

New Linksys SE3005 5-port Gigabit Ethernet Switch

$18.99



Cudy 5-Port 10/100Mbps Fast Ethernet Desktop Unmanaged Switch | FS105D picture

Cudy 5-Port 10/100Mbps Fast Ethernet Desktop Unmanaged Switch | FS105D

$12.99



Linksys SE3008 8 Ports Rack Mountable Gigabit Ethernet Switch picture

Linksys SE3008 8 Ports Rack Mountable Gigabit Ethernet Switch

$21.99



New 10/100 Mbps 8 Ports Fast Ethernet LAN Desktop RJ45 Network Switch Hub picture

New 10/100 Mbps 8 Ports Fast Ethernet LAN Desktop RJ45 Network Switch Hub

$11.49



Cisco SG300-10P 10x PoE RJ45 Gigabit Switch SRW2008P-K9 V03 + Power Adapter picture

Cisco SG300-10P 10x PoE RJ45 Gigabit Switch SRW2008P-K9 V03 + Power Adapter

$37.49



Cisco SG200-50 Small Business 50 Port Gigabit Smart Network Switch picture

Cisco SG200-50 Small Business 50 Port Gigabit Smart Network Switch

$44.99