FANDOM


This describes my configuration for running minimal/custom debian wheezy from RAM with a persistence file on the harddisk. You will have the ability to merge the changes into the compressed RAM image then reboot into it.

Rather than running an official iso with persistence, I wanted to have a minimal install without anything I don't use so I started with a debootstrap in /wheezy. Read here on how to do this: http://www.debian.org/releases/stable/amd64/apds03.html.en

In the chroot (run 'chroot /wheezy'):

apt-get install live-boot squashfs-tools
rsync -a --delete --one-file-system / /squashfs --exclude=/live --exclude=/squashfs --exclude=/boot
mksquashfs /squashfs /live/livefs.squashfs -noappend -always-use-fragments -comp xz -processors 4
exit

Out of the chroot (run 'exit'):

dd if=/dev/zero of=/persistence bs=1M count=1024
mkfs.ext4 /persistence
mkdir /mnt/tmp
mount /persistence /mnt/tmp
echo / union,source=. > /mnt/tmp/persistence.conf
umount /mnt/tmp

You need to boot the thing somehow. On my linux mint system, I add the following to /etc/grub.d/40_custom. You will need to change this to match your root partition and kernel:

menuentry "Wheezy in RAM" {
 gfxmode $linux_gfx_mode
 insmod gzio

insmod part_msdos   insmod ext2   set root='hd0,msdos5'

 linux /wheezy/boot/vmlinuz-3.13-1-amd64 boot=live persistence toram=livefs.squashfs
 initrd /wheezy/boot/initrd.img-3.13-1-amd64
}

Don't forget to

update-grub

To remaster the system, I have a script called /resquash.sh, which does something like this. You may need to change this to match your system.

rm /var/cache/apt/archives/*.deb
rsync -a --delete --one-file-system / /lib/live/mount/persistence/sda5/wheezy/squashfs --exclude=lost+found --exclude=persistence.conf
mksquashfs /lib/live/mount/persistence/sda5/wheezy/squashfs /lib/live/mount/persistence/sda5/live/livefs.squashfs.new -noappend -always-use-fragments -comp xz -processors 4
mv /lib/live/mount/persistence/sda5/live/livefs.squashfs /lib/live/mount/persistence/sda5/live/livefs.squashfs.old
mv /lib/live/mount/persistence/sda5/live/livefs.squashfs.new /lib/live/mount/persistence/sda5/live/livefs.squashfs
mv /lib/live/mount/persistence/sda5/persistence /lib/live/mount/persistence/sda5/persistence.old
cp /lib/live/mount/persistence/sda5/persistence.blank /lib/live/mount/persistence /sda5/persistence
echo
echo -n "All done. New image is "
du -hs /lib/live/mount/persistence/sda5/live/livefs.squashfs|cut -f1
echo
echo Reboot now. You will lose all changes until next reboot.
echo

You should be able to wipe out everything in /wheezy except /live and /boot if you want to. It won't be kept up to date with changes made in the RAM environment. But might be handy to keep around to easily do a kernel upgrade. Kernel upgrades will need some extra steps otherwise.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.