Bananian Linux

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000110Bananian Linux[All Projects] Generalpublic2015-02-26 23:512015-02-27 11:12
Reporterfelix29 
Assigned ToNico 
PriorityurgentSeveritymajorReproducibilityalways
StatusresolvedResolutionwon't fix 
Product Version 
Target VersionFixed in Version 
Summary0000110: Need urgently to reduce SD Card img file it takes much tooooo long for backups
DescriptionHello,
asking friends who have same problems, but no functioning solution found on the internet!
Problem
Had a first installation of the bananian to a 32 GB SD card (to have enough space) turned out later that it only has disadvantages while saving images.
In the meantime I have all the needed files on a SSD drive and the bananian only uses about 2GB.
The backups of images takes very very long. It always saves the total of 32 GB (which is useless) and far too big!!
No solution on the internet was found by 3 independent persons with the same issue.
Script files like autosizer.sh do not work.
So please help urgently how to downsize the image file, so I can load it on a 4GB SD card and have a faster backup of the system.
thanks in advance
felix
Steps To Reproduce#!/bin/bash
# Automatic Image file resizer
# Written by SirLagz
strImgFile=$1

#if [[ ! $(whoami) =~ “root” ]]; then
#echo “”
#echo “**********************************”
#echo “*** This should be run as root ***”
#echo “**********************************”
#echo “”
#exit
#fi

if [[ -z $1 ]]; then
echo “Usage: ./autosizer.sh ”
exit
fi

#if [[ ! -e $1 || ! $(file $1) =~ “x86″ ]]; then
#echo “Error : Not an image file, or file doesn’t exist”
#exit
#fi

partinfo=`parted -m $1 unit B print`
partnumber=`echo “$partinfo” | grep ext4 | awk -F: ‘ { print $1 } ‘`
partstart=`echo “$partinfo” | grep ext4 | awk -F: ‘ { print substr($2,0,length($2)-1) } ‘`
loopback=`losetup -f –show -o $partstart $1`
e2fsck -f $loopback
minsize=`resize2fs -P $loopback | awk -F': ‘ ‘ { print $2 } ‘`

# Modified minsize calc by Kevin Rattai
#
# original minsize produces 0bytes on partition, calculated as:
# minsize=`echo “$minsize+1000″ | bc`
#
# New minsize calc produces 10% minsize as available space
minsize=`echo “($minsize+($minsize*0.1))/1″ | bc`

resize2fs -p $loopback $minsize
sleep 1
losetup -d $loopback
partnewsize=`echo “$minsize * 4096″ | bc`
newpartend=`echo “$partstart + $partnewsize” | bc`
part1=`parted $1 rm 2`
part2=`parted $1 unit B mkpart primary $partstart $newpartend`
endresult=`parted -m $1 unit B print free | tail -1 | awk -F: ‘ { print substr($2,0,length($2)-1) } ‘`
truncate -s $endresult $1
Additional InformationDoes not work for bananian but seems to work for RasPi
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0000161)
Nico (manager)
2015-02-27 11:12

This script is not supported by Bananian and we won't fix this.
Please ask upstream to support Bananian images too.

You could try to resize the image manually, check: http://softwarebakery.com/shrinking-images-on-linux [^]

- Issue History
Date Modified Username Field Change
2015-02-26 23:51 felix29 New Issue
2015-02-27 11:12 Nico Note Added: 0000161
2015-02-27 11:12 Nico Status new => resolved
2015-02-27 11:12 Nico Resolution open => won't fix
2015-02-27 11:12 Nico Assigned To => Nico


Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker