A
A
Alexey2015-09-09 11:34:02
linux
Alexey, 2015-09-09 11:34:02

System transfer with dd, how to properly?

Tell me, you need to transfer the system from one machine to another, I want to use the dd utility.
on one machine I boot from live and copy the entire "sda" disk to a mounted disk in a specific directory.
The question is, the command dd if=/dev/sda of=/mnt/backup/sda.img bs=8M conv=sync,noerror
1. why is copying to the "sda.img" file here?, and not just to the directory.
2. If you copy this file back to an empty hard disk of another machine, will the system itself get up as it should?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
vaut, 2015-09-09
@KleinenbergG

You probably don't need dd but tar. With dd you get a file the size of your hard drive, not just the space used.
1) dd so called copies data byte by byte from the /dev/sda block device to the sda.img file, resulting in a disk image with a partition table that can be mounted, copied, etc.
2) It will work.
UPD forgot about the option with an old machine with Legacy, and a new one with UEFI. Then there will be problems.

B
bukass, 2015-09-09
@bukass

dd - literally d-isk d-amp - dd doesn't even care what file system it is. The disk image is copied.
dd is cool to do this
backup dd if=/dev/sda1 | gzip - | dd of=/path_to_backups/fs.img.gz
and then restore like this dd if=fs.img.gz | gunzip - | ddof=/dev/sda1

N
Nikolai Bryansky, 2015-09-12
@NukerPsych

With all my heart I recommend using clonezilla, it copies only used blocks, on disks where there is a lot of free space, it turns out many times faster. + Strange jokes do not happen if one disk is slightly larger than the other.

V
Vladimir, 2015-09-09
@rostel

if the sizes of the screws are the same or the second one is larger than the first
if the capacity is different, after increasing the partitions and the file system in them
instead of dd I prefer ddrescue
you can read here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question