Clonezilla

From Leo's Notes
Revision as of 18:27, 1 September 2017 by Leo (talk | contribs) (→Automated Imaging)
This page was last edited on 1 September 2017, at 18:27.

Clonezilla is a disk imaging distro.

USB Setup

For other ways to set up a clonezilla USB drive, see http://clonezilla.org/liveusb.php.

To set up a USB key with Clonezilla manually:

Partition a USB stick so it looks something like this. Set the type to 'b' and make it bootable with 'a'.

# fdisk /dev/sdg
Command (m for help): p
Disk /dev/sdg: 28.9 GiB, 31004295168 bytes, 60555264 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x10cfca7b

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdg1  *     2048 60555263 60553216 28.9G  b W95 FAT32

## Format the drive
# mkfs.vfat -F 32 /dev/sdg1

Download the clonezilla zip archive, then extract it to the USB drive.

# wget http://gigenet.dl.osdn.jp/clonezilla/68244/clonezilla-live-20170829-zesty-i386.zip
# mount /dev/sdg1 /mnt/usb
# cd /mnt/usb
# tar -xzf ~/clonzilla*zip
## Install the MBR using the built in script
# cd /mnt/usb/utils/linux
# bash makeboot.sh /dev/sdg1

Automated Imaging

You can automatically image a drive or restore an image by using the ocs_live_run option that is passed to the kernel on boot. This will work with PXE or USB.

To do this on a USB stick, create a boot entry in syslinux/syslinux.cfg that contains the restore (or imaging) command specified by the ocs_live_run parameter. On an EFI system, you will want to edit /EFI/boot/grub.cfg instead.

To restore an image located in /partimag, create a boot entry similar to the one below:

...
# simple menu title
MENU TITLE clonezilla.org, clonezilla.nchc.org.tw

# Automatic Restore for display-v1.1
label Clonezilla restore display
  # MENU DEFAULT
  # MENU HIDE
  MENU LABEL Clonezilla Restore Display v1.1
  # MENU PASSWD
  kernel /live/vmlinuz
  append initrd=/live/initrd.img boot=live union=overlay username=user hostname=zesty config  components noswap edd=on nomodeset noeject locales=en_US.UTF-8 keyboard-layouts=NONE ocs_live_run="ocs-sr -g auto -e1 auto -e2 -r -icds -j2 -p reboot restoredisk ../../lib/live/mount/medium/partimag/display-v1.1 sda" ocs_live_extra_param="" ocs_live_batch="no" vga=788 ip= net.ifnames=0  splash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1
  TEXT HELP
  Automatically images from USB for the TTuff 1U computer
  ENDTEXT

label Clonezilla live
...

If you want the entry to boot by default, uncomment the MENU DEFAULT line and then comment out the one that is.