Giter Site home page Giter Site logo

shrink's Introduction

shrink

linux bash script to resize Raspberry SD card images

- needs a real or VM linux desktop system with hard disk and card reader
- cannot handle NOOBS images
- consider also further remarks

download

download repository from GitHub,
unzip and copy for example to: ~/shrink

or

copy script to current directory
wget https://raw.github.com/qrti/shrink/master/script/shrink.sh

or

check if git is installed
$ git --version

if git is not installed
$ sudo apt-get install git-all

clone shrink repository to current directory
$ git clone https://github.com/qrti/shrink.git


necessary installs

$ sudo apt-get update && sudo apt-get install dcfldd
$ sudo apt-get update && sudo apt-get install gparted


configure

before executing the script, insert your SD card

enter the following at the command line and find the name of your SD device, there should be two entries, for example /dev/sdd1 and /dev/sdd2
$ df -h

edit the script and enter your data between the quotation marks, for DEVICE omit the digit, so our example gets /dev/sdd, fill in your linux user name at USER
$ nano shrink.sh

DEVICE=""                   # source and target SD card device
USER=""                     # linux user name

explore the top of the script to configure some more things


execute

change directory
$ cd ~/shrink

make script executable once
$ chmod 755 shrink.sh

execute script
$ sudo ./shrink.sh


remarks

use this script completely at your own risk

it needs a real or VM linux desktop system with hard disk and card reader

it cannot handle NOOBS images

do not shrink images to minimum, otherwise they won't start on your Raspberry, especially Raspbian Full Desktop images need some extra space, about >= 250 MB are advised, Raspbian Lite images might be more moderate

when using the new SD card for the first time, expand the filesystem to fill its space and reboot

by raspi-config
sudo raspi-config
Expand Filesystem

or

from command line
sudo raspi-config --expand-rootfs
sudo reboot

the script is 'half automatic', meaning at one point it will start GParted on desktop and guide you what to do

the script was developed and tested on a VirtualBox Windows host with Linux Mint guest

inspired by
http://www.aoakley.com/articles/2015-10-09-resizing-sd-images.php

Donations are welcome!

https://www.paypal.com


copyright

shrink is published under the terms of ISC license

Copyright (c) 2016 [email protected]

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED 'AS IS' AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

shrink's People

Contributors

qrti avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.