Skip to content

Instantly share code, notes, and snippets.

@AndrewSmart
AndrewSmart / resquash-persistent-live-debian-usb.md
Last active August 13, 2018 03:06
[HOWTO] Guide to re-squash persistent live USB to reclaim space

I followed a different guide on this forum for creating the live USB in the first place. I didn't use unetbootin. This guide assumes:

  1. You have two partitions on the live USB:
    1. The first containing the squashfs, vmlinuz, and initrd; this partition has the 'boot' flag.
    2. The second containing the rw persistence partition, labeled 'persistence'.
  2. Your live-persistence.conf file contains just "union /".

Following this guide I had squashed the 2.3GB of used space to 550MB. The increased space usage is due to the updating process; if you want the space back we must re-squash everything into the squashfs. If you have a humongous USB, what you would gain from this guide is a some-what faster boot. I wish there were a way for this to be automated; but AFAIK that is not possible at this time.

  1. First, you may have noticed if you run apt-get update, you may encounter errors if update-initramfs is triggered:
@AndrewSmart
AndrewSmart / clinfo
Created August 15, 2016 04:19
clinfo result for cltorch
$ clinfo
Number of platforms: 2
Platform Profile: FULL_PROFILE
Platform Version: OpenCL 1.1 CUDA 6.5.51
Platform Name: NVIDIA CUDA
Platform Vendor: NVIDIA Corporation
Platform Extensions: cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_copy_opts
Platform Profile: FULL_PROFILE
Platform Version: OpenCL 2.0 AMD-APP (1800.11)
Platform Name: AMD Accelerated Parallel Processing
@AndrewSmart
AndrewSmart / subrepo-pull.t
Created November 12, 2015 19:15
git-subrepo Issue #98
#!/usr/bin/env bash
set -e
source test/setup
use Test::More
clone-foo-and-bar
subrepo-clone-bar-into-foo
(
cd $OWNER/bar
add-new-files Bar2
@AndrewSmart
AndrewSmart / mksquashfs.clean.sh
Last active August 29, 2015 14:13
Cleans linux persistent partition.
#!/usr/bin/env bash
#Assumes system is not booted into persistence mode (omit persistence kernel parameters on boot in grub).
if grep -qs " persistence[ |$]" /proc/cmdline
then
echo "Script not intended to be run in persistence mode."
exit 1
fi
echo "Backing up files from rw branch which were moved into ro branch (the squashfs)."
cd /media/sdb2
@AndrewSmart
AndrewSmart / mksquashfs.new.sh
Last active August 29, 2015 14:13
Updates linux persistent squashfs
#!/usr/bin/env bash
NEW_SQUASHFS_FILE='/media/sda1/tmp/filesystem.squashfs.xz'
APT_UPDATED=false
if ! grep -qs " persistence[ |$]" /proc/cmdline
then
echo "Script intended to make squashfs from within live system, with persistence kernel parameter."
exit
fi
@AndrewSmart
AndrewSmart / Issue15Test.sh
Created January 8, 2015 19:19
Non-interactive test for Issue#15
#!/usr/bin/env bash
set -e
if [ "$1" == 'ReRun' ]; then
set -x
else
$0 ReRun 2>&1 | tee log
exit 0
fi
asmart@E15048 ~/dev
$ git clone git@github.com:AndrewSmart/git-subrepo.git andrewsmart.git --branch=master
Cloning into 'andrewsmart.git'...
remote: Counting objects: 691, done.
remote: Compressing objects: 100% (370/370), done.
remote: Total 691 (delta 333), reused 604 (delta 283)
Receiving objects: 100% (691/691), 150.74 KiB | 0 bytes/s, done.
Resolving deltas: 100% (333/333), done.
Checking connectivity... done.
#!/usr/bin/env bash
mkdir lib p1 p2 && git init --bare lib && git init p1 && git init p2
git clone lib lib.git && cd lib.git && touch readme && git add readme && git commit -m "Initial lib" && git push && cd ..
cd p1 && touch p1 && git add p1 && git commit -m "Initial" && git subrepo clone ../lib lib -b master && cd ..
cd p2 && touch p2 && git add p2 && git commit -m "Initial" && git subrepo clone ../lib lib -b master && cd ../p1
echo "p1 initial add to subrepo" >> lib/readme && git add lib/readme && git commit -m "p1 initial add to subrepo" && git subrepo push --all
cd ../p2 && git subrepo pull --all
echo "p2 initial add to subrepo" >> lib/readme && git add lib/readme && git commit -m "p2 initial add to subrepo" && git subrepo push --all
cd ../p1 && git subrepo pull --all -v
$ make test
prove test/
test/args.t ...... ok
test/commands.t .. ok
test/compile.t ... ok
All tests successful.
Files=3, Tests=55, 170 wallclock secs ( 0.12 usr 0.05 sys + 50.01 cusr 119.52 csys = 169.70 CPU)
Result: PASS