Cloning a Voyage Linux host

After you made all your customizations to a Voyage Linux installation, you may want to replicate it to other boards. The procedure is tested with PC Engines’ ALIX2 boards.

The dump can also be easily piped through SSH to/from your backup server. This way it’s easy to organize snapshots for your lab testing and backups. Do not use any compression inside ALIX — the CPU is quite slow, and it’s faster to transfer uncompressed data over SSH and compress it on the target host if needed (assuming the target host is a usual modern machine).

# get dump and restore
remountrw
apt-get install dump

# make sure your source filesystem is read-only
remountro

# The target CF card is attached as /dev/sdb in a USB card reader
CF=/dev/sdb
CF1=/dev/sdb1

/usr/local/sbin/format-cf.sh -t $CF -b 1 -y
mkdir /tmp/cf
mount $CF1 /tmp/cf
cd /tmp/cf
dump -0 -f - /dev/hda1 | restore -r -f -

# let the new system re-generate SSH keys
rm /tmp/cf/etc/ssh/ssh_host_*
touch /tmp/cf/voyage.1st

# Populate a new hostname
vi /tmp/cf/etc/hostname
vi /tmp/cf/etc/hosts

# Install the boot loader (assuming Partition 1 is used for boot filesystem)
echo "(hd0) $CF" > /tmp/cf/boot/grub/device.map
mount -o bind /dev /tmp/cf/dev
chroot /tmp/cf /usr/sbin/grub --device-map=/boot/grub/device.map <<EOM
setup (hd0) (hd0,0)
quit
EOM
umount /tmp/cf/dev

# finished preparing the filesystem
cd /
umount $CF1
Advertisements

, ,

  1. #1 by Mirco on March 9, 2012 - 10:54 pm

    Read it on the list, just wanted to let you know that this is very appreciated…

    • #2 by txlab on March 9, 2012 - 11:24 pm

      my pleasure 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: