Clonezilla

Jan 18, 2015
2 min read
Sep 12, 2023 18:43 EEST

Setup Server

We start clonezilla from a FreeBSD system via tftp. At first install tftpd:

cd /usr/ports/ftp/tftp-hpa
make install clean

Edit:

/etc/rc.conf
# tftp server
tftpd_enable=YES
tftpd_flags="-s /usr/local/tftp -p -B 1024"

Create required files for tfpt:

mkdir -p /usr/local/tftp/pxelinux.cfg
/usr/local/etc/rc.d/tftpd restart

Create config file for pxe:

/usr/local/tftp/pxelinux.cfg/default
# Default boot option to use
DEFAULT vesamenu.c32
# Prompt user for selection
PROMPT 0
TIMEOUT 20
ONTIMEOUT local

MENU WIDTH 80
MENU MARGIN 10
MENU PASSWORDMARGIN 3
MENU ROWS 12
MENU TABMSGROW 18
MENU CMDLINEROW 18
MENU ENDROW -1
MENU PASSWORDROW 11
MENU TIMEOUTROW 20
MENU TITLE 64Bit (x64) OS Choice

LABEL memtest
  MENU LABEL ^memtest86
  KERNEL memtest86

LABEL sysrescd
  MENU LABEL ^System Rescue CD 32-bit
  KERNEL rescuecd
  APPEND initrd=initram.igz dodhcp netboot=http://192.168.0.251/sysrcd.dat

LABEL sysres64
  MENU LABEL ^System Rescue CD 64-bit
  KERNEL rescue64
  APPEND initrd=initram.igz ethx=192.168.0.14 netboot=http://192.168.0.251/sysrcd.dat

LABEL clone_2
  MENU LABEL Clonezilla Live 2 (Ramdisk, VGA 1024x768)
  KERNEL http://192.168.0.251/image/clonezilla20230426/vmlinuz
  APPEND initrd=http://192.168.0.251/image/clonezilla20230426/initrd.img vga=788 boot=live union=overlay hostname=eoan config components noswap edd=on nomodeset enforcing=0 locales=en_US.UTF-8 keyboard-layouts=de ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch="no" net.ifnames=0 noeject ocs_server="192.168.0.251" ocs_daemonon="ssh" ocs_prerun="dhclient; mount -t nfs 192.168.0.251:/usr/home/partimag /home/partimag/" live-netdev fetch=http://192.168.0.251/image/clonezilla20230426/filesystem.squashfs ocs_preload=http://192.168.0.251/image/clonezilla20230426/filesystem.squashfs

LABEL local
  MENU DEFAULT
  MENU LABEL ^Boot Local System
  LOCALBOOT 0

Download clonezilla zip version and place it into the directory /usr/local/tftp/clonezilla. Create a small shell script to extract required files:

/usr/local/tftp/clonezilla/extract_clonezilla.sh
#!/bin/sh

unzip -j clonezilla-live-*.zip live/vmlinuz live/initrd.img live/filesystem.squashfs -d /usr/local/tftp/clonezilla/

And execute it:

chmod +x extract_clonezilla.sh
./extract_clonezilla.sh

Create a new folder and share it with NFS:

zfs create -o compression=on -o exec=off -o setuid=off zstorage/partimag
zfs set mountpoint=/home/partimag zstorage/partimag
zfs set sharenfs="-mapall=idefix -network=192.168.0/24" zstorage/partimag
chown idefix /home/partimag

Related Posts