Today, I bought a second server almost identical to my first one (I guess). Specs (processor model, RAM, HDD) are the same.
But I failed to copy the disk of the first one to the second one. It didn't boot. A technician dispatched to check for any hardware malfunction said "software misconfiguration. Server does not boot. Can't even tell which OS is installed).
Here is how I failed:
I did fdisk -l on my first disk.
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000b6660
Device Boot Start End Blocks Id System
/dev/sda1 * 4096 16386047 8190976 83 Linux
/dev/sda2 16386048 17432575 523264 82 Linux swap / Solaris
/dev/sda3 17432576 222230527 102398976 83 Linux
/dev/sda4 222230528 976762879 377266176 83 Linux
Then I did boot the second server in rescue mode (kind like from a live CD: /dev/sda
is not mounted and can safely be manipulated).
I used fdisk to create 4 primary partitions using the start and end values provided by fdisk (eg: 4096 → 16386047 for
/dev/sda1
).I did set
/dev/sda2
as "82".- I did mark
/dev/sda1
as bootable - I did format
/dev/sda3
(/var
) and/dev/sda4
(/backup
) as ext4 - I did mount both partitions.
- I did rsync /var from the /var of the first server
- I overwrote the first flock (0->4096) of the 2nd hdd with
dd
(data taken from the 1st hdd). - I overwrote
/dev/sda1
on the 2nd harddrive withdd
image from the first hdd
I was expecting :
A harddrive with the same partition scheme, save first 4096 bytes, same /dev/sda1
, a rsync copy of /dev/sda3
(/var
) and a different /backup
(useless for the server to operate).
Why does this scheme not work? How can I do better? I have no objection in transferring 500 GB on the network between the two servers to do the whole harddrive, but then I have no way of storing the image on the new server...