D
D
Danil Tunev2021-08-04 20:18:56
linux
Danil Tunev, 2021-08-04 20:18:56

How to copy operating system from one hdd to another?

Hello! I must say right away that I’m doing Google, but the disk on which the operating system is about to fall apart, so I can’t experiment and practice using recipes from all sorts of unreliable sources. I used the first available resource and there they advised the following command "dd if=/dev/sda of=/dev/sdb". As a result, the bootloader does not start, there is a suspicion that it is not in the zero sector! What do you think?

Answer the question

In order to leave comments, you need to log in

8 answer(s)
A
Alexey Cheremisin, 2021-08-04
@leahch

In principle, everything is simple:
1) connect the disk
2) partition it by analogy with the existing one (parted)
3) format the partitions (XXX.mkfs)
4) copy each partition separately (cp -a /from /to)
5) install the bootloader
6) edit /to/etc/fstab and loader scripts
But! It would be nice to know:
- what partitions and type of partition table
- what file systems
- what bootloader
- are there any ZFS / LVM / RAID and other things ..
And here for each item there are options ...
Yes, you can try using https:// clonezilla.org/

D
Drno, 2021-08-04
@Drno

First of all, with a dying disk. We make a complete image.
The same clonezilla works wonderfully. Or any other software. Akronis, paragon And so on.
Well, then we roll onto a new working disk

C
CityCat4, 2021-08-05
@CityCat4

What happens when you try to boot from sdb?
You can make a copy via dump. Then boot from livedvd and restore

S
Sanes, 2021-08-04
@Sanes

After copying via dd, it is usually necessary to update the initramfs.
If the console appears, dracut:/$_then we update the data.
dracut --regenerate-all -f
This is for RHEL-like ones. For others, it's a little different.

D
Damian Lewis, 2021-08-04
@DamianLewis

Why bother if you can make a backup via TimeShift and restore it to a new partition. Moreover, when restoring, he updates and installs the GRUB bootloader on the new partition. No need to use the command line, everything is done in a couple of mouse clicks.

A
Alexey Dmitriev, 2021-08-04
@SignFinder

https://rescuezilla.com/ gui for clonezilla

V
Vitaliy K, 2021-08-05
@revenger

Not Linux, really, but theoretically it should work.
Transferring Windows from HDD to SSD without reinstalling...

J
justhostRU, 2021-08-05
@justhostRU

>at "dd if=/dev/sda of=/dev/sdb". As a result, the bootloader does not start, there is a suspicion that it is not in the zero sector! What do you think?
the bootloader is restored separately. if you have done dd and rolled it onto a new disk, there is no need to further torment the old one. just restore the bootloader, for example here:
https://help.ubuntu.ru/wiki/%D0%B2%D0%BE%D1%81%D1%...
perform the most reliable, second way - Recovery using chroot

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question