hi,
i have a desktop pc with 2 identical disks.
1 disk is used as "main" device. the other is used for internal backup purposes: every week i clone the main disk over the backup disk using dd.
in this way, if the main drive fails i can boot the pc using the backup drive and i'm done: i can take all my time to replace the faulty drive with no issue...
however, just after the cloning process the 2 disks are identical.
this leads to a big mess while mounting /etc/fstab devices, as the partitions of the 2 drives have the same UUIDs.
to fix this, i added the following line to /etc/default/grub of the main disk:
Code:
GRUB_CMDLINE_LINUX_DEFAULT="libata.force=2.00:disable"
and i added the following commands to the backup script:
Code:
# ... cloning stuff...
# mount backup root partition
sudo mount ${targetDisk}${rootPartitionN} mnt
# edit backup /etc/default/grub so that main disk is ignored
sudo sed -i 's/libata.force=2.00:disable/libata.force=1.00:disable/' mnt/etc/default/grub
# prepare chrooting into backup disk
for i in /dev /dev/pts /proc /sys /run; do
sudo mount -B $i mnt$i
done
# update grub on backup disk
sudo chroot mnt update-grub
for i in /run /sys /proc /dev/pts /dev; do
sudo umount mnt$i
done
sudo umount mnt
the script seems to be working fine, as the backup disk /etc/default/grub file is correctly edited.
- if both the drives are plugged in and i boot the system using the main drive, everything works fine: grub ignores the backup disk, as expected.
- if i unplug the main disk, i can boot the backup disk and everything works fine.
- but if both the drives are plugged in and i boot using the backup drive, it does not work: the screen is black, with a blinking cursor. after a few minutes the display powers off and i can only roughly power off the pc.
any suggestion?