0

Playing with a little headless server (PC Engines APU 1D4) and Debian. I am controlling it from terminal on serial port.

Normally I install the OS from a USB key, but the process is terribly long and error prone.

I am trying to clone 2 partitions from a working SSD on a new SSD: cloning 8GB takes something like 12 minutes instead of 3+ hours. For this time save it is worth changing a few parameters post installation.

The new SSD has been prepared with the proper partitions (using fdisk), boot activated on the first one, as it is in the original SSD. I checked that partitions start at the proper block and they are the same.

As I cannot copy directly from source to destination SDD, I did the copy on a SD card partitioned in the very same way. Then the image is cloned from the SD card to the new SSD.

I am using dd:

dd if=/dev/sdaX of=/dev/sdcY bs=64K conv=noerror,sync status=progress

All copied without any problem nor warning.

But when I start the unit with the new SSD installed, it stops at boot:

PC Engines APU BIOS build date: Sep  8 2014
Total memory 4096 MB
AMD G-T40E Processor
CPU MHz=1001
Press F10 key now for boot menu:
drive 0x000f2a90: PCHS=16383/16/63 translation=lba LCHS=1024/255/63 s=488397168
Booting from Hard Disk...
handle_75
handle_02

Any idea of what mean the two handle messages at the bottom?

What am I missing here?

3

You have to install and configure grub to make the new SSD bootable.

You have only cloned partitions of the old disk to the new disk, which omits the initial part of grub that is outside of a partition. If you had instead cloned the entire disk you would not need to reinstall the bootloader. To copy entire disk use dd like this

dd if=/dev/sda of=/dev/sdb

or if you like to measure progress

dd if=/dev/sda |pv| dd of=/dev/sdb

Note, the above command coping the full sda disk to sdb and not a partition like sdaX.

Otherwise, after cloning two partitions boot the system using live disk of any OS (preferably the same OS you're cloning). chroot root directory of your cloned OS and reinstall grub

In case you're using GPT partition table with Legacy BIOS a 1MB biosboot partition is also needed. Please search for 'Grub re installation procedure for your OS'

5
  • thank you. I understand. I thought that it was enough to make the partition bootable before the copy. I cannot clone the whole SDD because it is huge: there is a third data partition that would take ages to copy. I will try to do as you say and see what happens. But do you know why these cryptic handle messages? What do they mean? I cannot find any reference on the Net...
    – Alex Poca
    Nov 24 '17 at 12:09
  • Sorry, I don't know..
    – Abhik Bose
    Nov 24 '17 at 12:11
  • I used the bootloader from the USB stick (I completely forgot about it... damn) and now the system works like a charm. Thank you for the time you gave me.
    – Alex Poca
    Nov 24 '17 at 13:57
  • 1
    This procedure may be more flexible and less time consuming instead using dd unix.stackexchange.com/questions/403166/…
    – Abhik Bose
    Nov 24 '17 at 14:06
  • The key point here is that the actual startup part of grub is stored outside a partition, so only cloning partitions is not enough. Oct 18 '18 at 15:24
3

Please do not use dd for this use partclone instead.

partclone -b -s /dev/sda1 -o /dev/sdb1

This will transfer much faster than using dd anyway.

2
  • Thank you @jdwolf. I never used it and it is way faster than dd.
    – Alex Poca
    Nov 24 '17 at 13:54
  • While this might be good advice for cloning partitions, this will not solve the problem of the question asked here. The problem actually arises not from the method used to clone partitions, but from the fact that only partitions have been cloned, and not the initial part of grub which is stored outside any partition. It may be that partclone could also solve that problem, but not with the command proposed here. Also, partclone is not typically shipped, you should explain where to get it. Oct 18 '18 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.