14 Replies Latest reply on Aug 14, 2015 1:08 AM by rafaaguilar

    How to create an image of HD for replicate installation and configuration?

    rafaaguilar

      Hi,

       

      I need to install Linux on 25 ICS, and install some packages and configure files.

       

      I posible to create a hard disk image through bootable usb, and install it with the same method?

       

      Thanks in advance,

        • 1. Re: How to create an image of HD for replicate installation and configuration?
          RaymondDay

          I backed mine up to another LAN server. Can restore it to the batter Intel computer stick but at lest mine don't boot right yet. I posted about it and the link is under this line. Copied the part were you can copy the flash in side it. I had a USB to Ethernet on it too.

           

          -Raymond Day

          I backed mine up by using a boot USB stick here.

          ubuntu@ubuntu:~$ sudo su -

          root@ubuntu:~# df -h

          Filesystem      Size  Used Avail Use% Mounted on

          /cow            453M   27M  427M   6% /

          udev            429M  4.0K  429M   1% /dev

          tmpfs            91M  1.2M   90M   2% /run

          /dev/sda1       1.2G  1.2G  196K 100% /cdrom

          /dev/loop0      1.1G  1.1G     0 100% /rofs

          none            4.0K     0  4.0K   0% /sys/fs/cgroup

          tmpfs           453M  1.1M  452M   1% /tmp

          none            5.0M  4.0K  5.0M   1% /run/lock

          none            453M  232K  453M   1% /run/shm

          none            100M   72K  100M   1% /run/user

          root@ubuntu:~# dd if=/dev/mmcblk0 | ssh root@192.168.2.125 dd of=/media/4TB2/ics_ubuntu14-04-ran_allready.dd

          The authenticity of host '192.168.2.125 (192.168.2.125)' can't be established.

          ECDSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.

          Are you sure you want to continue connecting (yes/no)? yes

          Warning: Permanently added '192.168.2.125' (ECDSA) to the list of known hosts.

          root@192.168.2.125's password:

          14942208+0 records in

          14942208+0 records out

          7650410496 bytes (7.7 GB) copied, 700.453 s, 10.9 MB/s

          14942208+0 records in

          14942208+0 records out

          7650410496 bytes (7.7 GB) copied, 713.775 s, 10.7 MB/s

          root@ubuntu:~#

          • 2. Re: How to create an image of HD for replicate installation and configuration?
            Choong

            I tried cloning using Clonezilla but for some strange reasons, the new device doesn't run my saved image, but the restore partition. So, when I boot up the new device, it will perform a fresh install. Still trying to figure out how to clone a already configured ICS...

            • 3. Re: How to create an image of HD for replicate installation and configuration?
              BoonXeven

              reaper607 created instructions to backup and restore Windows on the Intel Compute Stick using Ubuntu. He's even created the instructions to make a bootable Ubuntu usb drive. I've used it a few times to backup and restore the image messing around with various things. It worked just fine. It should work exactly the same, or nearly the same, if you wanted to backup/restore a Linux image instead of Windows, although I haven't tried it. Here are his instructions. Stick_Image.pdf - Google Drive

              • 4. Re: How to create an image of HD for replicate installation and configuration?
                Choong

                Managed to clone using dd. It is a lot slower than Clonezilla, but this low level clone does work well.

                • 5. Re: How to create an image of HD for replicate installation and configuration?
                  Choong

                  Update: I have mixed results with dd. For some strange reasons, after trying on 3 ICS, 2 worked but 1 didn't. Still trying to figure out why the different in behaviour.

                  • 6. Re: How to create an image of HD for replicate installation and configuration?
                    BoonXeven

                    I'd expect them to have identical hardware. The only thing different with a full level install like that could be the bios firmware. Aside from that, and assuring good power supplies and cabling, I wouldn't know why it wouldn't work. I had a weird issue where I used a micro SD card to do a backup DD, and when I went to restore, it wouldn't recognize the card. Hadn't touched the card since making the image, same bootable thumbdrive, with the exact same image on it, but it wouldn't recognize it even after a reboot. Coppied the image to another drive using another computer, and was able to restore no problem.

                    • 7. Re: How to create an image of HD for replicate installation and configuration?
                      Choong

                      I found that UEFI is not working well. I have tried installing Ubuntu many times and after every reboot, it will fail to boot up. I had to delete off all partitions using the efibootmgr first, then reinstall Ubuntu for it to work. Anyway, will try to see if the behaviour is the same with the older BIOS next week.

                      • 8. Re: How to create an image of HD for replicate installation and configuration?
                        Choong

                        Managed to narrow down the problem to UEFI setup. Clone the Ubuntu image using DD doesn't update the UEFI NVRAM. That is the reason why the system will always boot from /EFI/BOOT/ directory. I had to manually copy the /EFI/ubuntu/grubx64.efi to /EFI/BOOT. Once that is done, my system will boot into the Ubuntu image nicely.

                        • 9. Re: How to create an image of HD for replicate installation and configuration?
                          rafaaguilar

                          I tried CloneZilla and cloned correctly the disk, but I have to boot the ICS with Debian usb and reinstall the uefi grub for boot normally.

                           

                          I now trying found a solution for not have repair the grub.

                           

                          Also I created script for customize ICS with correct SWAP partition (UUID), hostname and static network:

                           

                          #!/bin/bash

                           

                          # Read number of ICS

                           

                          echo -n -e "\nWhat number is this ICS?: "

                          read number

                           

                          printf "\nPreparing ICS ...\n"

                           

                          printf "\n********************************************************\n"

                           

                          # Change Hostname

                           

                          old=$(hostname)

                          new="ics$number"

                           

                          printf "\nUpdate hostname: OLD -> $old NEW -> $new"

                           

                          for file in \

                             /etc/exim4/update-exim4.conf.conf \

                             /etc/printcap \

                             /etc/hostname \

                             /etc/hosts \

                             /etc/ssh/ssh_host_rsa_key.pub \

                             /etc/ssh/ssh_host_dsa_key.pub \

                             /etc/motd \

                             /etc/ssmtp/ssmtp.conf

                          do

                             [ -f $file ] && sed -i.old -e "s:$old:$new:g" $file

                          done

                           

                          printf "\nHostname Updated: $new\n"

                           

                          printf "\n********************************************************\n"

                           

                          # Prepare Swap Partition

                           

                          printf "\nUpdate Swap UUID\n"

                           

                          uuid=$(blkid /dev/mmcblk0p3 | awk '{print $2}' | sed 's/\"//g')

                           

                          if [[ ! "${uuid:0:1}" == "U" ]]

                          then

                            mkswap /dev/mmcblk0p3

                            uuid=$(blkid /dev/mmcblk0p3 | awk '{print $2}' | sed 's/\"//g' | sed 's/\UUID=//g')

                            swapon -U $uuid

                          else

                            uuid=$(echo $uuid | sed 's/\UUID=//g')

                          fi

                           

                          sed -i '$ d' /etc/fstab

                          echo "UUID=$uuid none swap sw 0 0" >> /etc/fstab

                          echo "RESUME=UUID=$uuid" > /etc/initramfs-tools/conf.d/resume

                          update-initramfs -u

                           

                          printf "\nSwap UUID Updated: $uuid\n"

                           

                          printf "\n********************************************************\n"

                           

                          # Change Network Configuration

                           

                          printf "\nUpdate Network Configuration: NEW -> 192.168.11.2$number"

                           

                          old_address="192.168.10.31"

                          new_address="192.168.11.2$number"

                          sed -i.old_address -e "s:$old_address:$new_address:g" /etc/network/interfaces

                           

                          sed -i.old_address -e "s:$old_address:$new_address:g" /etc/hosts

                           

                          old_network="192.168.10.0"

                          new_network="192.168.11.0"

                          sed -i.old_network -e "s:$old_network:$new_network:g" /etc/network/interfaces

                           

                          old_broadcast="192.168.10.255"

                          new_broadcast="192.168.11.255"

                          sed -i.old_broadcast -e "s:$old_broadcast:$new_broadcast:g" /etc/network/interfaces

                           

                          old_gateway="192.168.10.1"

                          new_gateway="192.168.11.1"

                          sed -i.old_gateway -e "s:$old_gateway:$new_gateway:g" /etc/network/interfaces

                           

                          printf "\nNetwork Configuration Updated 192.168.11.2$number\n"

                           

                          printf "\n********************************************************\n"

                           

                           

                          printf "\n... All Done !!!\n"

                           

                          printf "\n... Reboot ICS in 3 seconds"

                           

                          sleep 3

                           

                          shutdown -r now

                          • 10. Re: How to create an image of HD for replicate installation and configuration?
                            Choong

                            Are you having problem with Clonezilla not creating the swap partition? I am facing the same issue.  Do you think the problem is with Clonezilla or ICS UEFI?

                            • 11. Re: How to create an image of HD for replicate installation and configuration?
                              rafaaguilar

                              Hi

                               

                              Finally I achieve create an image with CloneZilla and execute the script for solve the Swap problems. I also solved the UEFI problem with next steps:

                               

                              1. Install Debian/Ubuntu normally

                              2. Reboot and boot with installation usb of Debian/Ubuntu

                              3. Enter in repair mode

                              4. Force UEFI Grub installation in mmcblk0p2

                              5. Reboot

                              6. Create Image with CloneZilla

                              7. Voilà!!!