Creating Netbook Disk Image

From Linuxcentre Wiki

Jump to: navigation, search

This following procedure can be used to create cloned images of a Linux system using just a single USB stick on a single machine. I use it for cloning lots of netbooks from a master netbook running Ubuntu 9.04 / 9.10 / 10.10 and 14.04 LTS but in theory should work just fine on any Linux system. This procedure could also be useful for bare-metal recovery assiming that the hardware is the same (not tried this with varying hardware yet).

Contents

Create Clonezilla Live USB stick

Assumes that USB stick is mounted on /media/disk and is /dev/sdc

  • Download Clonezilla Live stable zip file from here. (I used both 1.2.2-26 and 2.2.3-25)
  • Make sure we have the right partition layout and fs by running: fdisk -l /dev/sdc
Disk /dev/sdc: 8069 MB, 8069840896 bytes
41 heads, 41 sectors/track, 9376 cylinders
Units = cylinders of 1681 * 512 = 860672 bytes
Disk identifier: 0x04030201

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1         366     7572905+   b  W95 FAT32
  • Make sure that vfat partition is formatted:
mkfs.vfat -F 32 /dev/sdc1
sync
  • Mount and unzip clonezilla files:
unzip clonezilla-live-1.2.2-26.zip -d /media/disk/
  • make it bootable:
cd /media/disk/utils/linux
bash makeboot.sh /dev/sdc1
  • Answer 'y' to all questions if you are sure it is the correct device.
  • Safely unmount the USB stick
  • Test that it boots into Clonezilla live by running qemu emulator:
sudo qemu -boot c -hdc /dev/sdc

Create an image from a laptop

Method was worked out with the help from these two pages: ref1 and ref2. Also see ref.

  • Boot PC when pressing F12 to get boot menu then select 'USB storage device' to boot from
  • From the clonezilla boot menu choose 'Default settings 800x600'
  • Select default language
  • Select 'Don't touch keymap'
  • Select 'Start_Clonezilla'
  • Select 'device-image'
  • Select 'skip'
  • Press Enter
  • Select Beginner
  • Select savedisk
  • Choose a filename (e.g. 'karmic-test-1-img')
  • Select disk device to copy from (probably only one to choose from)
  • Press Enter
  • Confirm 'y'
    • If it fails at this point, go to the shell and type:
sudo mount -w -o remount /lib/live/mount/medium
    • Try the process again without rebooting
  • Wait for imaging to complete

Immediately after imaging

  • start over (3) (or boot up the USB stick again)
  • Select 'Start_Clonezilla'
  • Select 'device-image'
  • Select 'skip'
  • Select 'beginner'
  • Select 'recovery-iso-zip'
  • select desired restore image
  • Select default device
  • Select default language
  • Select default keymap
  • Selct 'zip'
  • Make a note of command at bottom of screen like (several examples):
ocs-live-dev -c -g en_US.UTF-8 -t -k NONE -e "-g auto -e1 auto -e2 -c -j2 -p true restoredisk karmic-test-1-img sda" karmic-test-1-img
ocs-live-dev -c -g en_US.UTF-8 -t -k NONE -e "-g auto -e1 auto -e2 -c -r -j2 -p true restoredisk 2014-07-05-16-img sda" 2014-07-05-16-img
  • Press ctrl-c
  • poweroff
  • Mount usb stick on a PC
  • Change syslinux/syslinux.cfg to something like:
timeout 100
  • From:
 MENU LABEL Clonezilla live (Default settings, VGA 800x600)
 kernel /live/vmlinuz1
 append initrd=/live/initrd1.img boot=live union=aufs nolocales noprompt \
 ocs_live_run="ocs-live-general" \
 ocs_live_extra_param="" \
 ocs_live_keymap="" ocs_live_batch="no" ocs_lang="" vga=788 ip=frommedia
  • To: (dont use the '\', just make them all one long line)
 MENU LABEL clonezilla live for karmic-test
 kernel /live/vmlinuz1
 append initrd=/live/initrd1.img boot=live union=aufs nolocales noprompt \
 ocs_live_run="ocs-live-restore" \
 ocs_live_extra_param="-g auto -e1 auto -e2 -c -j2 -p true restoredisk karmic-test-1-img sda" \
 ocs_live_keymap="NONE" ocs_live_batch="yes" ocs_lang="en_US.UTF-8" vga=788 ip=frommedia
  • Or, for an auto-restore with no confimation required:
 MENU LABEL clonezilla live for karmic-test
 kernel /live/vmlinuz1
 append initrd=/live/initrd1.img boot=live union=aufs nolocales noprompt quickreboot \
 ocs_live_run="ocs-live-restore" \
 ocs_live_extra_param="-g auto -e1 auto -e2 -j2 -b -p reboot restoredisk karmic-test-1-img sda" \
 ocs_live_keymap="NONE" ocs_live_batch="yes" ocs_lang="en_US.UTF-8" vga=788 ip=frommedia
  • Safely unmount

Updating the Image

Follow this if you want to create an updated image

  • If you cannot fit more than one disk image on your USB stick then do the following two steps:
    • Mount your USB stick on another system.
    • Remove the old image folder from /home/partimage/
  • Boot PC when pressing F12 to get boot menu then select 'USB storage device' to boot from
  • From the clonezilla boot menu choose 'Default settings 800x600'
  • Select default language
  • Select 'Don't touch keymap'
  • Select 'Start_Clonezilla'
  • Select 'device-image'
  • Select 'skip'
  • Press Enter
  • Select Beginner
  • Select savedisk
  • Choose a filename (e.g. 'karmic-test-1-img')
  • Select disk device to copy from (probably only one to choose from)
  • Press Enter
  • Confirm 'y'
  • Wait for imaging to complete
  • You shouldn't need to update syslinux.cfg unless you have used a different image name.

Restoring an Image

Process for rebuilding using a USB stick:

  • Plug in rebuild USB stick
  • Power up system
  • Press F12 a few times during BIOS startup until the boot menu appears (this might be different on your PC)
  • Select USB Storage and press enter (i.e. boot from USB stick)
  • Wait until completed and rebooted (can take a few minutes)
Personal tools