Skip to content

How to clone the reference image onto a new NUC

Christopher Canel edited this page Sep 5, 2018 · 1 revision

This process describes how to make an exact clone of the current reference image for the Skull Canyon NUCs

  1. Boot the nuc using your favorite recovery image, then open a root shell.

For example, select Try ubuntu without installing if using Ubuntu recovery image

  1. Partition the disk into a 512MB partition for EFI and another partition for /
fdisk /dev/sda # substitute /dev/sda with the device name of the boot disk
# Command (m for help):
n # add a new partition
p # primary partition
1 # create it as the first partition
\n # first sector (leave as default)
+512M # create a 512MB partition
t # change partition type
ef # EFI
n # add a new partition
p # primary partition
2 # create it as the second partition
\n # first sector (leave as default)
\n # default size should use the rest of the disk
w # write changes to disk
  1. Format the partitions
mkfs.vfat /dev/sda1
mkfs.ext4 /dev/sda2
  1. Mount EFI, /, and the backup image
mkdir -p new_root
mount /dev/sda2 new_root
mkdir -p new_root/boot/efi
mount /dev/sda1 new_root/boot/efi
mkdir -p backup_disk # the folder to hold the backup image
mount -oro,noload /dev/sdx backup_disk # mount the backup image as read-only
  1. Copy the backup image
rsync -ahPHAXx backup_disk/path/to/image new_root/
cd new_root/
  1. Mount /dev
mount -o bind /dev dev
  1. Mount proc and sys
chroot .
mount -t proc proc proc
mount -t sysfs sys sys
  1. Install GRUB
grub-install /dev/sda # Install grub on boot disk
update-grub
  1. Fix fstab
ls -l /dev/disk/by-uuid/
vi /etc/fstab
# Change /dev/sda1 and /dev/sda2 UUIDs to match the UUIDs for this new machine
  1. Fix hostname

At this point, the machine is bootable. You can reboot the machine before changing hostname if so desired.

vi /etc/hosts # Change to desired hostname
vi /etc/hostname # Change to desired hostname
  1. Fix BIOS to power on after power failure (Optional)