Saving Your Root Filesystem

Once a Balloon board has been set up for some particular application, it can be useful to save the entire root filesystem in order to be able to quickly install that root filesystem on other boards. This is one method of doing it which is reasonably quick.

We use tar to create an archive of the whole filesystem. It's also useful to save this archive on another machine in order to be able to use it later. It is possible to combine these two operations into one, by using netcat to send the data from tar directly to a host PC. The host PC can then compress the data and save it to disk. This has the useful side effect of speeding things up, because the data doesn't have to be written to the Balloon's flash memory, and the host PC can compress the tarfile which is quicker than having the Balloon do it.

Step-by-step

First, get a serial connection to your Balloon board's console working. Switch on the board, and press space to get to the bootldr prompt. Boot into the boot/recovery kernel:

set bootscript=exit
boot flash

Log in as root (no password). Mount the root filesystem:

mount /mnt/root

Now connect the USB cable from your Balloon to host PC. Bring up USB networking:

ifdown usb0
ifup usb0

The following instructions assume that your Balloon has IP address 10.1.1.2 and the host PC has address 10.1.1.1 as described in USBNetworking.

On the Balloon board, change to the right directory and start tar feeding into netcat:

cd /mnt/root
tar cv * | netcat -n -l -c -p 7000

Little will happen yet because netcat is waiting for a network connection before it can send the data anywhere.

Now, on the host PC, go into a directory of your choice and start netcat receiving into a progress bar generator (pv) so we can see what's happening, then gzip, thence into a file. Note that if you don't have pv, you can either install it (sudo apt-get install pv) or just remove that part of the command below.

nc -n 10.1.1.2 7000 | pv | gzip > rootfs.tgz

The process takes some time, so make some tea. On a Balloon 3 board here with a Debian root filesystem, it took just over 5 minutes to transfer 177MB of data.